@polyvharmony/live-scenes-foundation 1.2.0-rc.1 → 1.3.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.
- package/CHANGELOG.md +5 -1
- package/Index.d.ets +4 -2
- package/Index.js +3 -1
- package/ResourceTable.txt +2 -1
- package/libs/plvclasstransformer.har +0 -0
- package/oh-package.json5 +1 -1
- package/package.json +1 -1
- package/src/main/ets/common/PLVCallback.d.ets +31 -6
- package/src/main/ets/common/PLVCallback.js +85 -27
- package/src/main/ets/common/PLVCommonConstants.d.ets +1 -0
- package/src/main/ets/common/PLVCommonConstants.js +1 -0
- package/src/main/ets/common/PLVCommonEnums.js +16 -16
- package/src/main/ets/common/PLVDeviceUtils.d.ets +7 -0
- package/src/main/ets/common/PLVDeviceUtils.js +28 -1
- package/src/main/ets/common/PLVJSONUtils.d.ets +7 -7
- package/src/main/ets/common/PLVJSONUtils.js +20 -20
- package/src/main/ets/common/PLVNetUtils.d.ets +4 -3
- package/src/main/ets/common/PLVNetUtils.js +20 -14
- package/src/main/ets/common/PLVPreferencesUtils.d.ets +8 -8
- package/src/main/ets/common/PLVPreferencesUtils.js +16 -16
- package/src/main/ets/common/PLVScheduledTask.js +2 -2
- package/src/main/ets/common/PLVSimpleBuffer.d.ets +2 -2
- package/src/main/ets/common/PLVSimpleBuffer.js +6 -6
- package/src/main/ets/common/PLVSparseArray.d.ets +10 -0
- package/src/main/ets/common/PLVSparseArray.js +44 -0
- package/src/main/ets/common/PLVTextUtils.d.ets +2 -1
- package/src/main/ets/common/PLVTextUtils.js +28 -22
- package/src/main/ets/common/PLVTimeUtils.d.ets +1 -1
- package/src/main/ets/common/PLVTimeUtils.js +8 -8
- package/src/main/ets/common/PLVToastUtils.d.ets +2 -2
- package/src/main/ets/common/PLVType.d.ets +1 -0
- package/src/main/ets/common/PLVUACreator.d.ets +1 -1
- package/src/main/ets/common/PLVUACreator.js +6 -6
- package/src/main/ets/common/PLVUtils.d.ets +15 -8
- package/src/main/ets/common/PLVUtils.js +89 -45
- package/src/main/ets/common/PLVWebUtils.d.ets +1 -1
- package/src/main/ets/common/PLVWebUtils.js +22 -22
- package/src/main/ets/common/ui/PLVNodeController.d.ets +41 -0
- package/src/main/ets/common/ui/PLVNodeController.js +103 -0
- package/src/main/ets/modules/log/PLVLogger.d.ets +9 -9
- package/src/main/ets/modules/log/PLVLogger.js +20 -20
- package/src/main/ets/modules/log/PLVXLogFilePrinter.d.ets +1 -1
- package/src/main/ets/modules/log/PLVXLogFilePrinter.js +2 -2
- package/src/main/ets/modules/net/PLVHttpData.d.ets +1 -1
- package/src/main/ets/modules/net/PLVHttpData.js +2 -2
- package/src/main/ets/modules/net/PLVHttpError.d.ets +2 -2
- package/src/main/ets/modules/net/PLVHttpError.js +5 -5
- package/src/main/ets/modules/net/PLVHttpRequest.d.ets +7 -7
- package/src/main/ets/modules/net/PLVHttpRequest.js +31 -31
- package/src/main/ets/modules/net/PLVRequestSetting.js +7 -7
- package/src/main/ets/modules/socket/PLVSocketIO.d.ets +19 -18
- package/src/main/ets/modules/socket/PLVSocketIO.js +70 -53
- package/src/main/ets/modules/web/PLVSimpleWeb.js +3 -3
- package/src/main/ets/modules/web/PLVWebController.d.ets +5 -3
- package/src/main/ets/modules/web/PLVWebController.js +29 -21
- package/src/main/module.json +1 -28
package/CHANGELOG.md
CHANGED
package/Index.d.ets
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export { PLVNodeControllerManager, PLVNodeController, NodeControllerConfig } from './src/main/ets/common/ui/PLVNodeController';
|
|
1
2
|
export { IPLVBackwardInterface } from './src/main/ets/common/IPLVBackwardInterface';
|
|
2
3
|
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 { PLVCallback, PLVCallback2, PLVCustomBuilder, PLVMediaQueryListener, PLVAvoidAreaChangeListener, PLVStateData, PLVStatefulData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, IPLVEventEmitter, IPLVEventNotify, PLVEventNotify } from './src/main/ets/common/PLVCallback';
|
|
4
5
|
export { default as PLVCommonConstants } from './src/main/ets/common/PLVCommonConstants';
|
|
5
6
|
export { PLVDeviceUtils } from './src/main/ets/common/PLVDeviceUtils';
|
|
6
7
|
export { PLVHashMap } from './src/main/ets/common/PLVHashMap';
|
|
@@ -9,10 +10,11 @@ export { default as PLVJSONUtils } from './src/main/ets/common/PLVJSONUtils';
|
|
|
9
10
|
export { PLVPreferencesUtils } from './src/main/ets/common/PLVPreferencesUtils';
|
|
10
11
|
export { PLVScheduledTask } from './src/main/ets/common/PLVScheduledTask';
|
|
11
12
|
export { PLVSimpleBuffer } from './src/main/ets/common/PLVSimpleBuffer';
|
|
13
|
+
export { PLVSparseArray } from './src/main/ets/common/PLVSparseArray';
|
|
12
14
|
export { PLVTextUtils } from './src/main/ets/common/PLVTextUtils';
|
|
13
15
|
export { PLVUACreator } from './src/main/ets/common/PLVUACreator';
|
|
14
16
|
export { default as PLVToastUtils } from './src/main/ets/common/PLVToastUtils';
|
|
15
|
-
export { PLVResponseObject, PLVResponseData, PLVResponse, PLVJSONObject, PLVResolve, PLVReject } from './src/main/ets/common/PLVType';
|
|
17
|
+
export { PLVResponseObject, PLVResponseType, PLVResponseData, PLVResponse, PLVJSONObject, PLVResolve, PLVReject } from './src/main/ets/common/PLVType';
|
|
16
18
|
export { default as PLVUtils } from './src/main/ets/common/PLVUtils';
|
|
17
19
|
export { PLVWebUtils } from './src/main/ets/common/PLVWebUtils';
|
|
18
20
|
export { PLVTimeUtils } from './src/main/ets/common/PLVTimeUtils';
|
package/Index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export { PLVNodeControllerManager, PLVNodeController } from './src/main/ets/common/ui/PLVNodeController';
|
|
1
2
|
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 { PLVCustomBuilder, PLVMediaQueryListener, PLVAvoidAreaChangeListener, PLVStateData, PLVStatefulData, PLVDisposable, PLVPromiseValue, PLVLazyValue, PLVAsyncLazyValue, PLVEventNotify } from './src/main/ets/common/PLVCallback';
|
|
3
4
|
export { default as PLVCommonConstants } from './src/main/ets/common/PLVCommonConstants';
|
|
4
5
|
export { PLVDeviceUtils } from './src/main/ets/common/PLVDeviceUtils';
|
|
5
6
|
export { PLVHashMap } from './src/main/ets/common/PLVHashMap';
|
|
@@ -8,6 +9,7 @@ export { default as PLVJSONUtils } from './src/main/ets/common/PLVJSONUtils';
|
|
|
8
9
|
export { PLVPreferencesUtils } from './src/main/ets/common/PLVPreferencesUtils';
|
|
9
10
|
export { PLVScheduledTask } from './src/main/ets/common/PLVScheduledTask';
|
|
10
11
|
export { PLVSimpleBuffer } from './src/main/ets/common/PLVSimpleBuffer';
|
|
12
|
+
export { PLVSparseArray } from './src/main/ets/common/PLVSparseArray';
|
|
11
13
|
export { PLVTextUtils } from './src/main/ets/common/PLVTextUtils';
|
|
12
14
|
export { PLVUACreator } from './src/main/ets/common/PLVUACreator';
|
|
13
15
|
export { default as PLVToastUtils } from './src/main/ets/common/PLVToastUtils';
|
package/ResourceTable.txt
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
string lib_name
|
|
1
|
+
string lib_name 0x02000010
|
|
2
2
|
string page_show 0x0200000e
|
|
3
3
|
string plv_web_load_failed 0x02000000
|
|
4
4
|
string plv_web_reload 0x02000001
|
|
5
5
|
color plv_web_main_red_color 0x02000002
|
|
6
6
|
color plv_web_reload_title_color 0x02000003
|
|
7
|
+
float page_text_font_size 0x0200000f
|
|
7
8
|
float plv_web_failure_img_size 0x02000004
|
|
8
9
|
float plv_web_large_border_radius 0x02000005
|
|
9
10
|
float plv_web_loading_img_margin 0x02000006
|
|
Binary file
|
package/oh-package.json5
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@polyvharmony/live-scenes-foundation","version":"1.
|
|
1
|
+
{"name":"@polyvharmony/live-scenes-foundation","version":"1.3.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":"file:./libs/plvclasstransformer.har","@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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@polyvharmony/live-scenes-foundation","version":"1.
|
|
1
|
+
{"name":"@polyvharmony/live-scenes-foundation","version":"1.3.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":"file:./libs/plvclasstransformer.har","@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}
|
|
@@ -1,11 +1,33 @@
|
|
|
1
|
+
import { mediaquery, window } from '@kit.ArkUI';
|
|
1
2
|
export type PLVCallback<T = void, R = void> = (data: T) => R;
|
|
2
3
|
export type PLVCallback2<T1 = void, T2 = void, R = void> = (data1: T1, data2: T2) => R;
|
|
4
|
+
@Builder
|
|
5
|
+
export declare function PLVCustomBuilder<T = void>(data: T): void;
|
|
6
|
+
export declare class PLVMediaQueryListener {
|
|
7
|
+
listener: mediaquery.MediaQueryListener | undefined;
|
|
8
|
+
callback: PLVCallback<mediaquery.MediaQueryResult> | undefined;
|
|
9
|
+
constructor(listener: mediaquery.MediaQueryListener, callback: PLVCallback<mediaquery.MediaQueryResult>);
|
|
10
|
+
off(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class PLVAvoidAreaChangeListener {
|
|
13
|
+
windowClass: window.Window | undefined;
|
|
14
|
+
callback: PLVCallback<window.AvoidAreaOptions> | undefined;
|
|
15
|
+
constructor(h2: window.Window, callback: PLVCallback<window.AvoidAreaOptions>);
|
|
16
|
+
off(): void;
|
|
17
|
+
}
|
|
3
18
|
export declare class PLVStateData<T> {
|
|
4
19
|
data?: T;
|
|
5
20
|
constructor(data?: T);
|
|
6
21
|
copy(): PLVStateData<T>;
|
|
7
22
|
copyValue(data?: T): PLVStateData<T>;
|
|
8
23
|
}
|
|
24
|
+
export declare class PLVStatefulData<T> extends PLVStateData<T> {
|
|
25
|
+
isSuccess?: boolean;
|
|
26
|
+
error?: Error;
|
|
27
|
+
constructor(data?: T, isSuccess?: boolean, error?: Error);
|
|
28
|
+
static success<T>(data?: T): PLVStatefulData<T>;
|
|
29
|
+
static error<T>(error?: Error): PLVStatefulData<T>;
|
|
30
|
+
}
|
|
9
31
|
export declare class PLVDisposable {
|
|
10
32
|
private _dispose;
|
|
11
33
|
isDispose(): boolean;
|
|
@@ -15,21 +37,24 @@ export declare class PLVPromiseValue<T> {
|
|
|
15
37
|
value?: T;
|
|
16
38
|
private promise?;
|
|
17
39
|
private resolve?;
|
|
40
|
+
private callbacks;
|
|
18
41
|
set(value: T): void;
|
|
19
|
-
|
|
42
|
+
observe(callback: PLVCallback<T>): void;
|
|
43
|
+
get(): T | Promise<T>;
|
|
44
|
+
clear(): void;
|
|
20
45
|
}
|
|
21
46
|
@Observed
|
|
22
47
|
export declare class PLVLazyValue<T, P = void | undefined> {
|
|
23
48
|
private _value?;
|
|
24
49
|
private _callback;
|
|
25
|
-
constructor(
|
|
50
|
+
constructor(f2: PLVCallback<P | undefined, T>);
|
|
26
51
|
get(param?: P): T;
|
|
27
52
|
}
|
|
28
53
|
@Observed
|
|
29
54
|
export declare class PLVAsyncLazyValue<T, P = void | undefined> {
|
|
30
55
|
private _value?;
|
|
31
56
|
private _callback;
|
|
32
|
-
constructor(
|
|
57
|
+
constructor(e2: PLVCallback2<P | undefined, PLVCallback<T>>);
|
|
33
58
|
get(callback: PLVCallback<T>, param?: P): void;
|
|
34
59
|
}
|
|
35
60
|
export interface IPLVEventEmitter<T extends string = string> {
|
|
@@ -44,9 +69,9 @@ export declare class PLVEventNotify<T extends string = string> implements IPLVEv
|
|
|
44
69
|
private tag;
|
|
45
70
|
private events;
|
|
46
71
|
private emitLogToFile;
|
|
47
|
-
constructor(
|
|
48
|
-
on(event: T, callback: Function,
|
|
49
|
-
off(event: T, callback?: Function,
|
|
72
|
+
constructor(c2?: string | Object, d2?: boolean);
|
|
73
|
+
on(event: T, callback: Function, a2?: string | Object): void;
|
|
74
|
+
off(event: T, callback?: Function, w1?: string | Object): void;
|
|
50
75
|
emit(event: T, ...args: Object[]): void;
|
|
51
76
|
clear(): void;
|
|
52
77
|
}
|
|
@@ -1,15 +1,40 @@
|
|
|
1
|
-
var u1 = (this && this.u1) || function (
|
|
1
|
+
var u1 = (this && this.u1) || function (j2, target, key, desc) {
|
|
2
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.v1 === "function")
|
|
4
|
-
r = Reflect.v1(
|
|
4
|
+
r = Reflect.v1(j2, target, key, desc);
|
|
5
5
|
else
|
|
6
|
-
for (var
|
|
7
|
-
if (d =
|
|
6
|
+
for (var k2 = j2.length - 1; k2 >= 0; k2--)
|
|
7
|
+
if (d = j2[k2])
|
|
8
8
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
9
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
10
|
};
|
|
11
11
|
import PLVLogger from '../modules/log/PLVLogger';
|
|
12
12
|
import PLVUtils from './PLVUtils';
|
|
13
|
+
export function PLVCustomBuilder(data, parent = null) {
|
|
14
|
+
const i2 = data;
|
|
15
|
+
}
|
|
16
|
+
export class PLVMediaQueryListener {
|
|
17
|
+
constructor(listener, callback) {
|
|
18
|
+
this.listener = listener;
|
|
19
|
+
this.callback = callback;
|
|
20
|
+
}
|
|
21
|
+
off() {
|
|
22
|
+
this.listener?.off("change", this.callback);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class PLVAvoidAreaChangeListener {
|
|
26
|
+
constructor(h2, callback) {
|
|
27
|
+
this.windowClass = h2;
|
|
28
|
+
this.callback = callback;
|
|
29
|
+
}
|
|
30
|
+
off() {
|
|
31
|
+
try {
|
|
32
|
+
this.windowClass?.off("avoidAreaChange", this.callback);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
13
38
|
export class PLVStateData {
|
|
14
39
|
constructor(data) {
|
|
15
40
|
this.data = data;
|
|
@@ -21,6 +46,19 @@ export class PLVStateData {
|
|
|
21
46
|
return new PLVStateData(data);
|
|
22
47
|
}
|
|
23
48
|
}
|
|
49
|
+
export class PLVStatefulData extends PLVStateData {
|
|
50
|
+
constructor(data, isSuccess = true, error) {
|
|
51
|
+
super(data);
|
|
52
|
+
this.isSuccess = isSuccess;
|
|
53
|
+
this.error = error;
|
|
54
|
+
}
|
|
55
|
+
static success(data) {
|
|
56
|
+
return new PLVStatefulData(data, true);
|
|
57
|
+
}
|
|
58
|
+
static error(error) {
|
|
59
|
+
return new PLVStatefulData(undefined, false, error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
24
62
|
export class PLVDisposable {
|
|
25
63
|
constructor() {
|
|
26
64
|
this._dispose = false;
|
|
@@ -33,27 +71,47 @@ export class PLVDisposable {
|
|
|
33
71
|
}
|
|
34
72
|
}
|
|
35
73
|
export class PLVPromiseValue {
|
|
74
|
+
constructor() {
|
|
75
|
+
this.callbacks = [];
|
|
76
|
+
}
|
|
36
77
|
set(value) {
|
|
37
78
|
if (this.value == undefined) {
|
|
38
79
|
this.resolve?.(value);
|
|
39
80
|
}
|
|
81
|
+
if (this.value != value) {
|
|
82
|
+
this.callbacks.forEach(callback => {
|
|
83
|
+
callback(value);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
40
86
|
this.value = value;
|
|
41
87
|
}
|
|
88
|
+
observe(callback) {
|
|
89
|
+
if (this.value != undefined) {
|
|
90
|
+
callback(this.value);
|
|
91
|
+
}
|
|
92
|
+
this.callbacks.push(callback);
|
|
93
|
+
}
|
|
42
94
|
get() {
|
|
95
|
+
if (this.value != undefined) {
|
|
96
|
+
return this.value;
|
|
97
|
+
}
|
|
43
98
|
if (!this.promise) {
|
|
44
|
-
this.promise = PLVUtils.safePromise((
|
|
45
|
-
this.resolve =
|
|
99
|
+
this.promise = PLVUtils.safePromise((g2, reject) => {
|
|
100
|
+
this.resolve = g2;
|
|
46
101
|
if (this.value != undefined) {
|
|
47
|
-
|
|
102
|
+
g2(this.value);
|
|
48
103
|
}
|
|
49
104
|
});
|
|
50
105
|
}
|
|
51
106
|
return this.promise;
|
|
52
107
|
}
|
|
108
|
+
clear() {
|
|
109
|
+
this.callbacks = [];
|
|
110
|
+
}
|
|
53
111
|
}
|
|
54
112
|
let PLVLazyValue = class PLVLazyValue {
|
|
55
|
-
constructor(
|
|
56
|
-
this._callback =
|
|
113
|
+
constructor(f2) {
|
|
114
|
+
this._callback = f2;
|
|
57
115
|
}
|
|
58
116
|
get(param) {
|
|
59
117
|
if (this._value == undefined) {
|
|
@@ -67,8 +125,8 @@ PLVLazyValue = u1([
|
|
|
67
125
|
], PLVLazyValue);
|
|
68
126
|
export { PLVLazyValue };
|
|
69
127
|
let PLVAsyncLazyValue = class PLVAsyncLazyValue {
|
|
70
|
-
constructor(
|
|
71
|
-
this._callback =
|
|
128
|
+
constructor(e2) {
|
|
129
|
+
this._callback = e2;
|
|
72
130
|
}
|
|
73
131
|
get(callback, param) {
|
|
74
132
|
if (this._value === undefined) {
|
|
@@ -87,28 +145,28 @@ PLVAsyncLazyValue = u1([
|
|
|
87
145
|
], PLVAsyncLazyValue);
|
|
88
146
|
export { PLVAsyncLazyValue };
|
|
89
147
|
export class PLVEventNotify {
|
|
90
|
-
constructor(
|
|
148
|
+
constructor(c2, d2 = true) {
|
|
91
149
|
this.tag = '[PLVEventNotify]';
|
|
92
150
|
this.events = new Map();
|
|
93
151
|
this.emitLogToFile = true;
|
|
94
|
-
this.tag = PLVUtils.getClassTag(
|
|
95
|
-
this.emitLogToFile =
|
|
152
|
+
this.tag = PLVUtils.getClassTag(c2) || this.tag;
|
|
153
|
+
this.emitLogToFile = d2;
|
|
96
154
|
}
|
|
97
|
-
on(event, callback,
|
|
98
|
-
PLVLogger.info(PLVUtils.getClassTag(
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
this.events.set(event,
|
|
155
|
+
on(event, callback, a2) {
|
|
156
|
+
PLVLogger.info(PLVUtils.getClassTag(a2) || this.tag, `on event: ${event}`);
|
|
157
|
+
const b2 = this.events.get(event) || [];
|
|
158
|
+
b2.push(callback);
|
|
159
|
+
this.events.set(event, b2);
|
|
102
160
|
}
|
|
103
|
-
off(event, callback,
|
|
104
|
-
PLVLogger.info(PLVUtils.getClassTag(
|
|
161
|
+
off(event, callback, w1) {
|
|
162
|
+
PLVLogger.info(PLVUtils.getClassTag(w1) || this.tag, `off event: ${event}`);
|
|
105
163
|
if (callback) {
|
|
106
|
-
const
|
|
107
|
-
const index =
|
|
164
|
+
const z1 = this.events.get(event) || [];
|
|
165
|
+
const index = z1.indexOf(callback);
|
|
108
166
|
if (index !== -1) {
|
|
109
|
-
|
|
167
|
+
z1.splice(index, 1);
|
|
110
168
|
}
|
|
111
|
-
this.events.set(event,
|
|
169
|
+
this.events.set(event, z1);
|
|
112
170
|
}
|
|
113
171
|
else {
|
|
114
172
|
this.events.delete(event);
|
|
@@ -116,8 +174,8 @@ export class PLVEventNotify {
|
|
|
116
174
|
}
|
|
117
175
|
emit(event, ...args) {
|
|
118
176
|
PLVLogger.info(this.tag, `emit event: ${event}, args: ${args}`, this.emitLogToFile);
|
|
119
|
-
const
|
|
120
|
-
|
|
177
|
+
const v1 = this.events.get(event) || [];
|
|
178
|
+
v1.forEach(callback => {
|
|
121
179
|
callback(...args);
|
|
122
180
|
});
|
|
123
181
|
}
|
|
@@ -5,6 +5,7 @@ export default class PLVCommonConstants {
|
|
|
5
5
|
static readonly TAG: string;
|
|
6
6
|
static readonly HARMONY_HEI_TI_FONT_FAMILY = "HarmonyHeiTi";
|
|
7
7
|
static readonly FULL_PERCENT: string;
|
|
8
|
+
static readonly AUTO: string;
|
|
8
9
|
static readonly CONTAINER: string;
|
|
9
10
|
static readonly JS_PRE = "javascript:";
|
|
10
11
|
static readonly LENGTH_SHORT = 2000;
|
|
@@ -3,6 +3,7 @@ export default class PLVCommonConstants {
|
|
|
3
3
|
PLVCommonConstants.TAG = "[PLVLiveSDK]";
|
|
4
4
|
PLVCommonConstants.HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi';
|
|
5
5
|
PLVCommonConstants.FULL_PERCENT = '100%';
|
|
6
|
+
PLVCommonConstants.AUTO = 'auto';
|
|
6
7
|
PLVCommonConstants.CONTAINER = '__container__';
|
|
7
8
|
PLVCommonConstants.JS_PRE = 'javascript:';
|
|
8
9
|
PLVCommonConstants.LENGTH_SHORT = 2000;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export var PLVWebpageStatus;
|
|
2
|
-
(function (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
(function (n2) {
|
|
3
|
+
n2["INIT"] = "init";
|
|
4
|
+
n2["ERROR"] = "error";
|
|
5
|
+
n2["FINISHED"] = "finished";
|
|
6
6
|
})(PLVWebpageStatus || (PLVWebpageStatus = {}));
|
|
7
7
|
export var PLVFullScreenStatus;
|
|
8
|
-
(function (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
(function (m2) {
|
|
9
|
+
m2["IDLE"] = "idle";
|
|
10
|
+
m2["ENTER"] = "enter";
|
|
11
|
+
m2["EXIT"] = "exit";
|
|
12
12
|
})(PLVFullScreenStatus || (PLVFullScreenStatus = {}));
|
|
13
13
|
export var PLVPrintLogLevel;
|
|
14
|
-
(function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
(function (l2) {
|
|
15
|
+
l2[l2["ALL"] = 0] = "ALL";
|
|
16
|
+
l2[l2["VERBOSE"] = 2] = "VERBOSE";
|
|
17
|
+
l2[l2["DEBUG"] = 3] = "DEBUG";
|
|
18
|
+
l2[l2["INFO"] = 4] = "INFO";
|
|
19
|
+
l2[l2["WARN"] = 5] = "WARN";
|
|
20
|
+
l2[l2["ERROR"] = 6] = "ERROR";
|
|
21
|
+
l2[l2["NONE"] = 99] = "NONE";
|
|
22
22
|
})(PLVPrintLogLevel || (PLVPrintLogLevel = {}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import { ConfigurationConstant } from '@kit.AbilityKit';
|
|
2
|
+
import { window } from '@kit.ArkUI';
|
|
1
3
|
export declare class PLVDeviceUtils {
|
|
2
4
|
static getNavigationIndicatorHeight(): number;
|
|
3
5
|
static getStatusBarHeight(): number;
|
|
6
|
+
static getWidth(): number;
|
|
7
|
+
static getHeight(): number;
|
|
8
|
+
static getMinDisplaySide(): number;
|
|
9
|
+
static setColorMode(colorMode: ConfigurationConstant.ColorMode): void;
|
|
10
|
+
static setWindowSystemBarProperties(systemBarProperties?: window.SystemBarProperties): void;
|
|
4
11
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { AppUtil } from '@pura/harmony-utils';
|
|
1
|
+
import { AppUtil, DisplayUtil } from '@pura/harmony-utils';
|
|
2
|
+
import PLVLogger from '../modules/log/PLVLogger';
|
|
3
|
+
const TAG = '[PLVDeviceUtils]';
|
|
2
4
|
export class PLVDeviceUtils {
|
|
3
5
|
static getNavigationIndicatorHeight() {
|
|
4
6
|
return px2vp(AppUtil.getNavigationIndicatorHeight());
|
|
@@ -6,4 +8,29 @@ export class PLVDeviceUtils {
|
|
|
6
8
|
static getStatusBarHeight() {
|
|
7
9
|
return px2vp(AppUtil.getStatusBarHeight());
|
|
8
10
|
}
|
|
11
|
+
static getWidth() {
|
|
12
|
+
return px2vp(DisplayUtil.getWidth());
|
|
13
|
+
}
|
|
14
|
+
static getHeight() {
|
|
15
|
+
return px2vp(DisplayUtil.getHeight());
|
|
16
|
+
}
|
|
17
|
+
static getMinDisplaySide() {
|
|
18
|
+
return Math.min(PLVDeviceUtils.getWidth(), PLVDeviceUtils.getHeight());
|
|
19
|
+
}
|
|
20
|
+
static setColorMode(colorMode) {
|
|
21
|
+
AppUtil.getContext().getApplicationContext().setColorMode(colorMode);
|
|
22
|
+
}
|
|
23
|
+
static setWindowSystemBarProperties(systemBarProperties) {
|
|
24
|
+
try {
|
|
25
|
+
let o2 = AppUtil.getMainWindow();
|
|
26
|
+
if (systemBarProperties) {
|
|
27
|
+
o2.setWindowSystemBarProperties(systemBarProperties).catch((error) => {
|
|
28
|
+
PLVLogger.error(TAG, `setWindowSystemBarProperties-error ~ code: ${error.code} -·- message: ${error.message}`);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
PLVLogger.error(TAG, JSON.stringify(err));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
9
36
|
}
|
|
@@ -4,18 +4,18 @@ import { PLVJSONObject } from './PLVType';
|
|
|
4
4
|
export default class PLVJSONUtils {
|
|
5
5
|
static safeStringify(value?: Object, replacer?: (this: object, key: string, value: object) => object | undefined): string;
|
|
6
6
|
static safeParse(text?: string): object | undefined;
|
|
7
|
-
static json2Bean<T>(
|
|
7
|
+
static json2Bean<T>(z2: ClassConstructor<T>, a3: string): T | undefined;
|
|
8
8
|
static bean2Json(data: Object | Array<Object | String | Number | Boolean> | null | undefined): string;
|
|
9
|
-
static bean2Bean<T, V>(
|
|
10
|
-
static httpData2Bean<T>(
|
|
11
|
-
static json2Map(
|
|
9
|
+
static bean2Bean<T, V>(w2: T, plain: V): T | undefined;
|
|
10
|
+
static httpData2Bean<T>(v2: T, plain: PLVHttpData<T>): T | undefined;
|
|
11
|
+
static json2Map(u2: string): Map<string, Object>;
|
|
12
12
|
static object2Map(object: PLVJSONObject): Map<string, Object | undefined>;
|
|
13
13
|
static map2json(map: Map<string, Object | undefined>): Record<string, Object>;
|
|
14
14
|
static map2jsonStr(map: Map<string, Object>, replacer?: (this: object, key: string, value: object) => object | undefined): string;
|
|
15
|
-
static toUnescapedData(
|
|
16
|
-
static toFillData<T extends
|
|
15
|
+
static toUnescapedData(t2: string): string;
|
|
16
|
+
static toFillData<T extends v8>(q2: ClassConstructor<T> | T, r2: string | Object | undefined): T | undefined;
|
|
17
17
|
}
|
|
18
|
-
interface
|
|
18
|
+
interface v8 {
|
|
19
19
|
fill(): void;
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -16,9 +16,9 @@ export default class PLVJSONUtils {
|
|
|
16
16
|
return undefined;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
static json2Bean(
|
|
19
|
+
static json2Bean(z2, a3) {
|
|
20
20
|
try {
|
|
21
|
-
return plainToClass(
|
|
21
|
+
return plainToClass(z2, JSON.parse(a3), {
|
|
22
22
|
enableImplicitConversion: false, exposeDefaultValues: true
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -37,9 +37,9 @@ export default class PLVJSONUtils {
|
|
|
37
37
|
return "";
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
static bean2Bean(
|
|
40
|
+
static bean2Bean(w2, plain) {
|
|
41
41
|
try {
|
|
42
|
-
return plainToClassFromExist(
|
|
42
|
+
return plainToClassFromExist(w2, plain, {
|
|
43
43
|
enableImplicitConversion: false, exposeDefaultValues: true
|
|
44
44
|
});
|
|
45
45
|
}
|
|
@@ -47,9 +47,9 @@ export default class PLVJSONUtils {
|
|
|
47
47
|
return undefined;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
static httpData2Bean(
|
|
50
|
+
static httpData2Bean(v2, plain) {
|
|
51
51
|
try {
|
|
52
|
-
plain.data = plainToClassFromExist(
|
|
52
|
+
plain.data = plainToClassFromExist(v2, plain.data, {
|
|
53
53
|
enableImplicitConversion: false, exposeDefaultValues: true
|
|
54
54
|
});
|
|
55
55
|
try {
|
|
@@ -63,8 +63,8 @@ export default class PLVJSONUtils {
|
|
|
63
63
|
return undefined;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
static json2Map(
|
|
67
|
-
return new Map(Object.entries(JSON.parse(
|
|
66
|
+
static json2Map(u2) {
|
|
67
|
+
return new Map(Object.entries(JSON.parse(u2)));
|
|
68
68
|
}
|
|
69
69
|
static object2Map(object) {
|
|
70
70
|
return new Map(Object.entries(object));
|
|
@@ -81,23 +81,23 @@ export default class PLVJSONUtils {
|
|
|
81
81
|
static map2jsonStr(map, replacer) {
|
|
82
82
|
return PLVJSONUtils.safeStringify(PLVJSONUtils.map2json(map), replacer);
|
|
83
83
|
}
|
|
84
|
-
static toUnescapedData(
|
|
85
|
-
if (!
|
|
86
|
-
return
|
|
84
|
+
static toUnescapedData(t2) {
|
|
85
|
+
if (!t2.includes('\\')) {
|
|
86
|
+
return t2;
|
|
87
87
|
}
|
|
88
|
-
return
|
|
88
|
+
return t2.substring(1, t2.length - 1)
|
|
89
89
|
.replace(/\\"/g, '"')
|
|
90
90
|
.replace(/\\\\/g, '\\');
|
|
91
91
|
}
|
|
92
|
-
static toFillData(
|
|
93
|
-
let
|
|
94
|
-
if (typeof
|
|
95
|
-
|
|
92
|
+
static toFillData(q2, r2) {
|
|
93
|
+
let s2 = undefined;
|
|
94
|
+
if (typeof r2 === 'string') {
|
|
95
|
+
s2 = PLVJSONUtils.json2Bean(q2, r2);
|
|
96
96
|
}
|
|
97
|
-
else if (typeof
|
|
98
|
-
|
|
97
|
+
else if (typeof r2 === 'object') {
|
|
98
|
+
s2 = PLVJSONUtils.bean2Bean(q2, r2);
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
return
|
|
100
|
+
s2?.fill();
|
|
101
|
+
return s2;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare class PLVNetUtils {
|
|
2
|
-
static replaceUrl(
|
|
3
|
-
static formatUrl(
|
|
4
|
-
static formatParams(params?: Record<string, string
|
|
2
|
+
static replaceUrl(h3: string, i3: Map<string, string | undefined>): string;
|
|
3
|
+
static formatUrl(g3: string, record: Record<string, string | undefined>): string;
|
|
4
|
+
static formatParams(params?: Record<string, string>, d3?: boolean): string;
|
|
5
|
+
static appendParams(b3: string, params?: Record<string, string>): string;
|
|
5
6
|
}
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
export class PLVNetUtils {
|
|
2
|
-
static replaceUrl(
|
|
3
|
-
const
|
|
2
|
+
static replaceUrl(h3, i3) {
|
|
3
|
+
const j3 = /{(\w+?)}/g;
|
|
4
4
|
let match;
|
|
5
|
-
let
|
|
6
|
-
while ((match =
|
|
5
|
+
let k3 = h3;
|
|
6
|
+
while ((match = j3.exec(h3)) !== null) {
|
|
7
7
|
const key = match[1];
|
|
8
|
-
const
|
|
9
|
-
if (
|
|
10
|
-
|
|
8
|
+
const l3 = i3.get(key);
|
|
9
|
+
if (l3 !== undefined) {
|
|
10
|
+
k3 = k3.replace(match[0], l3);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return k3;
|
|
14
14
|
}
|
|
15
|
-
static formatUrl(
|
|
16
|
-
return PLVNetUtils.replaceUrl(
|
|
15
|
+
static formatUrl(g3, record) {
|
|
16
|
+
return PLVNetUtils.replaceUrl(g3, new Map(Object.entries(record)));
|
|
17
17
|
}
|
|
18
|
-
static formatParams(params) {
|
|
19
|
-
let
|
|
18
|
+
static formatParams(params, d3) {
|
|
19
|
+
let e3 = '';
|
|
20
20
|
if (params) {
|
|
21
|
+
let f3 = true;
|
|
21
22
|
Object.entries(params).forEach((value, index) => {
|
|
22
23
|
if (value?.[0] && value?.[1]) {
|
|
23
|
-
|
|
24
|
+
e3 += (f3 && !d3 ? '?' : '&') + value?.[0] + '=' + value?.[1];
|
|
25
|
+
f3 = false;
|
|
24
26
|
}
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
|
-
return
|
|
29
|
+
return e3;
|
|
30
|
+
}
|
|
31
|
+
static appendParams(b3, params) {
|
|
32
|
+
const c3 = b3.includes('?');
|
|
33
|
+
return b3 + PLVNetUtils.formatParams(params, c3);
|
|
28
34
|
}
|
|
29
35
|
}
|