@polyvharmony/live-scenes-foundation 1.2.0 → 1.3.0-rc.2

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 (56) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/Index.d.ets +4 -2
  3. package/Index.js +3 -1
  4. package/ResourceTable.txt +2 -1
  5. package/libs/plvclasstransformer.har +0 -0
  6. package/oh-package.json5 +1 -1
  7. package/package.json +1 -1
  8. package/src/main/ets/common/PLVCallback.d.ets +31 -6
  9. package/src/main/ets/common/PLVCallback.js +85 -27
  10. package/src/main/ets/common/PLVCommonConstants.d.ets +1 -0
  11. package/src/main/ets/common/PLVCommonConstants.js +1 -0
  12. package/src/main/ets/common/PLVCommonEnums.js +16 -16
  13. package/src/main/ets/common/PLVDeviceUtils.d.ets +7 -0
  14. package/src/main/ets/common/PLVDeviceUtils.js +28 -1
  15. package/src/main/ets/common/PLVJSONUtils.d.ets +7 -7
  16. package/src/main/ets/common/PLVJSONUtils.js +20 -20
  17. package/src/main/ets/common/PLVNetUtils.d.ets +4 -3
  18. package/src/main/ets/common/PLVNetUtils.js +20 -14
  19. package/src/main/ets/common/PLVPreferencesUtils.d.ets +8 -8
  20. package/src/main/ets/common/PLVPreferencesUtils.js +16 -16
  21. package/src/main/ets/common/PLVScheduledTask.js +2 -2
  22. package/src/main/ets/common/PLVSimpleBuffer.d.ets +2 -2
  23. package/src/main/ets/common/PLVSimpleBuffer.js +6 -6
  24. package/src/main/ets/common/PLVSparseArray.d.ets +10 -0
  25. package/src/main/ets/common/PLVSparseArray.js +44 -0
  26. package/src/main/ets/common/PLVTextUtils.d.ets +2 -1
  27. package/src/main/ets/common/PLVTextUtils.js +28 -22
  28. package/src/main/ets/common/PLVTimeUtils.d.ets +1 -1
  29. package/src/main/ets/common/PLVTimeUtils.js +8 -8
  30. package/src/main/ets/common/PLVToastUtils.d.ets +2 -2
  31. package/src/main/ets/common/PLVType.d.ets +1 -0
  32. package/src/main/ets/common/PLVUACreator.d.ets +1 -1
  33. package/src/main/ets/common/PLVUACreator.js +6 -6
  34. package/src/main/ets/common/PLVUtils.d.ets +15 -8
  35. package/src/main/ets/common/PLVUtils.js +89 -45
  36. package/src/main/ets/common/PLVWebUtils.d.ets +1 -1
  37. package/src/main/ets/common/PLVWebUtils.js +22 -22
  38. package/src/main/ets/common/ui/PLVNodeController.d.ets +41 -0
  39. package/src/main/ets/common/ui/PLVNodeController.js +103 -0
  40. package/src/main/ets/modules/log/PLVLogger.d.ets +9 -9
  41. package/src/main/ets/modules/log/PLVLogger.js +20 -20
  42. package/src/main/ets/modules/log/PLVXLogFilePrinter.d.ets +1 -1
  43. package/src/main/ets/modules/log/PLVXLogFilePrinter.js +2 -2
  44. package/src/main/ets/modules/net/PLVHttpData.d.ets +1 -1
  45. package/src/main/ets/modules/net/PLVHttpData.js +2 -2
  46. package/src/main/ets/modules/net/PLVHttpError.d.ets +2 -2
  47. package/src/main/ets/modules/net/PLVHttpError.js +5 -5
  48. package/src/main/ets/modules/net/PLVHttpRequest.d.ets +7 -7
  49. package/src/main/ets/modules/net/PLVHttpRequest.js +31 -31
  50. package/src/main/ets/modules/net/PLVRequestSetting.js +7 -7
  51. package/src/main/ets/modules/socket/PLVSocketIO.d.ets +19 -18
  52. package/src/main/ets/modules/socket/PLVSocketIO.js +70 -53
  53. package/src/main/ets/modules/web/PLVSimpleWeb.js +3 -3
  54. package/src/main/ets/modules/web/PLVWebController.d.ets +5 -3
  55. package/src/main/ets/modules/web/PLVWebController.js +29 -21
  56. package/src/main/module.json +1 -28
@@ -10,17 +10,17 @@ export class PLVWebUtils {
10
10
  color = "rgba(0, 0, 0, 1)";
11
11
  }
12
12
  const style = "style=\" width:100%;\"";
13
- const m6 = "word-break:break-all;";
14
- const n6 = "color: " + color + ";";
13
+ const h6 = "word-break:break-all;";
14
+ const i6 = "color: " + color + ";";
15
15
  content = content.replace(/src=\"\/\//g, "src=\"https://");
16
16
  content = content.replace(/<img /g, "<img " + style + " ");
17
- content = content.replace(/<li>/g, "<li style=\"" + n6 + "\">");
18
- content = content.replace(/<p>/g, "<p style=\"" + m6 + n6 + "\">");
19
- content = content.replace(/<div>/g, "<div style=\"" + m6 + n6 + "\">");
20
- content = content.replace(/<table>/g, "<table border='1' rules=all style=\"" + n6 + "\">");
17
+ content = content.replace(/<li>/g, "<li style=\"" + i6 + "\">");
18
+ content = content.replace(/<p>/g, "<p style=\"" + h6 + i6 + "\">");
19
+ content = content.replace(/<div>/g, "<div style=\"" + h6 + i6 + "\">");
20
+ content = content.replace(/<table>/g, "<table border='1' rules=all style=\"" + i6 + "\">");
21
21
  content = content.replace(/<td>/g, "<td width=\"36\">");
22
- content = content.replace(/color: (#([0-9a-fA-F]{6}|[0-9a-fA-F]{8}));/g, (p6, q6) => {
23
- return `color: ${PLVWebUtils.toRGBA(q6)};`;
22
+ content = content.replace(/color: (#([0-9a-fA-F]{6}|[0-9a-fA-F]{8}));/g, (j6, k6) => {
23
+ return `color: ${PLVWebUtils.toRGBA(k6)};`;
24
24
  });
25
25
  content = "<!DOCTYPE html>\n" +
26
26
  "<html lang=\"en\">\n" +
@@ -35,26 +35,26 @@ export class PLVWebUtils {
35
35
  "</html>";
36
36
  return content;
37
37
  }
38
- static toRGBA(l6) {
38
+ static toRGBA(g6) {
39
39
  let alpha = 1;
40
- if (l6.length > 7) {
41
- alpha = parseInt(l6.substring(1, 3), 16) / 255;
42
- l6 = `#${l6.substring(3)}`;
40
+ if (g6.length > 7) {
41
+ alpha = parseInt(g6.substring(1, 3), 16) / 255;
42
+ g6 = `#${g6.substring(3)}`;
43
43
  }
44
- const red = parseInt(l6.substring(1, 3), 16);
45
- const green = parseInt(l6.substring(3, 5), 16);
46
- const blue = parseInt(l6.substring(5, 7), 16);
44
+ const red = parseInt(g6.substring(1, 3), 16);
45
+ const green = parseInt(g6.substring(3, 5), 16);
46
+ const blue = parseInt(g6.substring(5, 7), 16);
47
47
  return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
48
48
  }
49
49
  static cleanHTML(input) {
50
- let i6 = input.replace(/<p>((?:<img[^>]*>)+)<\/p>/g, (match, k6) => {
51
- return k6.replace(/<img[^>]*>/g, '[图片]');
50
+ let e6 = input.replace(/<p>((?:<img[^>]*>)+)<\/p>/g, (match, f6) => {
51
+ return f6.replace(/<img[^>]*>/g, '[图片]');
52
52
  });
53
- i6 = i6.replace(/<p><a[^>]*>(.*?)<\/a><\/p>/g, '$1');
54
- i6 = i6.replace(/<p>(.*?)<\/p>/g, '$1');
55
- i6 = i6.replace(/\n/g, ' ');
56
- i6 = PLVTextUtils.convertSpecialString(i6);
57
- return i6;
53
+ e6 = e6.replace(/<p><a[^>]*>(.*?)<\/a><\/p>/g, '$1');
54
+ e6 = e6.replace(/<p>(.*?)<\/p>/g, '$1');
55
+ e6 = e6.replace(/\n/g, ' ');
56
+ e6 = PLVTextUtils.convertSpecialString(e6);
57
+ return e6;
58
58
  }
59
59
  static openWebLink(url, component) {
60
60
  let want = {
@@ -0,0 +1,41 @@
1
+ import { BuilderNode, NodeController, UIContext } from '@kit.ArkUI';
2
+ import { PLVPromiseValue } from '../PLVCallback';
3
+ export declare class PLVNodeControllerManager {
4
+ private static controllerManagers;
5
+ private controllers;
6
+ private constructor();
7
+ static get(id?: number): PLVNodeControllerManager;
8
+ static delete(id: number): void;
9
+ getOrCreate(config: string | NodeControllerConfig): PLVNodeController;
10
+ private destroy;
11
+ }
12
+ export declare class PLVNodeController extends NodeController {
13
+ uniqueId: string;
14
+ viewNode: BuilderNode<[
15
+ ESObject
16
+ ]> | undefined;
17
+ wrapBuilder: WrappedBuilder<[
18
+ ESObject
19
+ ]> | undefined;
20
+ params: ESObject | undefined;
21
+ isShow?: boolean;
22
+ isShowPromise: PLVPromiseValue<boolean>;
23
+ private uiContext;
24
+ private environmentCallback?;
25
+ constructor(config: NodeControllerConfig);
26
+ makeNode(uiContext: UIContext): FrameNode | null;
27
+ fill(wrapBuilder: WrappedBuilder<[
28
+ ESObject
29
+ ]>, params: ESObject): PLVNodeController;
30
+ show(isShow?: boolean): void;
31
+ destroy(): void;
32
+ private onEnvironment;
33
+ }
34
+ export interface NodeControllerConfig {
35
+ name: string;
36
+ isShow?: boolean;
37
+ wrapBuilder?: WrappedBuilder<[
38
+ ESObject
39
+ ]>;
40
+ params?: ESObject;
41
+ }
@@ -0,0 +1,103 @@
1
+ import { BuilderNode, NodeController } from "@ohos.arkui.node";
2
+ import { PLVPromiseValue } from '../PLVCallback';
3
+ const l6 = new Map();
4
+ export class PLVNodeControllerManager {
5
+ constructor() {
6
+ this.controllers = new Map();
7
+ }
8
+ static get(id = 0) {
9
+ if (!PLVNodeControllerManager.controllerManagers.has(id)) {
10
+ PLVNodeControllerManager.controllerManagers.set(id, new PLVNodeControllerManager());
11
+ }
12
+ return PLVNodeControllerManager.controllerManagers.get(id);
13
+ }
14
+ static delete(id) {
15
+ PLVNodeControllerManager.get(id).destroy();
16
+ PLVNodeControllerManager.controllerManagers.delete(id);
17
+ }
18
+ getOrCreate(config) {
19
+ const uniqueId = typeof config === 'string' ? config : config.name;
20
+ if (!this.controllers.has(uniqueId)) {
21
+ this.controllers.set(uniqueId, new PLVNodeController(typeof config === 'string' ? { name: uniqueId } : config));
22
+ }
23
+ const controller = this.controllers.get(uniqueId);
24
+ if (typeof config !== 'string' && config.wrapBuilder) {
25
+ controller.fill(config.wrapBuilder, config.params);
26
+ controller.show(config.isShow);
27
+ }
28
+ return controller;
29
+ }
30
+ destroy(uniqueId) {
31
+ if (uniqueId) {
32
+ this.controllers.get(uniqueId)?.destroy();
33
+ this.controllers.delete(uniqueId);
34
+ }
35
+ else {
36
+ this.controllers.forEach((controller) => {
37
+ controller.destroy();
38
+ });
39
+ this.controllers.clear();
40
+ }
41
+ }
42
+ }
43
+ PLVNodeControllerManager.controllerManagers = new Map();
44
+ export class PLVNodeController extends NodeController {
45
+ constructor(config) {
46
+ super();
47
+ this.viewNode = undefined;
48
+ this.wrapBuilder = undefined;
49
+ this.params = undefined;
50
+ this.isShow = false;
51
+ this.isShowPromise = new PLVPromiseValue();
52
+ this.uiContext = undefined;
53
+ this.environmentCallback = undefined;
54
+ this.uniqueId = config.name;
55
+ this.isShow = config.isShow;
56
+ this.wrapBuilder = config.wrapBuilder;
57
+ this.params = config.params;
58
+ this.show(this.isShow);
59
+ }
60
+ makeNode(uiContext) {
61
+ if (!this.isShow || !this.wrapBuilder) {
62
+ return null;
63
+ }
64
+ this.uiContext = uiContext;
65
+ this.viewNode = l6.get(this.uniqueId) ?? new BuilderNode(uiContext);
66
+ l6.set(this.uniqueId, this.viewNode);
67
+ if (!this.viewNode.getFrameNode()) {
68
+ this.viewNode.build(this.wrapBuilder, this.params);
69
+ this.onEnvironment(uiContext);
70
+ }
71
+ return this.viewNode.getFrameNode();
72
+ }
73
+ fill(wrapBuilder, params) {
74
+ this.wrapBuilder = wrapBuilder;
75
+ this.params = params;
76
+ return this;
77
+ }
78
+ show(isShow = false) {
79
+ if (this.isShow === isShow || !this.wrapBuilder) {
80
+ return;
81
+ }
82
+ this.isShow = isShow;
83
+ this.rebuild();
84
+ this.isShowPromise.set(isShow);
85
+ }
86
+ destroy() {
87
+ l6.get(this.uniqueId)?.dispose();
88
+ l6.delete(this.uniqueId);
89
+ if (this.environmentCallback !== undefined) {
90
+ this.uiContext?.getHostContext()?.getApplicationContext().off('environment', this.environmentCallback);
91
+ }
92
+ this.uiContext = undefined;
93
+ }
94
+ onEnvironment(uiContext) {
95
+ this.environmentCallback = uiContext.getHostContext()?.getApplicationContext().on('environment', {
96
+ onConfigurationUpdated: (config) => {
97
+ this.viewNode?.updateConfiguration();
98
+ },
99
+ onMemoryLevel: (level) => {
100
+ }
101
+ });
102
+ }
103
+ }
@@ -6,15 +6,15 @@ export declare class PLVLogger {
6
6
  private format;
7
7
  private filePrinter?;
8
8
  init(context: common.UIAbilityContext): void;
9
- level(a7: PLVPrintLogLevel): void;
10
- debug(tag: string, message: string, z6?: boolean): void;
11
- info(tag: string, message: string, y6?: boolean): void;
12
- warn(tag: string, message: string, x6?: boolean): void;
13
- error(tag: string, message: string, w6?: boolean): void;
14
- printWarn(tag: string, v6: string, err: Error): string;
15
- printError(tag: string, u6: string, err: Error): string;
9
+ level(v6: PLVPrintLogLevel): void;
10
+ debug(tag: string, message: string, u6?: boolean): void;
11
+ info(tag: string, message: string, t6?: boolean): void;
12
+ warn(tag: string, message: string, s6?: boolean): void;
13
+ error(tag: string, message: string, r6?: boolean): void;
14
+ printWarn(tag: string, q6: string, err: Error): string;
15
+ printError(tag: string, p6: string, err: Error): string;
16
16
  private generateErrorMsg;
17
17
  private intercept;
18
18
  }
19
- declare const x11: PLVLogger;
20
- export default x11;
19
+ declare const u8: PLVLogger;
20
+ export default u8;
@@ -21,44 +21,44 @@ export class PLVLogger {
21
21
  .build();
22
22
  XLog.init(config, [new OhPrinter()]);
23
23
  }
24
- level(a7) {
25
- this.printLogLevel = a7;
24
+ level(v6) {
25
+ this.printLogLevel = v6;
26
26
  }
27
- debug(tag, message, z6 = true) {
27
+ debug(tag, message, u6 = true) {
28
28
  const msg = util.format(this.format, tag, message);
29
- this.intercept(PLVPrintLogLevel.DEBUG, msg, z6) || XLog.d(msg);
29
+ this.intercept(PLVPrintLogLevel.DEBUG, msg, u6) || XLog.d(msg);
30
30
  }
31
- info(tag, message, y6 = true) {
31
+ info(tag, message, t6 = true) {
32
32
  const msg = util.format(this.format, tag, message);
33
- this.intercept(PLVPrintLogLevel.INFO, msg, y6) || XLog.i(msg);
33
+ this.intercept(PLVPrintLogLevel.INFO, msg, t6) || XLog.i(msg);
34
34
  }
35
- warn(tag, message, x6 = true) {
35
+ warn(tag, message, s6 = true) {
36
36
  const msg = util.format(this.format, tag, message);
37
- this.intercept(PLVPrintLogLevel.WARN, msg, x6) || XLog.w(msg);
37
+ this.intercept(PLVPrintLogLevel.WARN, msg, s6) || XLog.w(msg);
38
38
  }
39
- error(tag, message, w6 = true) {
39
+ error(tag, message, r6 = true) {
40
40
  const msg = util.format(this.format, tag, message);
41
- this.intercept(PLVPrintLogLevel.ERROR, msg, w6) || XLog.e(msg);
41
+ this.intercept(PLVPrintLogLevel.ERROR, msg, r6) || XLog.e(msg);
42
42
  }
43
- printWarn(tag, v6, err) {
44
- const msg = this.generateErrorMsg(v6, err);
43
+ printWarn(tag, q6, err) {
44
+ const msg = this.generateErrorMsg(q6, err);
45
45
  this.warn(tag, msg);
46
46
  return msg;
47
47
  }
48
- printError(tag, u6, err) {
49
- const msg = this.generateErrorMsg(u6, err);
48
+ printError(tag, p6, err) {
49
+ const msg = this.generateErrorMsg(p6, err);
50
50
  this.error(tag, msg);
51
51
  return msg;
52
52
  }
53
- generateErrorMsg(s6, err) {
54
- let t6 = '';
53
+ generateErrorMsg(n6, err) {
54
+ let o6 = '';
55
55
  if (err && err.code) {
56
- t6 = `, code=${err.code}`;
56
+ o6 = `, code=${err.code}`;
57
57
  }
58
- return `${s6}: name=${err.name}, message=${err.message}${t6}\n${err.stack}`;
58
+ return `${n6}: name=${err.name}, message=${err.message}${o6}\n${err.stack}`;
59
59
  }
60
- intercept(level, msg, r6 = true) {
61
- if (r6) {
60
+ intercept(level, msg, m6 = true) {
61
+ if (m6) {
62
62
  this.filePrinter?.println(level, this.tag, msg);
63
63
  }
64
64
  return this.printLogLevel > level;
@@ -5,7 +5,7 @@ export declare class PLVXLogFilePrinter extends Printer {
5
5
  builder: FilePrinter.Builder;
6
6
  workerInstance?: worker.ThreadWorker;
7
7
  constructor(builder: FilePrinter.Builder);
8
- println(b7: number, tag: string, msg: string): void;
8
+ println(w6: number, tag: string, msg: string): void;
9
9
  }
10
10
  export declare class PLVXLogBuilder extends FilePrinter.Builder {
11
11
  build(): FilePrinter;
@@ -22,9 +22,9 @@ export class PLVXLogFilePrinter extends Printer {
22
22
  }
23
23
  }
24
24
  }
25
- println(b7, tag, msg) {
25
+ println(w6, tag, msg) {
26
26
  if (this.workerInstance != null) {
27
- let data = new LogAddMessage(b7, tag, msg);
27
+ let data = new LogAddMessage(w6, tag, msg);
28
28
  this.workerInstance.postMessage(data);
29
29
  }
30
30
  }
@@ -4,5 +4,5 @@ export declare class PLVHttpData<T> {
4
4
  status?: string;
5
5
  message?: string;
6
6
  data?: T;
7
- static fill<T>(e7: T, data: PLVResponse<T>): void;
7
+ static fill<T>(x6: T, data: PLVResponse<T>): void;
8
8
  }
@@ -1,8 +1,8 @@
1
1
  import PLVJSONUtils from '../../common/PLVJSONUtils';
2
2
  export class PLVHttpData {
3
- static fill(e7, data) {
3
+ static fill(x6, data) {
4
4
  if (data) {
5
- PLVJSONUtils.httpData2Bean(e7, data.data);
5
+ PLVJSONUtils.httpData2Bean(x6, data.data);
6
6
  }
7
7
  }
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import { AxiosError } from '@ohos/axios';
2
2
  export declare class PLVHttpError extends AxiosError {
3
- constructor(g7: AxiosError);
4
- log(tag: string, f7: string): this;
3
+ constructor(z6: AxiosError);
4
+ log(tag: string, y6: string): this;
5
5
  }
@@ -2,12 +2,12 @@ import { AxiosError } from '@ohos/axios';
2
2
  import PLVJSONUtils from '../../common/PLVJSONUtils';
3
3
  import PLVLogger from '../log/PLVLogger';
4
4
  export class PLVHttpError extends AxiosError {
5
- constructor(g7) {
6
- const message = (g7.response?.data && PLVJSONUtils.safeStringify(g7.response.data)) || g7.message;
7
- super(message, g7.code, g7.config, g7.request, g7.response);
5
+ constructor(z6) {
6
+ const message = (z6.response?.data && PLVJSONUtils.safeStringify(z6.response.data)) || z6.message;
7
+ super(message, z6.code, z6.config, z6.request, z6.response);
8
8
  }
9
- log(tag, f7) {
10
- PLVLogger.printError(tag, f7, this);
9
+ log(tag, y6) {
10
+ PLVLogger.printError(tag, y6, this);
11
11
  return this;
12
12
  }
13
13
  }
@@ -7,13 +7,13 @@ export declare class PLVHttpRequest {
7
7
  baseURL?: string;
8
8
  userAgent?: string;
9
9
  private method?;
10
- constructor(x7?: string);
11
- ua(w7?: string): this;
12
- create<g12 = Object>(config?: PLVAxiosRequestConfig<g12>): import("@ohos/axios").AxiosInstance;
13
- request<T = Object, f12 = AxiosResponse<T>>(p: Promise<AxiosResponse<T>>): Promise<f12>;
14
- get<T = Object, d12 = AxiosResponse<T>, e12 = Object>(config?: PLVAxiosRequestConfig<e12>): Promise<d12>;
15
- post<T = Object, b12 = AxiosResponse<T>, c12 = Object>(config?: PLVAxiosRequestConfig<c12>): Promise<b12>;
16
- checkCache<T = Object, z11 = AxiosResponse<T>, a12 = Object>(config?: PLVAxiosRequestConfig<a12>): Promise<z11> | undefined;
10
+ constructor(g7?: string);
11
+ ua(f7?: string): this;
12
+ create<z8 = Object>(config?: PLVAxiosRequestConfig<z8>): import("@ohos/axios").AxiosInstance;
13
+ request<T = Object, R = AxiosResponse<T>>(p: Promise<AxiosResponse<T>>): Promise<R>;
14
+ get<T = Object, R = AxiosResponse<T>, y8 = Object>(config?: PLVAxiosRequestConfig<y8>): Promise<R>;
15
+ post<T = Object, R = AxiosResponse<T>, x8 = Object>(config?: PLVAxiosRequestConfig<x8>): Promise<R>;
16
+ checkCache<T = Object, R = AxiosResponse<T>, w8 = Object>(config?: PLVAxiosRequestConfig<w8>): Promise<R> | undefined;
17
17
  generateCacheKey(config?: AxiosRequestConfig): string;
18
18
  }
19
19
  export interface PLVAxiosRequestConfig<D = Object> extends AxiosRequestConfig<D> {
@@ -9,34 +9,34 @@ import PLVUtils from '../../common/PLVUtils';
9
9
  import { PLVNetUtils } from '../../common/PLVNetUtils';
10
10
  const TAG = '[PLVHttpRequest]';
11
11
  export class PLVHttpRequest {
12
- constructor(x7) {
13
- this.baseURL = x7;
12
+ constructor(g7) {
13
+ this.baseURL = g7;
14
14
  }
15
- ua(w7) {
16
- this.userAgent = w7;
15
+ ua(f7) {
16
+ this.userAgent = f7;
17
17
  return this;
18
18
  }
19
19
  create(config) {
20
- const o7 = axios.create();
21
- o7.defaults.timeout = 10000;
22
- o7.defaults.readTimeout = 10000;
23
- o7.defaults.connectTimeout = 10000;
24
- o7.defaults.baseURL = this.baseURL;
25
- o7.defaults.headers.common["w1"] = this.userAgent;
20
+ const c7 = axios.create();
21
+ c7.defaults.timeout = 10000;
22
+ c7.defaults.readTimeout = 10000;
23
+ c7.defaults.connectTimeout = 10000;
24
+ c7.defaults.baseURL = this.baseURL;
25
+ c7.defaults.headers.common["w1"] = this.userAgent;
26
26
  if (config?.formUrlEncoded) {
27
- o7.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
27
+ c7.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
28
28
  }
29
29
  let cacheKey = '';
30
- o7.interceptors.request.use((v7) => {
30
+ c7.interceptors.request.use((e7) => {
31
31
  if (config?.signKey) {
32
- const data = v7.params ? v7.params : v7.data;
32
+ const data = e7.params ? e7.params : e7.data;
33
33
  const map = PLVJSONUtils.object2Map(data);
34
34
  map.delete('log');
35
35
  data['sign'] = PLVRequestSetting.createSign(map, config.signKey);
36
36
  }
37
37
  if (PLVHttpRequest.token) {
38
- const params = v7.params;
39
- const data = v7.data;
38
+ const params = e7.params;
39
+ const data = e7.data;
40
40
  if (params && Object.keys(params).includes('appId')) {
41
41
  params['token'] = PLVHttpRequest.token;
42
42
  params["z1"] = PLVHttpRequest.token;
@@ -47,22 +47,22 @@ export class PLVHttpRequest {
47
47
  }
48
48
  }
49
49
  if (config?.useCache) {
50
- cacheKey = this.generateCacheKey(v7);
50
+ cacheKey = this.generateCacheKey(e7);
51
51
  }
52
- PLVLogger.info(TAG, `--> ${this.method} ${this.baseURL}${config?.url}${PLVNetUtils.formatParams(v7?.params)}`);
53
- PLVLogger.info(TAG, `--> ${PLVNetUtils.formatParams(v7?.data)}`);
54
- return v7;
52
+ PLVLogger.info(TAG, `--> ${this.method} ${this.baseURL}${config?.url}${PLVNetUtils.formatParams(e7?.params)}`);
53
+ PLVLogger.info(TAG, `--> ${PLVNetUtils.formatParams(e7?.data)}`);
54
+ return e7;
55
55
  }, (error) => {
56
56
  return Promise.reject(error);
57
57
  });
58
- o7.interceptors.response.use((response) => {
58
+ c7.interceptors.response.use((response) => {
59
59
  PLVLogger.info(TAG, `<-- ${response.status} ${this.method} ${this.baseURL}${response.config.url}${PLVNetUtils.formatParams(config?.params)} (${response.performanceTiming?.totalTiming}ms)`);
60
60
  PLVLogger.info(TAG, `Header: ${PLVJSONUtils.safeStringify(response.headers)}`);
61
61
  PLVLogger.info(TAG, `Result: ${PLVJSONUtils.safeStringify(response.data)}`);
62
62
  if (config?.aesDecrypted) {
63
- const u7 = response.data;
64
- if (u7) {
65
- u7['data'] = PLVJSONUtils.safeParse(PLVRequestSetting.decryptDataSync(u7['data']));
63
+ const d7 = response.data;
64
+ if (d7) {
65
+ d7['data'] = PLVJSONUtils.safeParse(PLVRequestSetting.decryptDataSync(d7['data']));
66
66
  }
67
67
  else {
68
68
  PLVLogger.printError(TAG, 'response error', new Error('jsonData undefined'));
@@ -81,23 +81,23 @@ export class PLVHttpRequest {
81
81
  }, (error) => {
82
82
  return Promise.reject(error);
83
83
  });
84
- return o7;
84
+ return c7;
85
85
  }
86
86
  request(p) {
87
- return PLVUtils.safePromise((k7, l7) => {
87
+ return PLVUtils.safePromise((b7, reject) => {
88
88
  p.then((r) => {
89
89
  const data = r.data;
90
90
  if (data) {
91
91
  for (const key of Object.keys(data)) {
92
92
  if (key == 'code' && data[key] != 200 + '') {
93
- l7(new PLVHttpError(new AxiosError(PLVJSONUtils.safeStringify(r.data || ''), data[key], undefined, undefined, r)));
93
+ reject(new PLVHttpError(new AxiosError(PLVJSONUtils.safeStringify(r.data || ''), data[key], undefined, undefined, r)));
94
94
  return;
95
95
  }
96
96
  }
97
97
  }
98
- k7(r);
98
+ b7(r);
99
99
  }).catch((err) => {
100
- l7(new PLVHttpError(err));
100
+ reject(new PLVHttpError(err));
101
101
  });
102
102
  });
103
103
  }
@@ -123,7 +123,7 @@ export class PLVHttpRequest {
123
123
  let cacheKey = this.baseURL + '' + config?.url;
124
124
  const params = config?.params;
125
125
  const data = config?.data;
126
- const h7 = (record) => {
126
+ const a7 = (record) => {
127
127
  if (record) {
128
128
  for (const key of Object.keys(record)) {
129
129
  if (key == 'timestamp' || key == 'sign' || key == 'token' || key == 'viewerToken') {
@@ -138,8 +138,8 @@ export class PLVHttpRequest {
138
138
  }
139
139
  }
140
140
  };
141
- h7(params);
142
- h7(data);
141
+ a7(params);
142
+ a7(data);
143
143
  return cacheKey;
144
144
  }
145
145
  }
@@ -2,23 +2,23 @@ import buffer from "@ohos.buffer";
2
2
  import { CryptoJS } from '@ohos/crypto-js';
3
3
  export class PLVRequestSetting {
4
4
  static createSign(map, key) {
5
- const a8 = key + PLVRequestSetting.concatParams(map) + key;
6
- const b8 = CryptoJS.MD5(a8).toString().toUpperCase();
7
- return b8;
5
+ const j7 = key + PLVRequestSetting.concatParams(map) + key;
6
+ const k7 = CryptoJS.MD5(j7).toString().toUpperCase();
7
+ return k7;
8
8
  }
9
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), {
10
+ const i7 = CryptoJS.AES.decrypt(buffer.from(data, 'base64').toString('hex'), CryptoJS.enc.Utf8.parse(PLVRequestSetting.DECRYPT_KEY_1_SRC), {
11
11
  format: CryptoJS.format.Hex,
12
12
  iv: CryptoJS.enc.Utf8.parse(PLVRequestSetting.DECRYPT_KEY_2_SRC),
13
13
  mode: CryptoJS.mode.CBC,
14
14
  padding: CryptoJS.pad.Pkcs7
15
15
  }).toString(CryptoJS.enc.Utf8);
16
- return z7;
16
+ return i7;
17
17
  }
18
18
  static concatParams(map) {
19
- const y7 = Array.from(map.keys()).sort();
19
+ const h7 = Array.from(map.keys()).sort();
20
20
  const builder = [];
21
- for (const key of y7) {
21
+ for (const key of h7) {
22
22
  if (!key || !map.get(key)) {
23
23
  continue;
24
24
  }
@@ -3,23 +3,24 @@ export declare class PLVSocketIO {
3
3
  private client;
4
4
  protected socketIOStatus: PLVSocketIOStatus;
5
5
  protected onSocketIOStatusListener?: PLVCallback<PLVSocketIOStatus, void>;
6
+ protected isTokenExpired: boolean;
6
7
  private set_open_listener;
7
- protected set_fail_listener(f9: () => void): void;
8
- protected set_reconnecting_listener(e9: () => void): void;
8
+ protected set_fail_listener(h8: () => void): void;
9
+ protected set_reconnecting_listener(g8: () => void): void;
9
10
  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;
11
+ protected set_close_listener(e8: (reason: string) => void): void;
12
+ protected set_socket_open_listener(d8: (nsp: string) => void): void;
13
+ protected set_socket_close_listener(c8: (nsp: string) => void): void;
13
14
  protected connect(uri: string): void;
14
- protected connectWithQuery(uri: string, query: string, v8: string): void;
15
+ protected connectWithQuery(uri: string, query: string, b8: string): void;
15
16
  connected(): boolean;
16
- disconnect(u8?: boolean): void;
17
- destroy(t8?: boolean): void;
17
+ disconnect(a8?: boolean): void;
18
+ destroy(z7?: boolean): void;
18
19
  protected clear_con_listeners(): void;
19
20
  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;
21
+ protected set_reconnect_attempts(y7: number): void;
22
+ protected set_reconnect_delay(x7: number): void;
23
+ protected set_reconnect_delay_max(w7: number): void;
23
24
  protected set_logs_default(): void;
24
25
  protected set_logs_quiet(): void;
25
26
  protected set_logs_verbose(): void;
@@ -28,16 +29,16 @@ export declare class PLVSocketIO {
28
29
  protected set_proxy_basic_auth(uri: string, username: string, password: string): void;
29
30
  private opened;
30
31
  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;
32
+ protected set_nsp(v7: string): void;
33
+ protected on(t7: string, u7: (event_json: string) => void): void;
34
+ protected once(r7: string, s7: (event_json: string) => void): void;
35
+ protected off(q7: string): void;
35
36
  protected off_all(): void;
36
37
  private socket_close;
37
- protected on_error(i8: (message: string) => void): void;
38
+ protected on_error(p7: (message: string) => void): void;
38
39
  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;
40
+ protected emitSkipCheck(name: string, message: ESObject, o7?: (emit_callback_json: string) => void): void;
41
+ emit(name: string, message: ESObject, n7?: (emit_callback_json: string) => void): boolean;
41
42
  private replaceJson;
42
43
  }
43
44
  export declare enum PLVSocketIOStatus {