@polyvharmony/live-scenes-foundation 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/Index.d.ets +2 -0
- package/ets/modules.abc +0 -0
- package/libs/plvsocket.har +0 -0
- package/oh-package.json5 +1 -1
- package/package.json +1 -1
- package/src/main/ets/common/IPLVBackwardInterface.d.ets +2 -0
- package/src/main/ets/common/PLVBasicDataSource.d.ets +2 -0
- package/src/main/ets/common/PLVCallback.d.ets +10 -8
- package/src/main/ets/common/PLVCommonConstants.d.ets +2 -0
- package/src/main/ets/common/PLVCommonEnums.d.ets +2 -0
- package/src/main/ets/common/PLVDeviceUtils.d.ets +4 -2
- package/src/main/ets/common/PLVHashMap.d.ets +3 -1
- package/src/main/ets/common/PLVJSONUtils.d.ets +14 -12
- package/src/main/ets/common/PLVNetUtils.d.ets +6 -4
- package/src/main/ets/common/PLVPreferencesUtils.d.ets +10 -8
- package/src/main/ets/common/PLVScheduledTask.d.ets +3 -1
- package/src/main/ets/common/PLVSimpleBuffer.d.ets +5 -3
- package/src/main/ets/common/PLVSparseArray.d.ets +8 -6
- package/src/main/ets/common/PLVTextUtils.d.ets +10 -8
- package/src/main/ets/common/PLVTimeUtils.d.ets +3 -1
- package/src/main/ets/common/PLVToastUtils.d.ets +4 -2
- package/src/main/ets/common/PLVType.d.ets +2 -0
- package/src/main/ets/common/PLVUACreator.d.ets +3 -1
- package/src/main/ets/common/PLVUtils.d.ets +24 -22
- package/src/main/ets/common/PLVWebUtils.d.ets +6 -4
- package/src/main/ets/common/ui/PLVNodeController.d.ets +10 -8
- package/src/main/ets/modules/log/PLVLogger.d.ets +10 -8
- package/src/main/ets/modules/log/PLVXLogFilePrinter.d.ets +4 -2
- package/src/main/ets/modules/log/PLVXLogWorker.d.ets +2 -0
- package/src/main/ets/modules/net/PLVApiConstants.d.ets +2 -0
- package/src/main/ets/modules/net/PLVHttpData.d.ets +3 -1
- package/src/main/ets/modules/net/PLVHttpError.d.ets +4 -2
- package/src/main/ets/modules/net/PLVHttpRequest.d.ets +10 -8
- package/src/main/ets/modules/net/PLVRequestSetting.d.ets +5 -3
- package/src/main/ets/modules/socket/PLVSocketIO.d.ets +24 -21
- package/src/main/ets/modules/web/PLVFailureLayout.d.ets +2 -0
- package/src/main/ets/modules/web/PLVLoadingLayout.d.ets +2 -0
- package/src/main/ets/modules/web/PLVNewWindowLayout.d.ets +2 -0
- package/src/main/ets/modules/web/PLVSimpleWeb.d.ets +2 -0
- package/src/main/ets/modules/web/PLVWebController.d.ets +39 -37
- package/src/main/ets/modules/web/PLVWebModel.d.ets +2 -0
- package/src/main/module.json +1 -1
- package/Index.js +0 -30
- package/src/main/ets/common/IPLVBackwardInterface.js +0 -1
- package/src/main/ets/common/PLVBasicDataSource.js +0 -172
- package/src/main/ets/common/PLVCallback.js +0 -186
- package/src/main/ets/common/PLVCommonConstants.js +0 -11
- package/src/main/ets/common/PLVCommonEnums.js +0 -22
- package/src/main/ets/common/PLVDeviceUtils.js +0 -36
- package/src/main/ets/common/PLVHashMap.js +0 -7
- package/src/main/ets/common/PLVJSONUtils.js +0 -103
- package/src/main/ets/common/PLVNetUtils.js +0 -35
- package/src/main/ets/common/PLVPreferencesUtils.js +0 -30
- package/src/main/ets/common/PLVScheduledTask.js +0 -44
- package/src/main/ets/common/PLVSimpleBuffer.js +0 -30
- package/src/main/ets/common/PLVSparseArray.js +0 -44
- package/src/main/ets/common/PLVTextUtils.js +0 -79
- package/src/main/ets/common/PLVTimeUtils.js +0 -14
- package/src/main/ets/common/PLVToastUtils.js +0 -17
- package/src/main/ets/common/PLVType.js +0 -1
- package/src/main/ets/common/PLVUACreator.js +0 -11
- package/src/main/ets/common/PLVUtils.js +0 -241
- package/src/main/ets/common/PLVWebUtils.js +0 -78
- package/src/main/ets/common/ui/PLVNodeController.js +0 -104
- package/src/main/ets/modules/log/PLVLogger.js +0 -67
- package/src/main/ets/modules/log/PLVXLogFilePrinter.js +0 -39
- package/src/main/ets/modules/log/PLVXLogWorker.js +0 -4
- package/src/main/ets/modules/net/PLVApiConstants.js +0 -7
- package/src/main/ets/modules/net/PLVHttpData.js +0 -8
- package/src/main/ets/modules/net/PLVHttpError.js +0 -13
- package/src/main/ets/modules/net/PLVHttpRequest.js +0 -148
- package/src/main/ets/modules/net/PLVRequestSetting.js +0 -33
- package/src/main/ets/modules/socket/PLVSocketIO.js +0 -181
- package/src/main/ets/modules/web/PLVFailureLayout.js +0 -76
- package/src/main/ets/modules/web/PLVLoadingLayout.js +0 -45
- package/src/main/ets/modules/web/PLVNewWindowLayout.js +0 -61
- package/src/main/ets/modules/web/PLVSimpleWeb.js +0 -256
- package/src/main/ets/modules/web/PLVWebController.js +0 -283
- package/src/main/ets/modules/web/PLVWebModel.js +0 -1
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError } from '@ohos/axios';
|
|
2
|
-
import HashMap from "@ohos.util.HashMap";
|
|
3
|
-
import PLVJSONUtils from '../../common/PLVJSONUtils';
|
|
4
|
-
import { PLVHttpError } from './PLVHttpError';
|
|
5
|
-
import PLVLogger from '../log/PLVLogger';
|
|
6
|
-
import { PLVRequestSetting } from './PLVRequestSetting';
|
|
7
|
-
import { PLVHttpData } from './PLVHttpData';
|
|
8
|
-
import PLVUtils from '../../common/PLVUtils';
|
|
9
|
-
import { PLVNetUtils } from '../../common/PLVNetUtils';
|
|
10
|
-
const TAG = '[PLVHttpRequest]';
|
|
11
|
-
export class PLVHttpRequest {
|
|
12
|
-
constructor(w15) {
|
|
13
|
-
this.baseURL = w15;
|
|
14
|
-
}
|
|
15
|
-
ua(v15) {
|
|
16
|
-
this.userAgent = v15;
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
create(i15) {
|
|
20
|
-
const j15 = axios.create();
|
|
21
|
-
j15.defaults.timeout = 10000;
|
|
22
|
-
j15.defaults.readTimeout = 10000;
|
|
23
|
-
j15.defaults.connectTimeout = 10000;
|
|
24
|
-
j15.defaults.baseURL = this.baseURL;
|
|
25
|
-
j15.defaults.headers.common['User-Agent'] = this.userAgent;
|
|
26
|
-
const k15 = (i15?.cacheTime === 0 ? PLVHttpRequest.CACHE_TIMEOUT : i15?.cacheTime) ?? PLVHttpRequest.CACHE_TIMEOUT;
|
|
27
|
-
if (i15?.formUrlEncoded) {
|
|
28
|
-
j15.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
29
|
-
}
|
|
30
|
-
let l15 = '';
|
|
31
|
-
j15.interceptors.request.use((q15) => {
|
|
32
|
-
if (i15?.signKey) {
|
|
33
|
-
const t15 = q15.params ? q15.params : q15.data;
|
|
34
|
-
const u15 = PLVJSONUtils.object2Map(t15);
|
|
35
|
-
u15.delete('log');
|
|
36
|
-
t15['sign'] = PLVRequestSetting.createSign(u15, i15.signKey);
|
|
37
|
-
}
|
|
38
|
-
if (PLVHttpRequest.token) {
|
|
39
|
-
const r15 = q15.params;
|
|
40
|
-
const s15 = q15.data;
|
|
41
|
-
if (r15 && Object.keys(r15).includes('appId')) {
|
|
42
|
-
r15['token'] = PLVHttpRequest.token;
|
|
43
|
-
r15['viewerToken'] = PLVHttpRequest.token;
|
|
44
|
-
}
|
|
45
|
-
if (s15 && Object.keys(s15).includes('appId')) {
|
|
46
|
-
s15['token'] = PLVHttpRequest.token;
|
|
47
|
-
s15['viewerToken'] = PLVHttpRequest.token;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (i15?.useCache) {
|
|
51
|
-
l15 = this.generateCacheKey(q15);
|
|
52
|
-
}
|
|
53
|
-
PLVLogger.info(TAG, `--> ${this.method} ${this.baseURL}${i15?.url}${PLVNetUtils.formatParams(q15?.params)}`);
|
|
54
|
-
PLVLogger.info(TAG, `--> ${PLVNetUtils.formatParams(q15?.data)}`);
|
|
55
|
-
return q15;
|
|
56
|
-
}, (p15) => {
|
|
57
|
-
return Promise.reject(p15);
|
|
58
|
-
});
|
|
59
|
-
j15.interceptors.response.use((n15) => {
|
|
60
|
-
PLVLogger.info(TAG, `<-- ${n15.status} ${this.method} ${this.baseURL}${n15.config.url}${PLVNetUtils.formatParams(i15?.params)} (${n15.performanceTiming?.totalTiming}ms)`);
|
|
61
|
-
PLVLogger.info(TAG, `Header: ${PLVJSONUtils.safeStringify(n15.headers)}`);
|
|
62
|
-
PLVLogger.info(TAG, `Result: ${PLVJSONUtils.safeStringify(n15.data)}`);
|
|
63
|
-
if (i15?.aesDecrypted) {
|
|
64
|
-
const o15 = n15.data;
|
|
65
|
-
if (o15) {
|
|
66
|
-
o15['data'] = PLVJSONUtils.safeParse(PLVRequestSetting.decryptDataSync(o15['data']));
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
PLVLogger.printError(TAG, 'response error', new Error('jsonData undefined'));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (i15?.fillData) {
|
|
73
|
-
PLVHttpData.fill(i15.fillData, n15);
|
|
74
|
-
}
|
|
75
|
-
if (l15) {
|
|
76
|
-
PLVHttpRequest.CACHE_DATA_MAP.set(l15, n15);
|
|
77
|
-
setTimeout(() => {
|
|
78
|
-
PLVHttpRequest.CACHE_DATA_MAP.remove(l15);
|
|
79
|
-
}, k15);
|
|
80
|
-
}
|
|
81
|
-
return n15;
|
|
82
|
-
}, (m15) => {
|
|
83
|
-
return Promise.reject(m15);
|
|
84
|
-
});
|
|
85
|
-
return j15;
|
|
86
|
-
}
|
|
87
|
-
request(b15) {
|
|
88
|
-
return PLVUtils.safePromise((c15, d15) => {
|
|
89
|
-
b15.then((f15) => {
|
|
90
|
-
const g15 = f15.data;
|
|
91
|
-
if (g15) {
|
|
92
|
-
for (const h15 of Object.keys(g15)) {
|
|
93
|
-
if (h15 == 'code' && g15[h15] != 200 + '') {
|
|
94
|
-
d15(new PLVHttpError(new AxiosError(PLVJSONUtils.safeStringify(f15.data || ''), g15[h15], undefined, undefined, f15)));
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
c15(f15);
|
|
100
|
-
}).catch((e15) => {
|
|
101
|
-
d15(new PLVHttpError(e15));
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
get(a15) {
|
|
106
|
-
this.method = 'GET';
|
|
107
|
-
return this.checkCache(a15) || this.request(this.create(a15).get(a15?.url, a15));
|
|
108
|
-
}
|
|
109
|
-
post(z14) {
|
|
110
|
-
this.method = 'POST';
|
|
111
|
-
return this.checkCache(z14) || this.request(this.create(z14).post(z14?.url, z14?.data, z14));
|
|
112
|
-
}
|
|
113
|
-
checkCache(x14) {
|
|
114
|
-
if (x14?.useCache) {
|
|
115
|
-
const y14 = this.generateCacheKey(x14);
|
|
116
|
-
if (PLVHttpRequest.CACHE_DATA_MAP.hasKey(y14)) {
|
|
117
|
-
PLVLogger.info(TAG, `--> ${this.method} ${this.baseURL}${x14?.url} use cache`);
|
|
118
|
-
return Promise.resolve(PLVHttpRequest.CACHE_DATA_MAP.get(y14));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
generateCacheKey(q14) {
|
|
124
|
-
let r14 = this.baseURL + '' + q14?.url;
|
|
125
|
-
const s14 = q14?.params;
|
|
126
|
-
const t14 = q14?.data;
|
|
127
|
-
const u14 = (v14) => {
|
|
128
|
-
if (v14) {
|
|
129
|
-
for (const w14 of Object.keys(v14)) {
|
|
130
|
-
if (w14 == 'timestamp' || w14 == 'sign' || w14 == 'token' || w14 == 'viewerToken') {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
if (w14 == 'appId' && PLVHttpRequest.token) {
|
|
134
|
-
r14 += PLVHttpRequest.token;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
r14 += v14[w14];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
u14(s14);
|
|
143
|
-
u14(t14);
|
|
144
|
-
return r14;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
PLVHttpRequest.CACHE_TIMEOUT = 1000 * 60 * 5;
|
|
148
|
-
PLVHttpRequest.CACHE_DATA_MAP = new HashMap();
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import buffer from "@ohos.buffer";
|
|
2
|
-
import { CryptoJS } from '@ohos/crypto-js';
|
|
3
|
-
export class PLVRequestSetting {
|
|
4
|
-
static createSign(d16, e16) {
|
|
5
|
-
const f16 = e16 + PLVRequestSetting.concatParams(d16) + e16;
|
|
6
|
-
const g16 = CryptoJS.MD5(f16).toString().toUpperCase();
|
|
7
|
-
return g16;
|
|
8
|
-
}
|
|
9
|
-
static decryptDataSync(b16) {
|
|
10
|
-
const c16 = CryptoJS.AES.decrypt(buffer.from(b16, 'base64').toString('hex'), CryptoJS.enc.Utf8.parse(PLVRequestSetting.DECRYPT_KEY_1_SRC), {
|
|
11
|
-
format: CryptoJS.format.Hex,
|
|
12
|
-
iv: CryptoJS.enc.Utf8.parse(PLVRequestSetting.DECRYPT_KEY_2_SRC),
|
|
13
|
-
mode: CryptoJS.mode.CBC,
|
|
14
|
-
padding: CryptoJS.pad.Pkcs7
|
|
15
|
-
}).toString(CryptoJS.enc.Utf8);
|
|
16
|
-
return c16;
|
|
17
|
-
}
|
|
18
|
-
static concatParams(x15) {
|
|
19
|
-
const y15 = Array.from(x15.keys()).sort();
|
|
20
|
-
const z15 = [];
|
|
21
|
-
for (const a16 of y15) {
|
|
22
|
-
if (!a16 || !x15.get(a16)) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
z15.push(a16 + x15.get(a16));
|
|
26
|
-
}
|
|
27
|
-
return z15.join('');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
PLVRequestSetting.KEY_1 = 'polyv_sdk_api_innor';
|
|
31
|
-
PLVRequestSetting.PLV_SWITCH_API_INNOR = 'polyv_switch_api_innor';
|
|
32
|
-
PLVRequestSetting.DECRYPT_KEY_1_SRC = 'PolyvApiResponse';
|
|
33
|
-
PLVRequestSetting.DECRYPT_KEY_2_SRC = 'PolyvLiveEncrypt';
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { client_socket } from 'socket';
|
|
2
|
-
import PLVCommonConstants from '../../common/PLVCommonConstants';
|
|
3
|
-
import PLVLogger from '../log/PLVLogger';
|
|
4
|
-
const TAG = '[PLVSocketIO]';
|
|
5
|
-
export class PLVSocketIO {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.client = new client_socket();
|
|
8
|
-
this.socketIOStatus = PLVSocketIOStatus.IDLE;
|
|
9
|
-
this.isTokenExpired = false;
|
|
10
|
-
}
|
|
11
|
-
set_open_listener(s17) {
|
|
12
|
-
this.client.set_open_listener(s17);
|
|
13
|
-
}
|
|
14
|
-
set_fail_listener(r17) {
|
|
15
|
-
this.client.set_fail_listener(r17);
|
|
16
|
-
}
|
|
17
|
-
set_reconnecting_listener(q17) {
|
|
18
|
-
this.client.set_reconnecting_listener(q17);
|
|
19
|
-
}
|
|
20
|
-
set_reconnect_listener(p17) {
|
|
21
|
-
this.client.set_reconnect_listener(p17);
|
|
22
|
-
}
|
|
23
|
-
set_close_listener(o17) {
|
|
24
|
-
this.client.set_close_listener(o17);
|
|
25
|
-
}
|
|
26
|
-
set_socket_open_listener(n17) {
|
|
27
|
-
this.client.set_socket_open_listener(n17);
|
|
28
|
-
}
|
|
29
|
-
set_socket_close_listener(m17) {
|
|
30
|
-
this.client.set_socket_close_listener(m17);
|
|
31
|
-
}
|
|
32
|
-
connect(l17) {
|
|
33
|
-
this.connectWithQuery(l17, '', '');
|
|
34
|
-
}
|
|
35
|
-
connectWithQuery(i17, j17, k17) {
|
|
36
|
-
this.isTokenExpired = false;
|
|
37
|
-
if (this.socketIOStatus == PLVSocketIOStatus.IDLE || this.socketIOStatus == PLVSocketIOStatus.SOCKET_CLOSE) {
|
|
38
|
-
this.socketIOStatus = PLVSocketIOStatus.CONNECT;
|
|
39
|
-
this.onSocketIOStatusListener?.(this.socketIOStatus);
|
|
40
|
-
}
|
|
41
|
-
this.set_open_listener(() => {
|
|
42
|
-
PLVLogger.info(TAG, `call socket open, isTokenExpired=${this.isTokenExpired}`);
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
if (!this.isTokenExpired) {
|
|
45
|
-
this.socketIOStatus = this.socketIOStatus == PLVSocketIOStatus.RECONNECT ? PLVSocketIOStatus.RECONNECT_SUCCESS : PLVSocketIOStatus.OPEN;
|
|
46
|
-
this.onSocketIOStatusListener?.(this.socketIOStatus);
|
|
47
|
-
}
|
|
48
|
-
}, this.isTokenExpired ? 0 : PLVCommonConstants.DELAY_TIME_S);
|
|
49
|
-
});
|
|
50
|
-
this.set_reconnect_listener(() => {
|
|
51
|
-
PLVLogger.info(TAG, 'call socket reconnect');
|
|
52
|
-
this.socketIOStatus = PLVSocketIOStatus.RECONNECT;
|
|
53
|
-
this.onSocketIOStatusListener?.(this.socketIOStatus);
|
|
54
|
-
});
|
|
55
|
-
this.set_socket_close_listener(() => {
|
|
56
|
-
PLVLogger.info(TAG, `call socket close, isTokenExpired=${this.isTokenExpired}`);
|
|
57
|
-
this.socketIOStatus = PLVSocketIOStatus.SOCKET_CLOSE;
|
|
58
|
-
this.onSocketIOStatusListener?.(this.socketIOStatus);
|
|
59
|
-
setTimeout(() => {
|
|
60
|
-
if (!this.isTokenExpired) {
|
|
61
|
-
this.close();
|
|
62
|
-
}
|
|
63
|
-
}, this.isTokenExpired ? 0 : PLVCommonConstants.DELAY_TIME_S);
|
|
64
|
-
});
|
|
65
|
-
this.set_close_listener(() => {
|
|
66
|
-
PLVLogger.info(TAG, 'call close');
|
|
67
|
-
});
|
|
68
|
-
this.client.connectWithQuery(i17, j17, k17);
|
|
69
|
-
}
|
|
70
|
-
connected() {
|
|
71
|
-
return this.opened() && this.socketIOStatus != PLVSocketIOStatus.SOCKET_CLOSE;
|
|
72
|
-
}
|
|
73
|
-
disconnect(h17) {
|
|
74
|
-
if (this.socketIOStatus != PLVSocketIOStatus.SOCKET_CLOSE && !h17) {
|
|
75
|
-
this.socket_close();
|
|
76
|
-
}
|
|
77
|
-
this.close();
|
|
78
|
-
}
|
|
79
|
-
destroy(g17) {
|
|
80
|
-
this.disconnect(g17);
|
|
81
|
-
this.clear_con_listeners();
|
|
82
|
-
this.clear_socket_listeners();
|
|
83
|
-
}
|
|
84
|
-
clear_con_listeners() {
|
|
85
|
-
this.client.clear_con_listeners();
|
|
86
|
-
}
|
|
87
|
-
clear_socket_listeners() {
|
|
88
|
-
this.client.clear_socket_listeners();
|
|
89
|
-
}
|
|
90
|
-
set_reconnect_attempts(f17) {
|
|
91
|
-
this.client.set_reconnect_attempts(f17);
|
|
92
|
-
}
|
|
93
|
-
set_reconnect_delay(e17) {
|
|
94
|
-
this.client.set_reconnect_delay(e17);
|
|
95
|
-
}
|
|
96
|
-
set_reconnect_delay_max(d17) {
|
|
97
|
-
this.client.set_reconnect_delay_max(d17);
|
|
98
|
-
}
|
|
99
|
-
set_logs_default() {
|
|
100
|
-
this.client.set_logs_default();
|
|
101
|
-
}
|
|
102
|
-
set_logs_quiet() {
|
|
103
|
-
this.client.set_logs_quiet();
|
|
104
|
-
}
|
|
105
|
-
set_logs_verbose() {
|
|
106
|
-
this.client.set_logs_verbose();
|
|
107
|
-
}
|
|
108
|
-
close() {
|
|
109
|
-
this.client.close();
|
|
110
|
-
}
|
|
111
|
-
sync_close() {
|
|
112
|
-
this.client.sync_close();
|
|
113
|
-
}
|
|
114
|
-
set_proxy_basic_auth(a17, b17, c17) {
|
|
115
|
-
this.client.set_proxy_basic_auth(a17, b17, c17);
|
|
116
|
-
}
|
|
117
|
-
opened() {
|
|
118
|
-
return this.client.opened();
|
|
119
|
-
}
|
|
120
|
-
get_sessionid() {
|
|
121
|
-
return this.client.get_sessionid();
|
|
122
|
-
}
|
|
123
|
-
set_nsp(z16) {
|
|
124
|
-
this.client.set_nsp(z16);
|
|
125
|
-
}
|
|
126
|
-
on(w16, x16) {
|
|
127
|
-
this.client.on(w16, (y16) => {
|
|
128
|
-
x16(this.replaceJson(y16));
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
once(u16, v16) {
|
|
132
|
-
this.client.once(u16, v16);
|
|
133
|
-
}
|
|
134
|
-
off(t16) {
|
|
135
|
-
this.client.off(t16);
|
|
136
|
-
}
|
|
137
|
-
off_all() {
|
|
138
|
-
this.client.off_all();
|
|
139
|
-
}
|
|
140
|
-
socket_close() {
|
|
141
|
-
this.client.socket_close();
|
|
142
|
-
}
|
|
143
|
-
on_error(s16) {
|
|
144
|
-
this.client.on_error(s16);
|
|
145
|
-
}
|
|
146
|
-
off_error() {
|
|
147
|
-
this.client.off_error();
|
|
148
|
-
}
|
|
149
|
-
emitSkipCheck(o16, p16, q16) {
|
|
150
|
-
this.client.emit(o16, p16, (r16) => {
|
|
151
|
-
q16?.(this.replaceJson(r16));
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
emit(k16, l16, m16) {
|
|
155
|
-
PLVLogger.info(TAG, `emit: ${l16}, name: ${k16}, connected: ${this.connected()}`);
|
|
156
|
-
if (this.connected()) {
|
|
157
|
-
this.client.emit(k16, l16, (n16) => {
|
|
158
|
-
m16?.(this.replaceJson(n16));
|
|
159
|
-
});
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
replaceJson(i16) {
|
|
165
|
-
i16 = i16.replace(/^"{/, '{').replace(/}"$/, '}').replace(/"{/, '{');
|
|
166
|
-
const j16 = i16.lastIndexOf('}"');
|
|
167
|
-
if (j16 !== -1) {
|
|
168
|
-
i16 = i16.substring(0, j16) + '}' + i16.substring(j16 + 2);
|
|
169
|
-
}
|
|
170
|
-
return i16;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
export var PLVSocketIOStatus;
|
|
174
|
-
(function (h16) {
|
|
175
|
-
h16[h16["IDLE"] = 0] = "IDLE";
|
|
176
|
-
h16[h16["CONNECT"] = 1] = "CONNECT";
|
|
177
|
-
h16[h16["OPEN"] = 2] = "OPEN";
|
|
178
|
-
h16[h16["RECONNECT"] = 3] = "RECONNECT";
|
|
179
|
-
h16[h16["RECONNECT_SUCCESS"] = 4] = "RECONNECT_SUCCESS";
|
|
180
|
-
h16[h16["SOCKET_CLOSE"] = 5] = "SOCKET_CLOSE";
|
|
181
|
-
})(PLVSocketIOStatus || (PLVSocketIOStatus = {}));
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
if (!("finalizeConstruction" in ViewPU.prototype)) {
|
|
2
|
-
Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
|
|
3
|
-
}
|
|
4
|
-
import PLVCommonConstants from '../../common/PLVCommonConstants';
|
|
5
|
-
export class PLVFailureLayout extends ViewPU {
|
|
6
|
-
constructor(i18, j18, k18, l18 = -1, m18 = undefined, n18) {
|
|
7
|
-
super(i18, k18, l18, n18);
|
|
8
|
-
if (typeof m18 === "function") {
|
|
9
|
-
this.paramsGenerator_ = m18;
|
|
10
|
-
}
|
|
11
|
-
this.handleReload = undefined;
|
|
12
|
-
this.setInitiallyProvidedValue(j18);
|
|
13
|
-
this.finalizeConstruction();
|
|
14
|
-
}
|
|
15
|
-
setInitiallyProvidedValue(h18) {
|
|
16
|
-
if (h18.handleReload !== undefined) {
|
|
17
|
-
this.handleReload = h18.handleReload;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
updateStateVars(g18) {
|
|
21
|
-
}
|
|
22
|
-
purgeVariableDependenciesOnElmtId(f18) {
|
|
23
|
-
}
|
|
24
|
-
aboutToBeDeleted() {
|
|
25
|
-
SubscriberManager.Get().delete(this.id__());
|
|
26
|
-
this.aboutToBeDeletedInternal();
|
|
27
|
-
}
|
|
28
|
-
initialRender() {
|
|
29
|
-
this.observeComponentCreation2((d18, e18) => {
|
|
30
|
-
Row.create();
|
|
31
|
-
Row.justifyContent(FlexAlign.Center);
|
|
32
|
-
Row.layoutWeight(1);
|
|
33
|
-
}, Row);
|
|
34
|
-
this.observeComponentCreation2((b18, c18) => {
|
|
35
|
-
Column.create();
|
|
36
|
-
}, Column);
|
|
37
|
-
this.observeComponentCreation2((z17, a18) => {
|
|
38
|
-
Image.create({ "id": -1, "type": 20000, params: ["app.media.plv_web_ic_failure"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
39
|
-
Image.width({ "id": -1, "type": 10002, params: ["app.float.plv_web_failure_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
40
|
-
Image.height({ "id": -1, "type": 10002, params: ["app.float.plv_web_failure_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
41
|
-
}, Image);
|
|
42
|
-
this.observeComponentCreation2((x17, y17) => {
|
|
43
|
-
Text.create({ "id": -1, "type": 10003, params: ["app.string.plv_web_load_failed"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
44
|
-
Text.fontColor({ "id": -1, "type": 10001, params: ["app.color.plv_web_reload_title_color"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
45
|
-
Text.fontFamily(PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY);
|
|
46
|
-
Text.fontSize({ "id": -1, "type": 10002, params: ["app.float.plv_web_normal_text_size1"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
47
|
-
Text.margin({ top: { "id": -1, "type": 10002, params: ["app.float.plv_web_sm_padding_margin"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } });
|
|
48
|
-
}, Text);
|
|
49
|
-
Text.pop();
|
|
50
|
-
this.observeComponentCreation2((v17, w17) => {
|
|
51
|
-
Row.create();
|
|
52
|
-
Row.height({ "id": -1, "type": 10002, params: ["app.float.plv_web_reload_btn_height"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
53
|
-
Row.width({ "id": -1, "type": 10002, params: ["app.float.plv_web_reload_btn_width"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
54
|
-
Row.margin({ top: { "id": -1, "type": 10002, params: ["app.float.plv_web_sm_padding_margin"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } });
|
|
55
|
-
Row.borderWidth(1);
|
|
56
|
-
Row.borderColor({ "id": -1, "type": 10001, params: ["app.color.plv_web_main_red_color"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
57
|
-
Row.borderRadius({ "id": -1, "type": 10002, params: ["app.float.plv_web_large_border_radius"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
58
|
-
Row.onClick(() => this.handleReload?.());
|
|
59
|
-
}, Row);
|
|
60
|
-
this.observeComponentCreation2((t17, u17) => {
|
|
61
|
-
Text.create({ "id": -1, "type": 10003, params: ["app.string.plv_web_reload"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
62
|
-
Text.fontColor({ "id": -1, "type": 10001, params: ["app.color.plv_web_main_red_color"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
63
|
-
Text.fontFamily(PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY);
|
|
64
|
-
Text.fontSize({ "id": -1, "type": 10002, params: ["app.float.plv_web_small_text_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
65
|
-
Text.width(PLVCommonConstants.FULL_PERCENT);
|
|
66
|
-
Text.textAlign(TextAlign.Center);
|
|
67
|
-
}, Text);
|
|
68
|
-
Text.pop();
|
|
69
|
-
Row.pop();
|
|
70
|
-
Column.pop();
|
|
71
|
-
Row.pop();
|
|
72
|
-
}
|
|
73
|
-
rerender() {
|
|
74
|
-
this.updateDirtyElements();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
if (!("finalizeConstruction" in ViewPU.prototype)) {
|
|
2
|
-
Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
|
|
3
|
-
}
|
|
4
|
-
import PLVCommonConstants from '../../common/PLVCommonConstants';
|
|
5
|
-
export class PLVLoadingLayout extends ViewPU {
|
|
6
|
-
constructor(x18, y18, z18, a19 = -1, b19 = undefined, c19) {
|
|
7
|
-
super(x18, z18, a19, c19);
|
|
8
|
-
if (typeof b19 === "function") {
|
|
9
|
-
this.paramsGenerator_ = b19;
|
|
10
|
-
}
|
|
11
|
-
this.setInitiallyProvidedValue(y18);
|
|
12
|
-
this.finalizeConstruction();
|
|
13
|
-
}
|
|
14
|
-
setInitiallyProvidedValue(w18) {
|
|
15
|
-
}
|
|
16
|
-
updateStateVars(v18) {
|
|
17
|
-
}
|
|
18
|
-
purgeVariableDependenciesOnElmtId(u18) {
|
|
19
|
-
}
|
|
20
|
-
aboutToBeDeleted() {
|
|
21
|
-
SubscriberManager.Get().delete(this.id__());
|
|
22
|
-
this.aboutToBeDeletedInternal();
|
|
23
|
-
}
|
|
24
|
-
initialRender() {
|
|
25
|
-
this.observeComponentCreation2((s18, t18) => {
|
|
26
|
-
Column.create();
|
|
27
|
-
Column.height(PLVCommonConstants.FULL_PERCENT);
|
|
28
|
-
Column.width(PLVCommonConstants.FULL_PERCENT);
|
|
29
|
-
}, Column);
|
|
30
|
-
this.observeComponentCreation2((q18, r18) => {
|
|
31
|
-
Column.create();
|
|
32
|
-
Column.margin({ top: { "id": -1, "type": 10002, params: ["app.float.plv_web_loading_img_margin"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } });
|
|
33
|
-
Column.width({ "id": -1, "type": 10002, params: ["app.float.plv_web_loading_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
34
|
-
Column.height({ "id": -1, "type": 10002, params: ["app.float.plv_web_loading_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
|
|
35
|
-
}, Column);
|
|
36
|
-
this.observeComponentCreation2((o18, p18) => {
|
|
37
|
-
LoadingProgress.create();
|
|
38
|
-
}, LoadingProgress);
|
|
39
|
-
Column.pop();
|
|
40
|
-
Column.pop();
|
|
41
|
-
}
|
|
42
|
-
rerender() {
|
|
43
|
-
this.updateDirtyElements();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
if (!("finalizeConstruction" in ViewPU.prototype)) {
|
|
2
|
-
Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
|
|
3
|
-
}
|
|
4
|
-
import webview from '@ohos.web.webview';
|
|
5
|
-
import PLVLogger from '../log/PLVLogger';
|
|
6
|
-
const TAG = "[PLVNewWindowLayout]";
|
|
7
|
-
export class PLVNewWindowLayout extends ViewPU {
|
|
8
|
-
constructor(l19, m19, n19, o19 = -1, p19 = undefined, q19) {
|
|
9
|
-
super(l19, n19, o19, q19);
|
|
10
|
-
if (typeof p19 === "function") {
|
|
11
|
-
this.paramsGenerator_ = p19;
|
|
12
|
-
}
|
|
13
|
-
this.controller = undefined;
|
|
14
|
-
this.webviewController = new webview.WebviewController();
|
|
15
|
-
this.setInitiallyProvidedValue(m19);
|
|
16
|
-
this.finalizeConstruction();
|
|
17
|
-
}
|
|
18
|
-
setInitiallyProvidedValue(k19) {
|
|
19
|
-
if (k19.controller !== undefined) {
|
|
20
|
-
this.controller = k19.controller;
|
|
21
|
-
}
|
|
22
|
-
if (k19.webviewController !== undefined) {
|
|
23
|
-
this.webviewController = k19.webviewController;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
updateStateVars(j19) {
|
|
27
|
-
}
|
|
28
|
-
purgeVariableDependenciesOnElmtId(i19) {
|
|
29
|
-
}
|
|
30
|
-
aboutToBeDeleted() {
|
|
31
|
-
SubscriberManager.Get().delete(this.id__());
|
|
32
|
-
this.aboutToBeDeletedInternal();
|
|
33
|
-
}
|
|
34
|
-
setController(h19) {
|
|
35
|
-
this.controller = h19;
|
|
36
|
-
}
|
|
37
|
-
aboutToAppear() {
|
|
38
|
-
}
|
|
39
|
-
initialRender() {
|
|
40
|
-
this.observeComponentCreation2((f19, g19) => {
|
|
41
|
-
Column.create();
|
|
42
|
-
}, Column);
|
|
43
|
-
this.observeComponentCreation2((d19, e19) => {
|
|
44
|
-
Web.create({ src: "", controller: this.webviewController });
|
|
45
|
-
Web.javaScriptAccess(true);
|
|
46
|
-
Web.zoomAccess(true);
|
|
47
|
-
Web.domStorageAccess(true);
|
|
48
|
-
Web.multiWindowAccess(false);
|
|
49
|
-
Web.onWindowExit(() => {
|
|
50
|
-
PLVLogger.info(TAG, "onWindowExit");
|
|
51
|
-
if (this.controller) {
|
|
52
|
-
this.controller.close();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}, Web);
|
|
56
|
-
Column.pop();
|
|
57
|
-
}
|
|
58
|
-
rerender() {
|
|
59
|
-
this.updateDirtyElements();
|
|
60
|
-
}
|
|
61
|
-
}
|