@polyvharmony/live-scenes-foundation 1.3.2 → 1.3.3

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 (80) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/Index.d.ets +2 -0
  3. package/ets/modules.abc +0 -0
  4. package/libs/plvsocket.har +0 -0
  5. package/oh-package.json5 +1 -1
  6. package/package.json +1 -1
  7. package/src/main/ets/common/IPLVBackwardInterface.d.ets +2 -0
  8. package/src/main/ets/common/PLVBasicDataSource.d.ets +2 -0
  9. package/src/main/ets/common/PLVCallback.d.ets +10 -8
  10. package/src/main/ets/common/PLVCommonConstants.d.ets +2 -0
  11. package/src/main/ets/common/PLVCommonEnums.d.ets +2 -0
  12. package/src/main/ets/common/PLVDeviceUtils.d.ets +4 -2
  13. package/src/main/ets/common/PLVHashMap.d.ets +3 -1
  14. package/src/main/ets/common/PLVJSONUtils.d.ets +14 -12
  15. package/src/main/ets/common/PLVNetUtils.d.ets +6 -4
  16. package/src/main/ets/common/PLVPreferencesUtils.d.ets +10 -8
  17. package/src/main/ets/common/PLVScheduledTask.d.ets +3 -1
  18. package/src/main/ets/common/PLVSimpleBuffer.d.ets +5 -3
  19. package/src/main/ets/common/PLVSparseArray.d.ets +8 -6
  20. package/src/main/ets/common/PLVTextUtils.d.ets +10 -8
  21. package/src/main/ets/common/PLVTimeUtils.d.ets +3 -1
  22. package/src/main/ets/common/PLVToastUtils.d.ets +4 -2
  23. package/src/main/ets/common/PLVType.d.ets +2 -0
  24. package/src/main/ets/common/PLVUACreator.d.ets +3 -1
  25. package/src/main/ets/common/PLVUtils.d.ets +24 -22
  26. package/src/main/ets/common/PLVWebUtils.d.ets +6 -4
  27. package/src/main/ets/common/ui/PLVNodeController.d.ets +10 -8
  28. package/src/main/ets/modules/log/PLVLogger.d.ets +10 -8
  29. package/src/main/ets/modules/log/PLVXLogFilePrinter.d.ets +4 -2
  30. package/src/main/ets/modules/log/PLVXLogWorker.d.ets +2 -0
  31. package/src/main/ets/modules/net/PLVApiConstants.d.ets +2 -0
  32. package/src/main/ets/modules/net/PLVHttpData.d.ets +3 -1
  33. package/src/main/ets/modules/net/PLVHttpError.d.ets +4 -2
  34. package/src/main/ets/modules/net/PLVHttpRequest.d.ets +10 -8
  35. package/src/main/ets/modules/net/PLVRequestSetting.d.ets +5 -3
  36. package/src/main/ets/modules/socket/PLVSocketIO.d.ets +22 -20
  37. package/src/main/ets/modules/web/PLVFailureLayout.d.ets +2 -0
  38. package/src/main/ets/modules/web/PLVLoadingLayout.d.ets +2 -0
  39. package/src/main/ets/modules/web/PLVNewWindowLayout.d.ets +2 -0
  40. package/src/main/ets/modules/web/PLVSimpleWeb.d.ets +2 -0
  41. package/src/main/ets/modules/web/PLVWebController.d.ets +39 -37
  42. package/src/main/ets/modules/web/PLVWebModel.d.ets +2 -0
  43. package/src/main/module.json +1 -1
  44. package/Index.js +0 -30
  45. package/src/main/ets/common/IPLVBackwardInterface.js +0 -1
  46. package/src/main/ets/common/PLVBasicDataSource.js +0 -172
  47. package/src/main/ets/common/PLVCallback.js +0 -186
  48. package/src/main/ets/common/PLVCommonConstants.js +0 -11
  49. package/src/main/ets/common/PLVCommonEnums.js +0 -22
  50. package/src/main/ets/common/PLVDeviceUtils.js +0 -36
  51. package/src/main/ets/common/PLVHashMap.js +0 -7
  52. package/src/main/ets/common/PLVJSONUtils.js +0 -103
  53. package/src/main/ets/common/PLVNetUtils.js +0 -35
  54. package/src/main/ets/common/PLVPreferencesUtils.js +0 -30
  55. package/src/main/ets/common/PLVScheduledTask.js +0 -44
  56. package/src/main/ets/common/PLVSimpleBuffer.js +0 -30
  57. package/src/main/ets/common/PLVSparseArray.js +0 -44
  58. package/src/main/ets/common/PLVTextUtils.js +0 -79
  59. package/src/main/ets/common/PLVTimeUtils.js +0 -14
  60. package/src/main/ets/common/PLVToastUtils.js +0 -17
  61. package/src/main/ets/common/PLVType.js +0 -1
  62. package/src/main/ets/common/PLVUACreator.js +0 -11
  63. package/src/main/ets/common/PLVUtils.js +0 -241
  64. package/src/main/ets/common/PLVWebUtils.js +0 -78
  65. package/src/main/ets/common/ui/PLVNodeController.js +0 -104
  66. package/src/main/ets/modules/log/PLVLogger.js +0 -67
  67. package/src/main/ets/modules/log/PLVXLogFilePrinter.js +0 -39
  68. package/src/main/ets/modules/log/PLVXLogWorker.js +0 -4
  69. package/src/main/ets/modules/net/PLVApiConstants.js +0 -7
  70. package/src/main/ets/modules/net/PLVHttpData.js +0 -8
  71. package/src/main/ets/modules/net/PLVHttpError.js +0 -13
  72. package/src/main/ets/modules/net/PLVHttpRequest.js +0 -148
  73. package/src/main/ets/modules/net/PLVRequestSetting.js +0 -33
  74. package/src/main/ets/modules/socket/PLVSocketIO.js +0 -181
  75. package/src/main/ets/modules/web/PLVFailureLayout.js +0 -76
  76. package/src/main/ets/modules/web/PLVLoadingLayout.js +0 -45
  77. package/src/main/ets/modules/web/PLVNewWindowLayout.js +0 -61
  78. package/src/main/ets/modules/web/PLVSimpleWeb.js +0 -256
  79. package/src/main/ets/modules/web/PLVWebController.js +0 -283
  80. package/src/main/ets/modules/web/PLVWebModel.js +0 -1
@@ -1,241 +0,0 @@
1
- import { PLVAvoidAreaChangeListener, PLVMediaQueryListener } from './PLVCallback';
2
- import PLVLogger from '../modules/log/PLVLogger';
3
- import PLVCommonConstants from './PLVCommonConstants';
4
- import { AppUtil, DeviceUtil, PasteboardUtil } from '@pura/harmony-utils';
5
- import ConfigurationConstant from "@ohos.app.ability.ConfigurationConstant";
6
- import mediaquery from "@ohos.mediaquery";
7
- import window from "@ohos.window";
8
- import scanBarcode from "@hms.core.scan.scanBarcode";
9
- import scanCore from "@hms.core.scan.scanCore";
10
- import { PLVDeviceUtils } from './PLVDeviceUtils';
11
- const TAG = '[PLVUtils]';
12
- export default class PLVUtils {
13
- constructor() {
14
- }
15
- static init(f11, g11) {
16
- AppUtil.init(f11, g11);
17
- }
18
- static getClassTag(c11, d11 = true) {
19
- let e11 = d11 ? '[Anonymous]' : undefined;
20
- if (typeof c11 == 'string') {
21
- e11 = c11;
22
- }
23
- else {
24
- if (c11 && c11.constructor) {
25
- e11 = `[${c11.constructor.name}]`;
26
- }
27
- }
28
- return e11;
29
- }
30
- static retryWhen(y10, z10) {
31
- try {
32
- return Promise.resolve(y10());
33
- }
34
- catch (a11) {
35
- PLVLogger.printWarn(TAG, 'retryWhen catch error', a11);
36
- try {
37
- return Promise.resolve(z10());
38
- }
39
- catch (b11) {
40
- PLVLogger.printWarn(TAG, 'retryWhen catch error while retry', b11);
41
- return Promise.reject(b11);
42
- }
43
- }
44
- }
45
- static async disposablePromise(v10, w10) {
46
- try {
47
- await v10;
48
- }
49
- catch (x10) {
50
- return Promise.reject(x10);
51
- }
52
- if (w10?.isDispose()) {
53
- return Promise.reject(new Error('error'));
54
- }
55
- return v10;
56
- }
57
- static safePromise(p10, q10) {
58
- const r10 = new Promise(async (s10, t10) => {
59
- try {
60
- await p10(s10, t10);
61
- }
62
- catch (u10) {
63
- PLVLogger.printWarn(TAG, 'safePromise catch error', u10);
64
- t10(u10);
65
- }
66
- });
67
- return PLVUtils.disposablePromise(r10, q10);
68
- }
69
- static async retryPromise(h10, i10, j10, k10) {
70
- let l10 = 0;
71
- let m10 = new Error('error');
72
- while (l10 <= h10) {
73
- try {
74
- const o10 = await j10;
75
- if (!k10?.isDispose()) {
76
- return o10;
77
- }
78
- }
79
- catch (n10) {
80
- m10 = n10;
81
- PLVLogger.printWarn(TAG, `retryPromise retryCount=${l10} catch error`, n10);
82
- }
83
- if (++l10 > h10) {
84
- break;
85
- }
86
- if (k10?.isDispose()) {
87
- return Promise.reject(m10);
88
- }
89
- await PLVUtils.delay(i10);
90
- }
91
- return Promise.reject(m10);
92
- }
93
- static async delay(f10) {
94
- return PLVUtils.safePromise((g10) => {
95
- setTimeout(g10, f10);
96
- });
97
- }
98
- static validCallback(e10) {
99
- return '/' != e10;
100
- }
101
- static getPid() {
102
- const c10 = Date.now();
103
- const d10 = Math.floor(Math.random() * 1000000) + 1000000;
104
- return c10 + "X" + d10;
105
- }
106
- static getDeviceId() {
107
- return DeviceUtil.getDeviceId();
108
- }
109
- static undefinedToValue(z9, a10, b10) {
110
- setTimeout(() => {
111
- a10(z9);
112
- }, b10 ? b10 : PLVCommonConstants.DELAY_TIME_S);
113
- return undefined;
114
- }
115
- static copyText(y9) {
116
- return PasteboardUtil.setDataText(y9);
117
- }
118
- static listenerOrientation(w9) {
119
- const x9 = mediaquery.matchMediaSync('(orientation: landscape)');
120
- x9.on('change', w9);
121
- return new PLVMediaQueryListener(x9, w9);
122
- }
123
- static listenerAvoidAreaChange(t9) {
124
- const u9 = AppUtil.getMainWindow();
125
- try {
126
- u9.on('avoidAreaChange', t9);
127
- }
128
- catch (v9) {
129
- PLVLogger.error(TAG, `Failed to enable the listener for system avoid area changes. Cause code: ${v9.code}, message: ${v9.message}`);
130
- }
131
- return new PLVAvoidAreaChangeListener(u9, t9);
132
- }
133
- static changeOrientation(m9, n9, o9) {
134
- let p9 = getContext(n9);
135
- let q9 = (s9) => {
136
- s9.setPreferredOrientation(m9 ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT);
137
- };
138
- o9 ? q9(o9) :
139
- window.getLastWindow(p9).then((r9) => {
140
- q9(r9);
141
- });
142
- }
143
- static isLandscape(k9) {
144
- let l9 = getContext(k9);
145
- return l9.config.direction === ConfigurationConstant.Direction.DIRECTION_HORIZONTAL;
146
- }
147
- static setWindowFullScreen(z8 = false, a9 = false, b9, c9) {
148
- return new Promise((d9) => {
149
- let e9 = getContext(b9);
150
- let f9 = (h9) => {
151
- let i9 = h9.getWindowProperties().isLayoutFullScreen;
152
- let j9 = h9.getWindowProperties().isFullScreen;
153
- h9.setWindowLayoutFullScreen(z8);
154
- if (canIUse("SystemCapability.Window.SessionManager")) {
155
- h9.setSpecificSystemBarEnabled('status', !a9);
156
- d9([i9, j9]);
157
- }
158
- };
159
- c9 ? f9(c9) :
160
- window.getLastWindow(e9).then((g9) => {
161
- f9(g9);
162
- });
163
- });
164
- }
165
- static setWindowSystemBarProperties(y8) {
166
- PLVDeviceUtils.setWindowSystemBarProperties(y8);
167
- }
168
- static startScan(s8) {
169
- return new Promise((t8) => {
170
- if (canIUse('SystemCapability.Multimedia.Scan.Core') && canIUse('SystemCapability.Multimedia.Scan.ScanBarcode')) {
171
- let u8 = {
172
- scanTypes: [scanCore.ScanType.ALL],
173
- enableMultiMode: true,
174
- enableAlbum: true
175
- };
176
- try {
177
- scanBarcode.startScanForResult(getContext(s8), u8).then((x8) => {
178
- PLVLogger.info(TAG, 'Promise scan result: ' + JSON.stringify(x8));
179
- t8(x8.originalValue);
180
- }).catch((w8) => {
181
- PLVLogger.error(TAG, 'Promise error: ' + JSON.stringify(w8));
182
- });
183
- }
184
- catch (v8) {
185
- PLVLogger.error(TAG, 'failReason: ' + JSON.stringify(v8));
186
- }
187
- }
188
- });
189
- }
190
- static getVideoRectJS(q8) {
191
- let r8 = "function getVideoRect() {";
192
- {
193
- r8 += "let tags = document.getElementsByTagName('video');";
194
- r8 += "if (tags.length > 0) {";
195
- {
196
- r8 += "let video = tags[0];";
197
- r8 += "return {";
198
- {
199
- r8 += "'width': video.videoWidth,";
200
- r8 += "'height': video.videoHeight";
201
- }
202
- r8 += "};";
203
- }
204
- r8 += "}";
205
- r8 += "return {};";
206
- }
207
- r8 += "}";
208
- r8 += "getVideoRect();";
209
- return q8 ? PLVCommonConstants.JS_PRE + r8 : r8;
210
- }
211
- static getExitFullScreenJS(o8) {
212
- let p8 = "function exitFullScreen() {";
213
- p8 += "document.getElementsByTagName('video')[0].webkitExitFullScreen()";
214
- p8 += "}";
215
- p8 += "exitFullScreen();";
216
- return o8 ? PLVCommonConstants.JS_PRE + p8 : p8;
217
- }
218
- static colorResourceToHex(n8) {
219
- return PLVUtils.colorIntToHex(getContext().resourceManager.getColorSync(n8));
220
- }
221
- static colorIntToHex(k8, l8 = false) {
222
- const m8 = k8.toString(16).padStart(8, '0');
223
- if (l8) {
224
- return `#${m8.toUpperCase()}`;
225
- }
226
- else {
227
- return `#${m8.substring(2).toUpperCase()}`;
228
- }
229
- }
230
- static debounce(g8, h8 = 500, i8 = 'default') {
231
- if (PLVUtils.TIMES.has(i8)) {
232
- clearTimeout(PLVUtils.TIMES.get(i8));
233
- }
234
- const j8 = setTimeout(() => {
235
- g8();
236
- PLVUtils.TIMES.delete(i8);
237
- }, h8);
238
- PLVUtils.TIMES.set(i8, j8);
239
- }
240
- }
241
- PLVUtils.TIMES = new Map();
@@ -1,78 +0,0 @@
1
- import { PLVTextUtils } from './PLVTextUtils';
2
- import PLVLogger from '../modules/log/PLVLogger';
3
- const TAG = '[PLVWebUtils]';
4
- export class PLVWebUtils {
5
- static toWebViewContent(v11, w11) {
6
- if (!v11) {
7
- return v11;
8
- }
9
- if (!w11) {
10
- w11 = "rgba(0, 0, 0, 1)";
11
- }
12
- const x11 = "style=\" width:100%;\"";
13
- const y11 = "word-break:break-all;";
14
- const z11 = "color: " + w11 + ";";
15
- v11 = v11.replace(/src=\"\/\//g, "src=\"https://");
16
- v11 = v11.replace(/<img /g, "<img " + x11 + " ");
17
- v11 = v11.replace(/<li>/g, "<li style=\"" + z11 + "\">");
18
- v11 = v11.replace(/<p>/g, "<p style=\"" + y11 + z11 + "\">");
19
- v11 = v11.replace(/<div>/g, "<div style=\"" + y11 + z11 + "\">");
20
- v11 = v11.replace(/<table>/g, "<table border='1' rules=all style=\"" + z11 + "\">");
21
- v11 = v11.replace(/<td>/g, "<td width=\"36\">");
22
- v11 = v11.replace(/color: (#([0-9a-fA-F]{6}|[0-9a-fA-F]{8}));/g, (a12, b12) => {
23
- return `color: ${PLVWebUtils.toRGBA(b12)};`;
24
- });
25
- v11 = "<!DOCTYPE html>\n" +
26
- "<html lang=\"en\">\n" +
27
- "<head>\n" +
28
- " <meta charset=\"UTF-8\">\n" +
29
- " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" +
30
- " <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n" +
31
- " <title>Document</title>\n" +
32
- "</head>\n" +
33
- "<body style=\" color: " + w11 + ";margin:0;padding:0\">" + v11 + "</body>\n" +
34
- "</html>";
35
- return v11;
36
- }
37
- static toRGBA(q11) {
38
- let r11 = 1;
39
- if (q11.length > 7) {
40
- r11 = parseInt(q11.substring(1, 3), 16) / 255;
41
- q11 = `#${q11.substring(3)}`;
42
- }
43
- const s11 = parseInt(q11.substring(1, 3), 16);
44
- const t11 = parseInt(q11.substring(3, 5), 16);
45
- const u11 = parseInt(q11.substring(5, 7), 16);
46
- return `rgba(${s11}, ${t11}, ${u11}, ${r11})`;
47
- }
48
- static cleanHTML(m11) {
49
- let n11 = m11.replace(/<p>((?:<img[^>]*>)+)<\/p>/g, (o11, p11) => {
50
- return p11.replace(/<img[^>]*>/g, '[图片]');
51
- });
52
- n11 = n11.replace(/<p><a[^>]*>(.*?)<\/a><\/p>/g, '$1');
53
- n11 = n11.replace(/<p>(.*?)<\/p>/g, '$1');
54
- n11 = n11.replace(/\n/g, ' ');
55
- n11 = PLVTextUtils.convertSpecialString(n11);
56
- return n11;
57
- }
58
- static openWebLink(h11, i11) {
59
- let j11 = {
60
- action: 'ohos.want.action.viewData',
61
- entities: ['entity.system.browsable'],
62
- uri: h11
63
- };
64
- const k11 = getContext(i11);
65
- if (k11) {
66
- k11.startAbility(j11)
67
- .then(() => {
68
- PLVLogger.info(TAG, `openWebLink success, url: ${h11}`);
69
- })
70
- .catch((l11) => {
71
- PLVLogger.error(TAG, `openWebLink error, url: ${h11}, code: ${l11.code}, message: ${l11.message}`);
72
- });
73
- }
74
- else {
75
- PLVLogger.error(TAG, `openWebLink error, context: undefined`);
76
- }
77
- }
78
- }
@@ -1,104 +0,0 @@
1
- import { BuilderNode as BuilderNode } from "@ohos.arkui.node";
2
- import { NodeController as NodeController } from "@ohos.arkui.node";
3
- import { PLVPromiseValue } from '../PLVCallback';
4
- const viewNodes = new Map();
5
- export class PLVNodeControllerManager {
6
- constructor() {
7
- this.controllers = new Map();
8
- }
9
- static get(q12 = 0) {
10
- if (!PLVNodeControllerManager.controllerManagers.has(q12)) {
11
- PLVNodeControllerManager.controllerManagers.set(q12, new PLVNodeControllerManager());
12
- }
13
- return PLVNodeControllerManager.controllerManagers.get(q12);
14
- }
15
- static delete(p12) {
16
- PLVNodeControllerManager.get(p12).destroy();
17
- PLVNodeControllerManager.controllerManagers.delete(p12);
18
- }
19
- getOrCreate(m12) {
20
- const n12 = typeof m12 === 'string' ? m12 : m12.name;
21
- if (!this.controllers.has(n12)) {
22
- this.controllers.set(n12, new PLVNodeController(typeof m12 === 'string' ? { name: n12 } : m12));
23
- }
24
- const o12 = this.controllers.get(n12);
25
- if (typeof m12 !== 'string' && m12.wrapBuilder) {
26
- o12.fill(m12.wrapBuilder, m12.params);
27
- o12.show(m12.isShow);
28
- }
29
- return o12;
30
- }
31
- destroy(k12) {
32
- if (k12) {
33
- this.controllers.get(k12)?.destroy();
34
- this.controllers.delete(k12);
35
- }
36
- else {
37
- this.controllers.forEach((l12) => {
38
- l12.destroy();
39
- });
40
- this.controllers.clear();
41
- }
42
- }
43
- }
44
- PLVNodeControllerManager.controllerManagers = new Map();
45
- export class PLVNodeController extends NodeController {
46
- constructor(j12) {
47
- super();
48
- this.viewNode = undefined;
49
- this.wrapBuilder = undefined;
50
- this.params = undefined;
51
- this.isShow = false;
52
- this.isShowPromise = new PLVPromiseValue();
53
- this.uiContext = undefined;
54
- this.environmentCallback = undefined;
55
- this.uniqueId = j12.name;
56
- this.isShow = j12.isShow;
57
- this.wrapBuilder = j12.wrapBuilder;
58
- this.params = j12.params;
59
- this.show(this.isShow);
60
- }
61
- makeNode(i12) {
62
- if (!this.isShow || !this.wrapBuilder) {
63
- return null;
64
- }
65
- this.uiContext = i12;
66
- this.viewNode = viewNodes.get(this.uniqueId) ?? new BuilderNode(i12);
67
- viewNodes.set(this.uniqueId, this.viewNode);
68
- if (!this.viewNode.getFrameNode()) {
69
- this.viewNode.build(this.wrapBuilder, this.params);
70
- this.onEnvironment(i12);
71
- }
72
- return this.viewNode.getFrameNode();
73
- }
74
- fill(g12, h12) {
75
- this.wrapBuilder = g12;
76
- this.params = h12;
77
- return this;
78
- }
79
- show(f12 = false) {
80
- if (this.isShow === f12 || !this.wrapBuilder) {
81
- return;
82
- }
83
- this.isShow = f12;
84
- this.rebuild();
85
- this.isShowPromise.set(f12);
86
- }
87
- destroy() {
88
- viewNodes.get(this.uniqueId)?.dispose();
89
- viewNodes.delete(this.uniqueId);
90
- if (this.environmentCallback !== undefined) {
91
- this.uiContext?.getHostContext()?.getApplicationContext().off('environment', this.environmentCallback);
92
- }
93
- this.uiContext = undefined;
94
- }
95
- onEnvironment(c12) {
96
- this.environmentCallback = c12.getHostContext()?.getApplicationContext().on('environment', {
97
- onConfigurationUpdated: (e12) => {
98
- this.viewNode?.updateConfiguration();
99
- },
100
- onMemoryLevel: (d12) => {
101
- }
102
- });
103
- }
104
- }
@@ -1,67 +0,0 @@
1
- import PLVCommonConstants from '../../common/PLVCommonConstants';
2
- import { PLVPrintLogLevel } from '../../common/PLVCommonEnums';
3
- import { DateFileNameGenerator, FileLastModifiedCleanStrategy, FileSizeBackupStrategy, LogConfiguration, OhPrinter, XLog } from '@ohos-port/xlog';
4
- import util from "@ohos.util";
5
- import { PLVXLogBuilder } from './PLVXLogFilePrinter';
6
- export class PLVLogger {
7
- constructor() {
8
- this.printLogLevel = PLVPrintLogLevel.ALL;
9
- this.tag = PLVCommonConstants.TAG.substring(1, PLVCommonConstants.TAG.length - 1);
10
- this.format = "%s";
11
- }
12
- init(w13) {
13
- const x13 = new LogConfiguration.Builder()
14
- .setTag(this.tag)
15
- .build();
16
- const y13 = w13.filesDir;
17
- this.filePrinter = new PLVXLogBuilder(`${y13}/log`, true, '../../modules/log/PLVXLogWorker.ets')
18
- .setCleanStrategy(new FileLastModifiedCleanStrategy(5 * 24 * 60 * 60 * 1000))
19
- .setFileNameGenerator(new DateFileNameGenerator())
20
- .setBackupStrategy(new FileSizeBackupStrategy(10 * 1024 * 1024))
21
- .build();
22
- XLog.init(x13, [new OhPrinter()]);
23
- }
24
- level(v13) {
25
- this.printLogLevel = v13;
26
- }
27
- debug(r13, s13, t13 = true) {
28
- const u13 = util.format(this.format, r13, s13);
29
- this.intercept(PLVPrintLogLevel.DEBUG, u13, t13) || XLog.d(u13);
30
- }
31
- info(n13, o13, p13 = true) {
32
- const q13 = util.format(this.format, n13, o13);
33
- this.intercept(PLVPrintLogLevel.INFO, q13, p13) || XLog.i(q13);
34
- }
35
- warn(j13, k13, l13 = true) {
36
- const m13 = util.format(this.format, j13, k13);
37
- this.intercept(PLVPrintLogLevel.WARN, m13, l13) || XLog.w(m13);
38
- }
39
- error(f13, g13, h13 = true) {
40
- const i13 = util.format(this.format, f13, g13);
41
- this.intercept(PLVPrintLogLevel.ERROR, i13, h13) || XLog.e(i13);
42
- }
43
- printWarn(b13, c13, d13) {
44
- const e13 = this.generateErrorMsg(c13, d13);
45
- this.warn(b13, e13);
46
- return e13;
47
- }
48
- printError(x12, y12, z12) {
49
- const a13 = this.generateErrorMsg(y12, z12);
50
- this.error(x12, a13);
51
- return a13;
52
- }
53
- generateErrorMsg(u12, v12) {
54
- let w12 = '';
55
- if (v12 && v12.code) {
56
- w12 = `, code=${v12.code}`;
57
- }
58
- return `${u12}: name=${v12.name}, message=${v12.message}${w12}\n${v12.stack}`;
59
- }
60
- intercept(r12, s12, t12 = true) {
61
- if (t12) {
62
- this.filePrinter?.println(r12, this.tag, s12);
63
- }
64
- return this.printLogLevel > r12;
65
- }
66
- }
67
- export default new PLVLogger();
@@ -1,39 +0,0 @@
1
- import worker from '@ohos.worker';
2
- import { FilePrinter } from '@ohos-port/xlog';
3
- import { LogAddMessage, LogInitMessage } from '@ohos-port/xlog/src/main/ets/printer/file/MessageType';
4
- import { Printer } from '@ohos-port/xlog/src/main/ets/printer/Printer';
5
- export class PLVXLogFilePrinter extends Printer {
6
- constructor(d14) {
7
- super();
8
- this.builder = d14;
9
- if (this.builder.useWorker) {
10
- try {
11
- this.workerInstance = new worker.ThreadWorker(this.builder.workerPath);
12
- this.workerInstance.onmessage = (h14) => {
13
- let i14 = h14.data;
14
- let j14 = i14.type;
15
- };
16
- this.workerInstance.onexit = (g14) => {
17
- console.info("XLog: workerInstance onexit");
18
- };
19
- let f14 = new LogInitMessage(this.builder);
20
- this.workerInstance.postMessage(f14);
21
- }
22
- catch (e14) {
23
- console.error("XLog start worker err: " + e14);
24
- }
25
- }
26
- }
27
- println(z13, a14, b14) {
28
- if (this.workerInstance != null) {
29
- let c14 = new LogAddMessage(z13, a14, b14);
30
- this.workerInstance.postMessage(c14);
31
- }
32
- }
33
- }
34
- export class PLVXLogBuilder extends FilePrinter.Builder {
35
- build() {
36
- super.build();
37
- return new PLVXLogFilePrinter(this);
38
- }
39
- }
@@ -1,4 +0,0 @@
1
- import worker from '@ohos.worker';
2
- import { logErrorHandler, logHandler } from '@ohos-port/xlog/XLogBaseWorker';
3
- worker.workerPort.onmessage = logHandler;
4
- worker.workerPort.onerror = logErrorHandler;
@@ -1,7 +0,0 @@
1
- export class PLVApiConstants {
2
- }
3
- PLVApiConstants.API_PLV_NET = 'https://api.polyv.net';
4
- PLVApiConstants.ELOG_PLV_NET = 'https://elog.polyv.net';
5
- PLVApiConstants.HTTPS_LIVEIMAGES_VIDEOCC_NET = 'https://liveimages.videocc.net';
6
- PLVApiConstants.RTAS_VIDEOCC_NET = 'https://rtas.videocc.net';
7
- PLVApiConstants.NGB_PUSH_URL = 'https://sdkoptedge.chinanetcenter.com';
@@ -1,8 +0,0 @@
1
- import PLVJSONUtils from '../../common/PLVJSONUtils';
2
- export class PLVHttpData {
3
- static fill(k14, l14) {
4
- if (l14) {
5
- PLVJSONUtils.httpData2Bean(k14, l14.data);
6
- }
7
- }
8
- }
@@ -1,13 +0,0 @@
1
- import { AxiosError } from '@ohos/axios';
2
- import PLVJSONUtils from '../../common/PLVJSONUtils';
3
- import PLVLogger from '../log/PLVLogger';
4
- export class PLVHttpError extends AxiosError {
5
- constructor(o14) {
6
- const p14 = (o14.response?.data && PLVJSONUtils.safeStringify(o14.response.data)) || o14.message;
7
- super(p14, o14.code, o14.config, o14.request, o14.response);
8
- }
9
- log(m14, n14) {
10
- PLVLogger.printError(m14, n14, this);
11
- return this;
12
- }
13
- }