@polyvharmony/live-scenes-foundation 1.2.0-rc.1

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/Index.d.ets +30 -0
  3. package/Index.js +28 -0
  4. package/LICENSE +8 -0
  5. package/README.md +21 -0
  6. package/ResourceTable.txt +16 -0
  7. package/libs/plvjsbridge.har +0 -0
  8. package/libs/plvsocket.har +0 -0
  9. package/obfuscation.txt +4 -0
  10. package/oh-package.json5 +1 -0
  11. package/package.json +1 -0
  12. package/src/main/ets/common/IPLVBackwardInterface.d.ets +5 -0
  13. package/src/main/ets/common/IPLVBackwardInterface.js +1 -0
  14. package/src/main/ets/common/PLVBasicDataSource.d.ets +30 -0
  15. package/src/main/ets/common/PLVBasicDataSource.js +172 -0
  16. package/src/main/ets/common/PLVCallback.d.ets +52 -0
  17. package/src/main/ets/common/PLVCallback.js +128 -0
  18. package/src/main/ets/common/PLVCommonConstants.d.ets +13 -0
  19. package/src/main/ets/common/PLVCommonConstants.js +10 -0
  20. package/src/main/ets/common/PLVCommonEnums.d.ets +19 -0
  21. package/src/main/ets/common/PLVCommonEnums.js +22 -0
  22. package/src/main/ets/common/PLVDeviceUtils.d.ets +4 -0
  23. package/src/main/ets/common/PLVDeviceUtils.js +9 -0
  24. package/src/main/ets/common/PLVHashMap.d.ets +4 -0
  25. package/src/main/ets/common/PLVHashMap.js +7 -0
  26. package/src/main/ets/common/PLVJSONUtils.d.ets +21 -0
  27. package/src/main/ets/common/PLVJSONUtils.js +103 -0
  28. package/src/main/ets/common/PLVNetUtils.d.ets +5 -0
  29. package/src/main/ets/common/PLVNetUtils.js +29 -0
  30. package/src/main/ets/common/PLVPreferencesUtils.d.ets +58 -0
  31. package/src/main/ets/common/PLVPreferencesUtils.js +30 -0
  32. package/src/main/ets/common/PLVScheduledTask.d.ets +12 -0
  33. package/src/main/ets/common/PLVScheduledTask.js +44 -0
  34. package/src/main/ets/common/PLVSimpleBuffer.d.ets +11 -0
  35. package/src/main/ets/common/PLVSimpleBuffer.js +30 -0
  36. package/src/main/ets/common/PLVTextUtils.d.ets +9 -0
  37. package/src/main/ets/common/PLVTextUtils.js +73 -0
  38. package/src/main/ets/common/PLVTimeUtils.d.ets +8 -0
  39. package/src/main/ets/common/PLVTimeUtils.js +14 -0
  40. package/src/main/ets/common/PLVToastUtils.d.ets +7 -0
  41. package/src/main/ets/common/PLVToastUtils.js +17 -0
  42. package/src/main/ets/common/PLVType.d.ets +8 -0
  43. package/src/main/ets/common/PLVType.js +1 -0
  44. package/src/main/ets/common/PLVUACreator.d.ets +3 -0
  45. package/src/main/ets/common/PLVUACreator.js +11 -0
  46. package/src/main/ets/common/PLVUtils.d.ets +25 -0
  47. package/src/main/ets/common/PLVUtils.js +197 -0
  48. package/src/main/ets/common/PLVWebUtils.d.ets +6 -0
  49. package/src/main/ets/common/PLVWebUtils.js +79 -0
  50. package/src/main/ets/modules/log/PLVLogger.d.ets +20 -0
  51. package/src/main/ets/modules/log/PLVLogger.js +67 -0
  52. package/src/main/ets/modules/log/PLVXLogFilePrinter.d.ets +12 -0
  53. package/src/main/ets/modules/log/PLVXLogFilePrinter.js +37 -0
  54. package/src/main/ets/modules/log/PLVXLogWorker.d.ets +1 -0
  55. package/src/main/ets/modules/log/PLVXLogWorker.js +4 -0
  56. package/src/main/ets/modules/net/PLVApiConstants.d.ets +7 -0
  57. package/src/main/ets/modules/net/PLVApiConstants.js +7 -0
  58. package/src/main/ets/modules/net/PLVHttpData.d.ets +8 -0
  59. package/src/main/ets/modules/net/PLVHttpData.js +8 -0
  60. package/src/main/ets/modules/net/PLVHttpError.d.ets +5 -0
  61. package/src/main/ets/modules/net/PLVHttpError.js +13 -0
  62. package/src/main/ets/modules/net/PLVHttpRequest.d.ets +25 -0
  63. package/src/main/ets/modules/net/PLVHttpRequest.js +147 -0
  64. package/src/main/ets/modules/net/PLVRequestSetting.d.ets +9 -0
  65. package/src/main/ets/modules/net/PLVRequestSetting.js +33 -0
  66. package/src/main/ets/modules/socket/PLVSocketIO.d.ets +50 -0
  67. package/src/main/ets/modules/socket/PLVSocketIO.js +164 -0
  68. package/src/main/ets/modules/web/PLVFailureLayout.d.ets +5 -0
  69. package/src/main/ets/modules/web/PLVFailureLayout.js +77 -0
  70. package/src/main/ets/modules/web/PLVLoadingLayout.d.ets +4 -0
  71. package/src/main/ets/modules/web/PLVLoadingLayout.js +46 -0
  72. package/src/main/ets/modules/web/PLVNewWindowLayout.d.ets +8 -0
  73. package/src/main/ets/modules/web/PLVNewWindowLayout.js +62 -0
  74. package/src/main/ets/modules/web/PLVSimpleWeb.d.ets +14 -0
  75. package/src/main/ets/modules/web/PLVSimpleWeb.js +260 -0
  76. package/src/main/ets/modules/web/PLVWebController.d.ets +86 -0
  77. package/src/main/ets/modules/web/PLVWebController.js +275 -0
  78. package/src/main/ets/modules/web/PLVWebModel.d.ets +30 -0
  79. package/src/main/ets/modules/web/PLVWebModel.js +1 -0
  80. package/src/main/module.json +28 -0
  81. package/src/main/resources/base/element/color.json +12 -0
  82. package/src/main/resources/base/element/float.json +40 -0
  83. package/src/main/resources/base/element/string.json +12 -0
  84. package/src/main/resources/base/media/plv_web_ic_failure.svg +30 -0
  85. package/src/main/resources/en_US/element/string.json +12 -0
  86. package/src/main/resources/zh_CN/element/string.json +12 -0
@@ -0,0 +1,33 @@
1
+ import buffer from "@ohos.buffer";
2
+ import { CryptoJS } from '@ohos/crypto-js';
3
+ export class PLVRequestSetting {
4
+ static createSign(map, key) {
5
+ const a8 = key + PLVRequestSetting.concatParams(map) + key;
6
+ const b8 = CryptoJS.MD5(a8).toString().toUpperCase();
7
+ return b8;
8
+ }
9
+ static decryptDataSync(data) {
10
+ const z7 = CryptoJS.AES.decrypt(buffer.from(data, '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 z7;
17
+ }
18
+ static concatParams(map) {
19
+ const y7 = Array.from(map.keys()).sort();
20
+ const builder = [];
21
+ for (const key of y7) {
22
+ if (!key || !map.get(key)) {
23
+ continue;
24
+ }
25
+ builder.push(key + map.get(key));
26
+ }
27
+ return builder.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';
@@ -0,0 +1,50 @@
1
+ import { PLVCallback } from '../../common/PLVCallback';
2
+ export declare class PLVSocketIO {
3
+ private client;
4
+ protected socketIOStatus: PLVSocketIOStatus;
5
+ protected onSocketIOStatusListener?: PLVCallback<PLVSocketIOStatus, void>;
6
+ private set_open_listener;
7
+ protected set_fail_listener(f9: () => void): void;
8
+ protected set_reconnecting_listener(e9: () => void): void;
9
+ private set_reconnect_listener;
10
+ protected set_close_listener(c9: (reason: string) => void): void;
11
+ protected set_socket_open_listener(b9: (nsp: string) => void): void;
12
+ protected set_socket_close_listener(a9: (nsp: string) => void): void;
13
+ protected connect(uri: string): void;
14
+ protected connectWithQuery(uri: string, query: string, v8: string): void;
15
+ connected(): boolean;
16
+ disconnect(u8?: boolean): void;
17
+ destroy(t8?: boolean): void;
18
+ protected clear_con_listeners(): void;
19
+ protected clear_socket_listeners(): void;
20
+ protected set_reconnect_attempts(s8: number): void;
21
+ protected set_reconnect_delay(r8: number): void;
22
+ protected set_reconnect_delay_max(q8: number): void;
23
+ protected set_logs_default(): void;
24
+ protected set_logs_quiet(): void;
25
+ protected set_logs_verbose(): void;
26
+ private close;
27
+ private sync_close;
28
+ protected set_proxy_basic_auth(uri: string, username: string, password: string): void;
29
+ private opened;
30
+ protected get_sessionid(): string;
31
+ protected set_nsp(p8: string): void;
32
+ protected on(m8: string, n8: (event_json: string) => void): void;
33
+ protected once(k8: string, l8: (event_json: string) => void): void;
34
+ protected off(j8: string): void;
35
+ protected off_all(): void;
36
+ private socket_close;
37
+ protected on_error(i8: (message: string) => void): void;
38
+ protected off_error(): void;
39
+ protected emitSkipCheck(name: string, message: ESObject, g8?: (emit_callback_json: string) => void): void;
40
+ emit(name: string, message: ESObject, e8?: (emit_callback_json: string) => void): boolean;
41
+ private replaceJson;
42
+ }
43
+ export declare enum PLVSocketIOStatus {
44
+ IDLE = 0,
45
+ CONNECT = 1,
46
+ OPEN = 2,
47
+ RECONNECT = 3,
48
+ RECONNECT_SUCCESS = 4,
49
+ SOCKET_CLOSE = 5
50
+ }
@@ -0,0 +1,164 @@
1
+ import { client_socket } from 'socket';
2
+ import PLVLogger from '../log/PLVLogger';
3
+ const TAG = '[PLVSocketIO]';
4
+ export class PLVSocketIO {
5
+ constructor() {
6
+ this.client = new client_socket();
7
+ this.socketIOStatus = PLVSocketIOStatus.IDLE;
8
+ }
9
+ set_open_listener(g9) {
10
+ this.client.set_open_listener(g9);
11
+ }
12
+ set_fail_listener(f9) {
13
+ this.client.set_fail_listener(f9);
14
+ }
15
+ set_reconnecting_listener(e9) {
16
+ this.client.set_reconnecting_listener(e9);
17
+ }
18
+ set_reconnect_listener(d9) {
19
+ this.client.set_reconnect_listener(d9);
20
+ }
21
+ set_close_listener(c9) {
22
+ this.client.set_close_listener(c9);
23
+ }
24
+ set_socket_open_listener(b9) {
25
+ this.client.set_socket_open_listener(b9);
26
+ }
27
+ set_socket_close_listener(a9) {
28
+ this.client.set_socket_close_listener(a9);
29
+ }
30
+ connect(uri) {
31
+ this.connectWithQuery(uri, '', '');
32
+ }
33
+ connectWithQuery(uri, query, v8) {
34
+ if (this.socketIOStatus == PLVSocketIOStatus.IDLE || this.socketIOStatus == PLVSocketIOStatus.SOCKET_CLOSE) {
35
+ this.socketIOStatus = PLVSocketIOStatus.CONNECT;
36
+ this.onSocketIOStatusListener?.(this.socketIOStatus);
37
+ }
38
+ this.set_open_listener(() => {
39
+ PLVLogger.info(TAG, 'call socket open');
40
+ this.socketIOStatus = this.socketIOStatus == PLVSocketIOStatus.RECONNECT ? PLVSocketIOStatus.RECONNECT_SUCCESS : PLVSocketIOStatus.OPEN;
41
+ this.onSocketIOStatusListener?.(this.socketIOStatus);
42
+ });
43
+ this.set_reconnect_listener(() => {
44
+ PLVLogger.info(TAG, 'call socket reconnect');
45
+ this.socketIOStatus = PLVSocketIOStatus.RECONNECT;
46
+ this.onSocketIOStatusListener?.(this.socketIOStatus);
47
+ });
48
+ this.set_socket_close_listener(() => {
49
+ PLVLogger.info(TAG, 'call socket close');
50
+ this.socketIOStatus = PLVSocketIOStatus.SOCKET_CLOSE;
51
+ this.onSocketIOStatusListener?.(this.socketIOStatus);
52
+ });
53
+ this.set_close_listener(() => {
54
+ PLVLogger.info(TAG, 'call close');
55
+ });
56
+ this.client.connectWithQuery(uri, query, v8);
57
+ }
58
+ connected() {
59
+ return this.opened() && this.socketIOStatus != PLVSocketIOStatus.SOCKET_CLOSE;
60
+ }
61
+ disconnect(u8) {
62
+ if (this.socketIOStatus != PLVSocketIOStatus.SOCKET_CLOSE && !u8) {
63
+ this.socket_close();
64
+ }
65
+ this.close();
66
+ }
67
+ destroy(t8) {
68
+ this.disconnect(t8);
69
+ this.clear_con_listeners();
70
+ this.clear_socket_listeners();
71
+ }
72
+ clear_con_listeners() {
73
+ this.client.clear_con_listeners();
74
+ }
75
+ clear_socket_listeners() {
76
+ this.client.clear_socket_listeners();
77
+ }
78
+ set_reconnect_attempts(s8) {
79
+ this.client.set_reconnect_attempts(s8);
80
+ }
81
+ set_reconnect_delay(r8) {
82
+ this.client.set_reconnect_delay(r8);
83
+ }
84
+ set_reconnect_delay_max(q8) {
85
+ this.client.set_reconnect_delay_max(q8);
86
+ }
87
+ set_logs_default() {
88
+ this.client.set_logs_default();
89
+ }
90
+ set_logs_quiet() {
91
+ this.client.set_logs_quiet();
92
+ }
93
+ set_logs_verbose() {
94
+ this.client.set_logs_verbose();
95
+ }
96
+ close() {
97
+ this.client.close();
98
+ }
99
+ sync_close() {
100
+ this.client.sync_close();
101
+ }
102
+ set_proxy_basic_auth(uri, username, password) {
103
+ this.client.set_proxy_basic_auth(uri, username, password);
104
+ }
105
+ opened() {
106
+ return this.client.opened();
107
+ }
108
+ get_sessionid() {
109
+ return this.client.get_sessionid();
110
+ }
111
+ set_nsp(p8) {
112
+ this.client.set_nsp(p8);
113
+ }
114
+ on(m8, n8) {
115
+ this.client.on(m8, (json) => {
116
+ n8(this.replaceJson(json));
117
+ });
118
+ }
119
+ once(k8, l8) {
120
+ this.client.once(k8, l8);
121
+ }
122
+ off(j8) {
123
+ this.client.off(j8);
124
+ }
125
+ off_all() {
126
+ this.client.off_all();
127
+ }
128
+ socket_close() {
129
+ this.client.socket_close();
130
+ }
131
+ on_error(i8) {
132
+ this.client.on_error(i8);
133
+ }
134
+ off_error() {
135
+ this.client.off_error();
136
+ }
137
+ emitSkipCheck(name, message, g8) {
138
+ this.client.emit(name, message, (json) => {
139
+ g8?.(this.replaceJson(json));
140
+ });
141
+ }
142
+ emit(name, message, e8) {
143
+ PLVLogger.info(TAG, `emit: ${message}, name: ${name}, connected: ${this.connected()}`);
144
+ if (this.connected()) {
145
+ this.client.emit(name, message, (json) => {
146
+ e8?.(this.replaceJson(json));
147
+ });
148
+ return true;
149
+ }
150
+ return false;
151
+ }
152
+ replaceJson(json) {
153
+ return json.replace(/"{/g, '{').replace(/}"/g, '}');
154
+ }
155
+ }
156
+ export var PLVSocketIOStatus;
157
+ (function (d8) {
158
+ d8[d8["IDLE"] = 0] = "IDLE";
159
+ d8[d8["CONNECT"] = 1] = "CONNECT";
160
+ d8[d8["OPEN"] = 2] = "OPEN";
161
+ d8[d8["RECONNECT"] = 3] = "RECONNECT";
162
+ d8[d8["RECONNECT_SUCCESS"] = 4] = "RECONNECT_SUCCESS";
163
+ d8[d8["SOCKET_CLOSE"] = 5] = "SOCKET_CLOSE";
164
+ })(PLVSocketIOStatus || (PLVSocketIOStatus = {}));
@@ -0,0 +1,5 @@
1
+ @Component
2
+ export declare struct PLVFailureLayout {
3
+ handleReload?: () => void;
4
+ build(): void;
5
+ }
@@ -0,0 +1,77 @@
1
+ if (!("finalizeConstruction" in ViewPU.prototype)) {
2
+ Reflect.set(ViewPU.prototype, "finalizeConstruction", () => {
3
+ });
4
+ }
5
+ import PLVCommonConstants from '../../common/PLVCommonConstants';
6
+ export class PLVFailureLayout extends ViewPU {
7
+ constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
8
+ super(parent, __localStorage, elmtId, extraInfo);
9
+ if (typeof paramsLambda === "function") {
10
+ this.paramsGenerator_ = paramsLambda;
11
+ }
12
+ this.handleReload = undefined;
13
+ this.setInitiallyProvidedValue(params);
14
+ this.finalizeConstruction();
15
+ }
16
+ setInitiallyProvidedValue(params) {
17
+ if (params.handleReload !== undefined) {
18
+ this.handleReload = params.handleReload;
19
+ }
20
+ }
21
+ updateStateVars(params) {
22
+ }
23
+ purgeVariableDependenciesOnElmtId(rmElmtId) {
24
+ }
25
+ aboutToBeDeleted() {
26
+ SubscriberManager.Get().delete(this.id__());
27
+ this.aboutToBeDeletedInternal();
28
+ }
29
+ initialRender() {
30
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
31
+ Row.create();
32
+ Row.justifyContent(FlexAlign.Center);
33
+ Row.layoutWeight(1);
34
+ }, Row);
35
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
36
+ Column.create();
37
+ }, Column);
38
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
39
+ Image.create({ "id": -1, "type": 20000, params: ["app.media.plv_web_ic_failure"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
40
+ Image.width({ "id": -1, "type": 10002, params: ["app.float.plv_web_failure_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
41
+ Image.height({ "id": -1, "type": 10002, params: ["app.float.plv_web_failure_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
42
+ }, Image);
43
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
44
+ Text.create({ "id": -1, "type": 10003, params: ["app.string.plv_web_load_failed"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
45
+ Text.fontColor({ "id": -1, "type": 10001, params: ["app.color.plv_web_reload_title_color"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
46
+ Text.fontFamily(PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY);
47
+ Text.fontSize({ "id": -1, "type": 10002, params: ["app.float.plv_web_normal_text_size1"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
48
+ Text.margin({ top: { "id": -1, "type": 10002, params: ["app.float.plv_web_sm_padding_margin"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } });
49
+ }, Text);
50
+ Text.pop();
51
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
52
+ Row.create();
53
+ Row.height({ "id": -1, "type": 10002, params: ["app.float.plv_web_reload_btn_height"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
54
+ Row.width({ "id": -1, "type": 10002, params: ["app.float.plv_web_reload_btn_width"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
55
+ Row.margin({ top: { "id": -1, "type": 10002, params: ["app.float.plv_web_sm_padding_margin"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } });
56
+ Row.borderWidth(1);
57
+ Row.borderColor({ "id": -1, "type": 10001, params: ["app.color.plv_web_main_red_color"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
58
+ Row.borderRadius({ "id": -1, "type": 10002, params: ["app.float.plv_web_large_border_radius"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
59
+ Row.onClick(() => this.handleReload?.());
60
+ }, Row);
61
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
62
+ Text.create({ "id": -1, "type": 10003, params: ["app.string.plv_web_reload"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
63
+ Text.fontColor({ "id": -1, "type": 10001, params: ["app.color.plv_web_main_red_color"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
64
+ Text.fontFamily(PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY);
65
+ Text.fontSize({ "id": -1, "type": 10002, params: ["app.float.plv_web_small_text_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
66
+ Text.width(PLVCommonConstants.FULL_PERCENT);
67
+ Text.textAlign(TextAlign.Center);
68
+ }, Text);
69
+ Text.pop();
70
+ Row.pop();
71
+ Column.pop();
72
+ Row.pop();
73
+ }
74
+ rerender() {
75
+ this.updateDirtyElements();
76
+ }
77
+ }
@@ -0,0 +1,4 @@
1
+ @Component
2
+ export declare struct PLVLoadingLayout {
3
+ build(): void;
4
+ }
@@ -0,0 +1,46 @@
1
+ if (!("finalizeConstruction" in ViewPU.prototype)) {
2
+ Reflect.set(ViewPU.prototype, "finalizeConstruction", () => {
3
+ });
4
+ }
5
+ import PLVCommonConstants from '../../common/PLVCommonConstants';
6
+ export class PLVLoadingLayout extends ViewPU {
7
+ constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
8
+ super(parent, __localStorage, elmtId, extraInfo);
9
+ if (typeof paramsLambda === "function") {
10
+ this.paramsGenerator_ = paramsLambda;
11
+ }
12
+ this.setInitiallyProvidedValue(params);
13
+ this.finalizeConstruction();
14
+ }
15
+ setInitiallyProvidedValue(params) {
16
+ }
17
+ updateStateVars(params) {
18
+ }
19
+ purgeVariableDependenciesOnElmtId(rmElmtId) {
20
+ }
21
+ aboutToBeDeleted() {
22
+ SubscriberManager.Get().delete(this.id__());
23
+ this.aboutToBeDeletedInternal();
24
+ }
25
+ initialRender() {
26
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
27
+ Column.create();
28
+ Column.height(PLVCommonConstants.FULL_PERCENT);
29
+ Column.width(PLVCommonConstants.FULL_PERCENT);
30
+ }, Column);
31
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
32
+ Column.create();
33
+ Column.margin({ top: { "id": -1, "type": 10002, params: ["app.float.plv_web_loading_img_margin"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" } });
34
+ Column.width({ "id": -1, "type": 10002, params: ["app.float.plv_web_loading_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
35
+ Column.height({ "id": -1, "type": 10002, params: ["app.float.plv_web_loading_img_size"], "bundleName": "__harDefaultBundleName__", "moduleName": "__harDefaultModuleName__" });
36
+ }, Column);
37
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
38
+ LoadingProgress.create();
39
+ }, LoadingProgress);
40
+ Column.pop();
41
+ Column.pop();
42
+ }
43
+ rerender() {
44
+ this.updateDirtyElements();
45
+ }
46
+ }
@@ -0,0 +1,8 @@
1
+ import webview from '@ohos.web.webview';
2
+ @CustomDialog
3
+ export declare struct PLVNewWindowLayout {
4
+ controller?: CustomDialogController;
5
+ webviewController: webview.WebviewController;
6
+ aboutToAppear(): void;
7
+ build(): void;
8
+ }
@@ -0,0 +1,62 @@
1
+ if (!("finalizeConstruction" in ViewPU.prototype)) {
2
+ Reflect.set(ViewPU.prototype, "finalizeConstruction", () => {
3
+ });
4
+ }
5
+ import webview from '@ohos.web.webview';
6
+ import PLVLogger from '../log/PLVLogger';
7
+ const TAG = "[PLVNewWindowLayout]";
8
+ export class PLVNewWindowLayout extends ViewPU {
9
+ constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
10
+ super(parent, __localStorage, elmtId, extraInfo);
11
+ if (typeof paramsLambda === "function") {
12
+ this.paramsGenerator_ = paramsLambda;
13
+ }
14
+ this.controller = undefined;
15
+ this.webviewController = new webview.WebviewController();
16
+ this.setInitiallyProvidedValue(params);
17
+ this.finalizeConstruction();
18
+ }
19
+ setInitiallyProvidedValue(params) {
20
+ if (params.controller !== undefined) {
21
+ this.controller = params.controller;
22
+ }
23
+ if (params.webviewController !== undefined) {
24
+ this.webviewController = params.webviewController;
25
+ }
26
+ }
27
+ updateStateVars(params) {
28
+ }
29
+ purgeVariableDependenciesOnElmtId(rmElmtId) {
30
+ }
31
+ aboutToBeDeleted() {
32
+ SubscriberManager.Get().delete(this.id__());
33
+ this.aboutToBeDeletedInternal();
34
+ }
35
+ setController(ctr) {
36
+ this.controller = ctr;
37
+ }
38
+ aboutToAppear() {
39
+ }
40
+ initialRender() {
41
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
42
+ Column.create();
43
+ }, Column);
44
+ this.observeComponentCreation2((elmtId, isInitialRender) => {
45
+ Web.create({ src: "", controller: this.webviewController });
46
+ Web.javaScriptAccess(true);
47
+ Web.zoomAccess(true);
48
+ Web.domStorageAccess(true);
49
+ Web.multiWindowAccess(false);
50
+ Web.onWindowExit(() => {
51
+ PLVLogger.info(TAG, "onWindowExit");
52
+ if (this.controller) {
53
+ this.controller.close();
54
+ }
55
+ });
56
+ }, Web);
57
+ Column.pop();
58
+ }
59
+ rerender() {
60
+ this.updateDirtyElements();
61
+ }
62
+ }
@@ -0,0 +1,14 @@
1
+ import { PLVWebpageStatus } from '../../common/PLVCommonEnums';
2
+ import { PLVWebController } from './PLVWebController';
3
+ export declare const TAG = "[PLVSimpleWeb]";
4
+ @Component
5
+ export declare struct PLVSimpleWeb {
6
+ @State
7
+ webStatus: PLVWebpageStatus;
8
+ controller: PLVWebController;
9
+ src?: string | Resource;
10
+ incognitoMode?: boolean;
11
+ showLoading?: boolean;
12
+ aboutToAppear(): void;
13
+ build(): void;
14
+ }