@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
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ ## [v1.2.0-rc.1] - 2025-02-10
2
+
3
+ 新增:
4
+
5
+ 1. 支持纯视频开播(当前仅部分频道支持)
6
+
7
+ ## [v1.1.0] - 2024-10-28
8
+
9
+ ### 【观看端场景】
10
+
11
+ 新增:
12
+
13
+ 1. 【连麦】支持连麦功能(当前仅部分频道支持)
14
+
15
+ 优化:
16
+
17
+ 1. 【播放器】视频播放失败时增加相应提示
18
+
19
+ ## [v1.0.0] - 2024-10-17
20
+
21
+ 发布 1.0.0 版本
package/Index.d.ets ADDED
@@ -0,0 +1,30 @@
1
+ export { IPLVBackwardInterface } from './src/main/ets/common/IPLVBackwardInterface';
2
+ export { default as PLVLazyDataSource } from './src/main/ets/common/PLVBasicDataSource';
3
+ export { PLVCallback, PLVCallback2, PLVStateData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, IPLVEventEmitter, IPLVEventNotify, PLVEventNotify } from './src/main/ets/common/PLVCallback';
4
+ export { default as PLVCommonConstants } from './src/main/ets/common/PLVCommonConstants';
5
+ export { PLVDeviceUtils } from './src/main/ets/common/PLVDeviceUtils';
6
+ export { PLVHashMap } from './src/main/ets/common/PLVHashMap';
7
+ export { PLVWebpageStatus, PLVFullScreenStatus, PLVPrintLogLevel } from './src/main/ets/common/PLVCommonEnums';
8
+ export { default as PLVJSONUtils } from './src/main/ets/common/PLVJSONUtils';
9
+ export { PLVPreferencesUtils } from './src/main/ets/common/PLVPreferencesUtils';
10
+ export { PLVScheduledTask } from './src/main/ets/common/PLVScheduledTask';
11
+ export { PLVSimpleBuffer } from './src/main/ets/common/PLVSimpleBuffer';
12
+ export { PLVTextUtils } from './src/main/ets/common/PLVTextUtils';
13
+ export { PLVUACreator } from './src/main/ets/common/PLVUACreator';
14
+ export { default as PLVToastUtils } from './src/main/ets/common/PLVToastUtils';
15
+ export { PLVResponseObject, PLVResponseData, PLVResponse, PLVJSONObject, PLVResolve, PLVReject } from './src/main/ets/common/PLVType';
16
+ export { default as PLVUtils } from './src/main/ets/common/PLVUtils';
17
+ export { PLVWebUtils } from './src/main/ets/common/PLVWebUtils';
18
+ export { PLVTimeUtils } from './src/main/ets/common/PLVTimeUtils';
19
+ export { default as PLVLogger } from './src/main/ets/modules/log/PLVLogger';
20
+ export { PLVHttpRequest, PLVAxiosRequestConfig } from './src/main/ets/modules/net/PLVHttpRequest';
21
+ export { PLVApiConstants } from './src/main/ets/modules/net/PLVApiConstants';
22
+ export { PLVRequestSetting } from './src/main/ets/modules/net/PLVRequestSetting';
23
+ export { PLVHttpError } from './src/main/ets/modules/net/PLVHttpError';
24
+ export { PLVHttpData } from './src/main/ets/modules/net/PLVHttpData';
25
+ export { PLVNetUtils } from './src/main/ets/common/PLVNetUtils';
26
+ export { PLVSocketIO, PLVSocketIOStatus } from './src/main/ets/modules/socket/PLVSocketIO';
27
+ export { PLVNewWindowLayout } from './src/main/ets/modules/web/PLVNewWindowLayout';
28
+ export { PLVWebController } from './src/main/ets/modules/web/PLVWebController';
29
+ export { PLVSimpleWeb } from './src/main/ets/modules/web/PLVSimpleWeb';
30
+ export { FormData } from '@ohos/axios';
package/Index.js ADDED
@@ -0,0 +1,28 @@
1
+ export { default as PLVLazyDataSource } from './src/main/ets/common/PLVBasicDataSource';
2
+ export { PLVStateData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, PLVEventNotify } from './src/main/ets/common/PLVCallback';
3
+ export { default as PLVCommonConstants } from './src/main/ets/common/PLVCommonConstants';
4
+ export { PLVDeviceUtils } from './src/main/ets/common/PLVDeviceUtils';
5
+ export { PLVHashMap } from './src/main/ets/common/PLVHashMap';
6
+ export { PLVWebpageStatus, PLVFullScreenStatus, PLVPrintLogLevel } from './src/main/ets/common/PLVCommonEnums';
7
+ export { default as PLVJSONUtils } from './src/main/ets/common/PLVJSONUtils';
8
+ export { PLVPreferencesUtils } from './src/main/ets/common/PLVPreferencesUtils';
9
+ export { PLVScheduledTask } from './src/main/ets/common/PLVScheduledTask';
10
+ export { PLVSimpleBuffer } from './src/main/ets/common/PLVSimpleBuffer';
11
+ export { PLVTextUtils } from './src/main/ets/common/PLVTextUtils';
12
+ export { PLVUACreator } from './src/main/ets/common/PLVUACreator';
13
+ export { default as PLVToastUtils } from './src/main/ets/common/PLVToastUtils';
14
+ export { default as PLVUtils } from './src/main/ets/common/PLVUtils';
15
+ export { PLVWebUtils } from './src/main/ets/common/PLVWebUtils';
16
+ export { PLVTimeUtils } from './src/main/ets/common/PLVTimeUtils';
17
+ export { default as PLVLogger } from './src/main/ets/modules/log/PLVLogger';
18
+ export { PLVHttpRequest } from './src/main/ets/modules/net/PLVHttpRequest';
19
+ export { PLVApiConstants } from './src/main/ets/modules/net/PLVApiConstants';
20
+ export { PLVRequestSetting } from './src/main/ets/modules/net/PLVRequestSetting';
21
+ export { PLVHttpError } from './src/main/ets/modules/net/PLVHttpError';
22
+ export { PLVHttpData } from './src/main/ets/modules/net/PLVHttpData';
23
+ export { PLVNetUtils } from './src/main/ets/common/PLVNetUtils';
24
+ export { PLVSocketIO, PLVSocketIOStatus } from './src/main/ets/modules/socket/PLVSocketIO';
25
+ export { PLVNewWindowLayout } from './src/main/ets/modules/web/PLVNewWindowLayout';
26
+ export { PLVWebController } from './src/main/ets/modules/web/PLVWebController';
27
+ export { PLVSimpleWeb } from './src/main/ets/modules/web/PLVSimpleWeb';
28
+ export { FormData } from '@ohos/axios';
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) 2024, contributors of the POLYV project
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ POLYV 鸿蒙多场景项目
2
+ ===
3
+
4
+ ### 1 简介
5
+ 此项目是保利威鸿蒙多场景 SDK
6
+
7
+ 完整的项目介绍见 [Github 仓库](https://github.com/polyv/polyv-harmony-livescenes-sdk-demo)
8
+
9
+ ### 2 下载安装
10
+
11
+ ```shell
12
+ ohpm install @polyvharmony/live-scenes-foundation
13
+ ```
14
+
15
+ ### 3 使用说明
16
+
17
+ 多场景 SDK 需在模块 Ability 的 onWindowStageCreate 方法中进行初始化,您可以参考 demo 项目中的`PLVEntryAbility`类:
18
+
19
+ ```ts
20
+ PLVLiveSceneSDK.init(context, windowStage)
21
+ ```
@@ -0,0 +1,16 @@
1
+ string lib_name 0x0200000f
2
+ string page_show 0x0200000e
3
+ string plv_web_load_failed 0x02000000
4
+ string plv_web_reload 0x02000001
5
+ color plv_web_main_red_color 0x02000002
6
+ color plv_web_reload_title_color 0x02000003
7
+ float plv_web_failure_img_size 0x02000004
8
+ float plv_web_large_border_radius 0x02000005
9
+ float plv_web_loading_img_margin 0x02000006
10
+ float plv_web_loading_img_size 0x02000007
11
+ float plv_web_normal_text_size1 0x02000008
12
+ float plv_web_reload_btn_height 0x02000009
13
+ float plv_web_reload_btn_width 0x0200000a
14
+ float plv_web_sm_padding_margin 0x0200000b
15
+ float plv_web_small_text_size 0x0200000c
16
+ media plv_web_ic_failure 0x0200000d
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ -enable-property-obfuscation
2
+ -enable-string-property-obfuscation
3
+ -enable-toplevel-obfuscation
4
+ -remove-log
@@ -0,0 +1 @@
1
+ {"name":"@polyvharmony/live-scenes-foundation","version":"1.2.0-rc.1","description":"polyv live-scenes-foundation","main":"Index.js","author":"POLYV","license":"MIT","dependencies":{"socket":"file:./libs/plvsocket.har","jsbridge":"file:./libs/plvjsbridge.har","@ohos/axios":"2.2.4","class-transformer":"0.5.1","@pura/harmony-utils":"1.1.0","@ohos/crypto-js":"2.0.4","@ohos-port/xlog":"1.2.0"},"types":"Index.d.ets","artifactType":"obfuscation","metadata":{"workers":["./src/main/ets/modules/log/PLVXLogWorker.js"],"sourceRoots":["./src/main"],"debug":false,"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":true}
package/package.json ADDED
@@ -0,0 +1 @@
1
+ {"name":"@polyvharmony/live-scenes-foundation","version":"1.2.0-rc.1","description":"polyv live-scenes-foundation","main":"Index.js","author":"POLYV","license":"MIT","dependencies":{"socket":"file:./libs/plvsocket.har","jsbridge":"file:./libs/plvjsbridge.har","@ohos/axios":"2.2.4","class-transformer":"0.5.1","@pura/harmony-utils":"1.1.0","@ohos/crypto-js":"2.0.4","@ohos-port/xlog":"1.2.0"},"types":"Index.d.ets","artifactType":"obfuscation","metadata":{"workers":["./src/main/ets/modules/log/PLVXLogWorker.js"],"sourceRoots":["./src/main"],"debug":false,"useNormalizedOHMUrl":true},"compatibleSdkVersion":12,"compatibleSdkType":"HarmonyOS","obfuscated":true}
@@ -0,0 +1,5 @@
1
+ import { PLVCallback } from './PLVCallback';
2
+ export interface IPLVBackwardInterface {
3
+ accessBackward: PLVCallback<void, boolean>;
4
+ backward: PLVCallback;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ declare class j1<T> implements IDataSource {
2
+ l1: DataChangeListener[];
3
+ totalCount(): number;
4
+ getData(index: number): T | undefined;
5
+ registerDataChangeListener(listener: DataChangeListener): void;
6
+ unregisterDataChangeListener(listener: DataChangeListener): void;
7
+ m1(): void;
8
+ n1(index: number): void;
9
+ o1(index: number): void;
10
+ q1(index: number): void;
11
+ s1(from: number, to: number): void;
12
+ t1(dataOperations: DataOperation[]): void;
13
+ }
14
+ export default class PLVLazyDataSource<T> extends j1<T> {
15
+ dataArray: T[];
16
+ _bindSource?: PLVLazyDataSource<T>;
17
+ _beBindSource?: PLVLazyDataSource<T>;
18
+ bindSource(source: PLVLazyDataSource<T>): void;
19
+ unbindSource(): void;
20
+ totalCount(): number;
21
+ getData(index: number): T;
22
+ addData(index: number, ...data: T[]): void;
23
+ pushData(...data: T[]): void;
24
+ deleteData(index: number): void;
25
+ moveData(from: number, to: number): void;
26
+ changeData(index: number, data: T): void;
27
+ clearData(): void;
28
+ reloadData(): void;
29
+ }
30
+ export {};
@@ -0,0 +1,172 @@
1
+ import PLVLogger from '../modules/log/PLVLogger';
2
+ const TAG = '[PLVLazyDataSource]';
3
+ class j1 {
4
+ constructor() {
5
+ this.l1 = [];
6
+ }
7
+ totalCount() {
8
+ return 0;
9
+ }
10
+ getData(index) {
11
+ return undefined;
12
+ }
13
+ registerDataChangeListener(listener) {
14
+ if (this.l1.indexOf(listener) < 0) {
15
+ PLVLogger.info(TAG, 'registerDataChangeListener');
16
+ this.l1.push(listener);
17
+ }
18
+ }
19
+ unregisterDataChangeListener(listener) {
20
+ const pos = this.l1.indexOf(listener);
21
+ if (pos >= 0) {
22
+ PLVLogger.info(TAG, 'unregisterDataChangeListener');
23
+ this.l1.splice(pos, 1);
24
+ }
25
+ }
26
+ m1() {
27
+ this.l1.forEach(listener => {
28
+ listener.onDataReloaded();
29
+ });
30
+ }
31
+ n1(index) {
32
+ this.l1.forEach(listener => {
33
+ listener.onDataAdd(index);
34
+ });
35
+ }
36
+ o1(index) {
37
+ this.l1.forEach(listener => {
38
+ listener.onDataChange(index);
39
+ });
40
+ }
41
+ q1(index) {
42
+ this.l1.forEach(listener => {
43
+ listener.onDataDelete(index);
44
+ });
45
+ }
46
+ s1(from, to) {
47
+ this.l1.forEach(listener => {
48
+ listener.onDataMove(from, to);
49
+ });
50
+ }
51
+ t1(dataOperations) {
52
+ this.l1.forEach(listener => {
53
+ listener.onDatasetChange(dataOperations);
54
+ });
55
+ }
56
+ }
57
+ export default class PLVLazyDataSource extends j1 {
58
+ constructor() {
59
+ super(...arguments);
60
+ this.dataArray = [];
61
+ }
62
+ bindSource(source) {
63
+ source._bindSource = this;
64
+ this._beBindSource = source;
65
+ this.dataArray = source.dataArray;
66
+ }
67
+ unbindSource() {
68
+ if (this._beBindSource) {
69
+ this._beBindSource._bindSource = undefined;
70
+ }
71
+ }
72
+ totalCount() {
73
+ return this.dataArray.length;
74
+ }
75
+ getData(index) {
76
+ return this.dataArray[index];
77
+ }
78
+ addData(index, ...data) {
79
+ if (data.length === 0) {
80
+ return;
81
+ }
82
+ this.dataArray.splice(index, 0, ...data);
83
+ const operation = [{
84
+ type: DataOperationType.ADD,
85
+ index: index,
86
+ count: data.length
87
+ }];
88
+ if (this._bindSource) {
89
+ this._bindSource.t1(operation);
90
+ }
91
+ else {
92
+ this.t1(operation);
93
+ }
94
+ }
95
+ pushData(...data) {
96
+ if (data.length === 0) {
97
+ return;
98
+ }
99
+ const index = this.totalCount();
100
+ this.dataArray.push(...data);
101
+ const operation = [{
102
+ type: DataOperationType.ADD,
103
+ index: index,
104
+ count: data.length
105
+ }];
106
+ if (this._bindSource) {
107
+ this._bindSource.t1(operation);
108
+ }
109
+ else {
110
+ this.t1(operation);
111
+ }
112
+ }
113
+ deleteData(index) {
114
+ this.dataArray.splice(index, 1);
115
+ const operation = [{
116
+ type: DataOperationType.DELETE,
117
+ index: index,
118
+ count: 1
119
+ }];
120
+ if (this._bindSource) {
121
+ this._bindSource.t1(operation);
122
+ }
123
+ else {
124
+ this.t1(operation);
125
+ }
126
+ }
127
+ moveData(from, to) {
128
+ const k1 = this.dataArray[from];
129
+ this.dataArray[from] = this.dataArray[to];
130
+ this.dataArray[to] = k1;
131
+ const operation = [{
132
+ type: DataOperationType.MOVE,
133
+ index: {
134
+ from: from, to: to
135
+ }
136
+ }];
137
+ if (this._bindSource) {
138
+ this._bindSource.t1(operation);
139
+ }
140
+ else {
141
+ this.t1(operation);
142
+ }
143
+ }
144
+ changeData(index, data) {
145
+ this.dataArray.splice(index, 1, data);
146
+ const operation = [{
147
+ type: DataOperationType.CHANGE,
148
+ index: index
149
+ }];
150
+ if (this._bindSource) {
151
+ this._bindSource.t1(operation);
152
+ }
153
+ else {
154
+ this.t1(operation);
155
+ }
156
+ }
157
+ clearData() {
158
+ this.dataArray.length = 0;
159
+ this.reloadData();
160
+ }
161
+ reloadData() {
162
+ const operation = [{
163
+ type: DataOperationType.RELOAD
164
+ }];
165
+ if (this._bindSource) {
166
+ this._bindSource.t1(operation);
167
+ }
168
+ else {
169
+ this.t1(operation);
170
+ }
171
+ }
172
+ }
@@ -0,0 +1,52 @@
1
+ export type PLVCallback<T = void, R = void> = (data: T) => R;
2
+ export type PLVCallback2<T1 = void, T2 = void, R = void> = (data1: T1, data2: T2) => R;
3
+ export declare class PLVStateData<T> {
4
+ data?: T;
5
+ constructor(data?: T);
6
+ copy(): PLVStateData<T>;
7
+ copyValue(data?: T): PLVStateData<T>;
8
+ }
9
+ export declare class PLVDisposable {
10
+ private _dispose;
11
+ isDispose(): boolean;
12
+ dispose(): void;
13
+ }
14
+ export declare class PLVPromiseValue<T> {
15
+ value?: T;
16
+ private promise?;
17
+ private resolve?;
18
+ set(value: T): void;
19
+ get(): Promise<T>;
20
+ }
21
+ @Observed
22
+ export declare class PLVLazyValue<T, P = void | undefined> {
23
+ private _value?;
24
+ private _callback;
25
+ constructor(i2: PLVCallback<P | undefined, T>);
26
+ get(param?: P): T;
27
+ }
28
+ @Observed
29
+ export declare class PLVAsyncLazyValue<T, P = void | undefined> {
30
+ private _value?;
31
+ private _callback;
32
+ constructor(h2: PLVCallback2<P | undefined, PLVCallback<T>>);
33
+ get(callback: PLVCallback<T>, param?: P): void;
34
+ }
35
+ export interface IPLVEventEmitter<T extends string = string> {
36
+ emit(event: T, ...args: Object[]): void;
37
+ }
38
+ export interface IPLVEventNotify<T extends string = string> extends IPLVEventEmitter<T> {
39
+ on(event: T, callback: Function, onTag?: string | Object): void;
40
+ off(event: T, callback?: Function, offTag?: string | Object): void;
41
+ clear(): void;
42
+ }
43
+ export declare class PLVEventNotify<T extends string = string> implements IPLVEventNotify<T> {
44
+ private tag;
45
+ private events;
46
+ private emitLogToFile;
47
+ constructor(e2?: string | Object, f2?: boolean);
48
+ on(event: T, callback: Function, c2?: string | Object): void;
49
+ off(event: T, callback?: Function, a2?: string | Object): void;
50
+ emit(event: T, ...args: Object[]): void;
51
+ clear(): void;
52
+ }
@@ -0,0 +1,128 @@
1
+ var u1 = (this && this.u1) || function (m2, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.v1 === "function")
4
+ r = Reflect.v1(m2, target, key, desc);
5
+ else
6
+ for (var n2 = m2.length - 1; n2 >= 0; n2--)
7
+ if (d = m2[n2])
8
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ };
11
+ import PLVLogger from '../modules/log/PLVLogger';
12
+ import PLVUtils from './PLVUtils';
13
+ export class PLVStateData {
14
+ constructor(data) {
15
+ this.data = data;
16
+ }
17
+ copy() {
18
+ return this.copyValue(this.data);
19
+ }
20
+ copyValue(data) {
21
+ return new PLVStateData(data);
22
+ }
23
+ }
24
+ export class PLVDisposable {
25
+ constructor() {
26
+ this._dispose = false;
27
+ }
28
+ isDispose() {
29
+ return this._dispose;
30
+ }
31
+ dispose() {
32
+ this._dispose = true;
33
+ }
34
+ }
35
+ export class PLVPromiseValue {
36
+ set(value) {
37
+ if (this.value == undefined) {
38
+ this.resolve?.(value);
39
+ }
40
+ this.value = value;
41
+ }
42
+ get() {
43
+ if (!this.promise) {
44
+ this.promise = PLVUtils.safePromise((k2, l2) => {
45
+ this.resolve = k2;
46
+ if (this.value != undefined) {
47
+ k2(this.value);
48
+ }
49
+ });
50
+ }
51
+ return this.promise;
52
+ }
53
+ }
54
+ let PLVLazyValue = class PLVLazyValue {
55
+ constructor(i2) {
56
+ this._callback = i2;
57
+ }
58
+ get(param) {
59
+ if (this._value == undefined) {
60
+ this._value = this._callback(param);
61
+ }
62
+ return this._value;
63
+ }
64
+ };
65
+ PLVLazyValue = u1([
66
+ Observed
67
+ ], PLVLazyValue);
68
+ export { PLVLazyValue };
69
+ let PLVAsyncLazyValue = class PLVAsyncLazyValue {
70
+ constructor(h2) {
71
+ this._callback = h2;
72
+ }
73
+ get(callback, param) {
74
+ if (this._value === undefined) {
75
+ this._callback(param, (value) => {
76
+ this._value = value;
77
+ callback(this._value);
78
+ });
79
+ }
80
+ else {
81
+ callback(this._value);
82
+ }
83
+ }
84
+ };
85
+ PLVAsyncLazyValue = u1([
86
+ Observed
87
+ ], PLVAsyncLazyValue);
88
+ export { PLVAsyncLazyValue };
89
+ export class PLVEventNotify {
90
+ constructor(e2, f2 = true) {
91
+ this.tag = '[PLVEventNotify]';
92
+ this.events = new Map();
93
+ this.emitLogToFile = true;
94
+ this.tag = PLVUtils.getClassTag(e2) || this.tag;
95
+ this.emitLogToFile = f2;
96
+ }
97
+ on(event, callback, c2) {
98
+ PLVLogger.info(PLVUtils.getClassTag(c2) || this.tag, `on event: ${event}`);
99
+ const d2 = this.events.get(event) || [];
100
+ d2.push(callback);
101
+ this.events.set(event, d2);
102
+ }
103
+ off(event, callback, a2) {
104
+ PLVLogger.info(PLVUtils.getClassTag(a2) || this.tag, `off event: ${event}`);
105
+ if (callback) {
106
+ const b2 = this.events.get(event) || [];
107
+ const index = b2.indexOf(callback);
108
+ if (index !== -1) {
109
+ b2.splice(index, 1);
110
+ }
111
+ this.events.set(event, b2);
112
+ }
113
+ else {
114
+ this.events.delete(event);
115
+ }
116
+ }
117
+ emit(event, ...args) {
118
+ PLVLogger.info(this.tag, `emit event: ${event}, args: ${args}`, this.emitLogToFile);
119
+ const w1 = this.events.get(event) || [];
120
+ w1.forEach(callback => {
121
+ callback(...args);
122
+ });
123
+ }
124
+ clear() {
125
+ PLVLogger.info(this.tag, `clear event notify`);
126
+ this.events.clear();
127
+ }
128
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Common constants for common component.
3
+ */
4
+ export default class PLVCommonConstants {
5
+ static readonly TAG: string;
6
+ static readonly HARMONY_HEI_TI_FONT_FAMILY = "HarmonyHeiTi";
7
+ static readonly FULL_PERCENT: string;
8
+ static readonly CONTAINER: string;
9
+ static readonly JS_PRE = "javascript:";
10
+ static readonly LENGTH_SHORT = 2000;
11
+ static readonly LENGTH_LONG = 3500;
12
+ static readonly DELAY_TIME_S = 100;
13
+ }
@@ -0,0 +1,10 @@
1
+ export default class PLVCommonConstants {
2
+ }
3
+ PLVCommonConstants.TAG = "[PLVLiveSDK]";
4
+ PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
5
+ PLVCommonConstants.FULL_PERCENT = '100%';
6
+ PLVCommonConstants.CONTAINER = '__container__';
7
+ PLVCommonConstants.JS_PRE = 'javascript:';
8
+ PLVCommonConstants.LENGTH_SHORT = 2000;
9
+ PLVCommonConstants.LENGTH_LONG = 3500;
10
+ PLVCommonConstants.DELAY_TIME_S = 100;
@@ -0,0 +1,19 @@
1
+ export declare enum PLVWebpageStatus {
2
+ INIT = "init",
3
+ ERROR = "error",
4
+ FINISHED = "finished"
5
+ }
6
+ export declare enum PLVFullScreenStatus {
7
+ IDLE = "idle",
8
+ ENTER = "enter",
9
+ EXIT = "exit"
10
+ }
11
+ export declare enum PLVPrintLogLevel {
12
+ ALL = 0,
13
+ VERBOSE = 2,
14
+ DEBUG = 3,
15
+ INFO = 4,
16
+ WARN = 5,
17
+ ERROR = 6,
18
+ NONE = 99
19
+ }
@@ -0,0 +1,22 @@
1
+ export var PLVWebpageStatus;
2
+ (function (u2) {
3
+ u2["INIT"] = "init";
4
+ u2["ERROR"] = "error";
5
+ u2["FINISHED"] = "finished";
6
+ })(PLVWebpageStatus || (PLVWebpageStatus = {}));
7
+ export var PLVFullScreenStatus;
8
+ (function (t2) {
9
+ t2["IDLE"] = "idle";
10
+ t2["ENTER"] = "enter";
11
+ t2["EXIT"] = "exit";
12
+ })(PLVFullScreenStatus || (PLVFullScreenStatus = {}));
13
+ export var PLVPrintLogLevel;
14
+ (function (s2) {
15
+ s2[s2["ALL"] = 0] = "ALL";
16
+ s2[s2["VERBOSE"] = 2] = "VERBOSE";
17
+ s2[s2["DEBUG"] = 3] = "DEBUG";
18
+ s2[s2["INFO"] = 4] = "INFO";
19
+ s2[s2["WARN"] = 5] = "WARN";
20
+ s2[s2["ERROR"] = 6] = "ERROR";
21
+ s2[s2["NONE"] = 99] = "NONE";
22
+ })(PLVPrintLogLevel || (PLVPrintLogLevel = {}));
@@ -0,0 +1,4 @@
1
+ export declare class PLVDeviceUtils {
2
+ static getNavigationIndicatorHeight(): number;
3
+ static getStatusBarHeight(): number;
4
+ }
@@ -0,0 +1,9 @@
1
+ import { AppUtil } from '@pura/harmony-utils';
2
+ export class PLVDeviceUtils {
3
+ static getNavigationIndicatorHeight() {
4
+ return px2vp(AppUtil.getNavigationIndicatorHeight());
5
+ }
6
+ static getStatusBarHeight() {
7
+ return px2vp(AppUtil.getStatusBarHeight());
8
+ }
9
+ }
@@ -0,0 +1,4 @@
1
+ import { HashMap } from '@kit.ArkTS';
2
+ export declare class PLVHashMap<K, V> extends HashMap<K, V> {
3
+ set(key: K, value: V): PLVHashMap<K, V>;
4
+ }
@@ -0,0 +1,7 @@
1
+ import HashMap from "@ohos.util.HashMap";
2
+ export class PLVHashMap extends HashMap {
3
+ set(key, value) {
4
+ super.set(key, value);
5
+ return this;
6
+ }
7
+ }
@@ -0,0 +1,21 @@
1
+ import { ClassConstructor } from 'class-transformer';
2
+ import { PLVHttpData } from '../modules/net/PLVHttpData';
3
+ import { PLVJSONObject } from './PLVType';
4
+ export default class PLVJSONUtils {
5
+ static safeStringify(value?: Object, replacer?: (this: object, key: string, value: object) => object | undefined): string;
6
+ static safeParse(text?: string): object | undefined;
7
+ static json2Bean<T>(f3: ClassConstructor<T>, g3: string): T | undefined;
8
+ static bean2Json(data: Object | Array<Object | String | Number | Boolean> | null | undefined): string;
9
+ static bean2Bean<T, V>(e3: T, plain: V): T | undefined;
10
+ static httpData2Bean<T>(d3: T, plain: PLVHttpData<T>): T | undefined;
11
+ static json2Map(c3: string): Map<string, Object>;
12
+ static object2Map(object: PLVJSONObject): Map<string, Object | undefined>;
13
+ static map2json(map: Map<string, Object | undefined>): Record<string, Object>;
14
+ static map2jsonStr(map: Map<string, Object>, replacer?: (this: object, key: string, value: object) => object | undefined): string;
15
+ static toUnescapedData(a3: string): string;
16
+ static toFillData<T extends y11>(v2: ClassConstructor<T> | T, w2: string | Object | undefined): T | undefined;
17
+ }
18
+ interface y11 {
19
+ fill(): void;
20
+ }
21
+ export {};