assistsx-js 0.0.1353 → 0.0.2002

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.
@@ -2,12 +2,13 @@
2
2
  * AssistsX 类
3
3
  * 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
4
4
  */
5
- import { Node } from './Node';
6
- import { Bounds } from './Bounds';
5
+ import { Node } from "./Node";
6
+ import { CallResponse } from "./CallResponse";
7
+ import { Bounds } from "./Bounds";
7
8
  /**
8
9
  * Web浮动窗口选项接口定义
9
10
  */
10
- interface WebFloatingWindowOptions {
11
+ export interface WebFloatingWindowOptions {
11
12
  initialWidth?: number;
12
13
  initialHeight?: number;
13
14
  minWidth?: number;
@@ -16,6 +17,10 @@ interface WebFloatingWindowOptions {
16
17
  maxHeight?: number;
17
18
  initialCenter?: boolean;
18
19
  }
20
+ export declare const callbacks: {
21
+ [key: string]: (data: any) => void;
22
+ };
23
+ export declare const accessibilityEventListeners: ((event: any) => void)[];
19
24
  export declare class AssistsX {
20
25
  /**
21
26
  * 执行同步调用
@@ -23,14 +28,21 @@ export declare class AssistsX {
23
28
  * @param args 参数对象
24
29
  * @returns 调用响应
25
30
  */
26
- private static call;
31
+ static call(method: string, { args, node }?: {
32
+ args?: any;
33
+ node?: Node;
34
+ }): CallResponse;
27
35
  /**
28
36
  * 执行异步调用
29
37
  * @param method 方法名
30
38
  * @param args 参数对象
31
39
  * @returns Promise<调用响应>
32
40
  */
33
- private static asyncCall;
41
+ static asyncCall(method: string, { args, node, nodes }?: {
42
+ args?: any;
43
+ node?: Node;
44
+ nodes?: Node[];
45
+ }): Promise<CallResponse>;
34
46
  /**
35
47
  * 设置悬浮窗标志
36
48
  * @param flags 标志
@@ -51,7 +63,7 @@ export declare class AssistsX {
51
63
  * @param filterText 文本过滤
52
64
  * @returns 节点数组
53
65
  */
54
- static getAllNodes({ filterClass, filterViewId, filterDes, filterText }?: {
66
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
55
67
  filterClass?: string;
56
68
  filterViewId?: string;
57
69
  filterDes?: string;
@@ -112,7 +124,7 @@ export declare class AssistsX {
112
124
  * @param node 父节点范围
113
125
  * @returns 节点数组
114
126
  */
115
- static findById(id: string, { filterClass, filterText, filterDes, node }?: {
127
+ static findById(id: string, { filterClass, filterText, filterDes, node, }?: {
116
128
  filterClass?: string;
117
129
  filterText?: string;
118
130
  filterDes?: string;
@@ -127,7 +139,7 @@ export declare class AssistsX {
127
139
  * @param node 父节点范围
128
140
  * @returns 节点数组
129
141
  */
130
- static findByText(text: string, { filterClass, filterViewId, filterDes, node }?: {
142
+ static findByText(text: string, { filterClass, filterViewId, filterDes, node, }?: {
131
143
  filterClass?: string;
132
144
  filterViewId?: string;
133
145
  filterDes?: string;
@@ -142,7 +154,7 @@ export declare class AssistsX {
142
154
  * @param node 父节点范围
143
155
  * @returns 节点数组
144
156
  */
145
- static findByTags(className: string, { filterText, filterViewId, filterDes, node }?: {
157
+ static findByTags(className: string, { filterText, filterViewId, filterDes, node, }?: {
146
158
  filterText?: string;
147
159
  filterViewId?: string;
148
160
  filterDes?: string;
@@ -170,7 +182,7 @@ export declare class AssistsX {
170
182
  * @param className 类名
171
183
  * @returns 父节点
172
184
  */
173
- static findFirstParentByTags(className: string): Node;
185
+ static findFirstParentByTags(node: Node, className: string): Node;
174
186
  /**
175
187
  * 获取节点的所有子节点
176
188
  * @param node 父节点
@@ -202,7 +214,7 @@ export declare class AssistsX {
202
214
  * @param isFullyByCompareNode 是否完全可见
203
215
  * @returns 是否可见
204
216
  */
205
- static isVisible(node: Node, { compareNode, isFullyByCompareNode }?: {
217
+ static isVisible(node: Node, { compareNode, isFullyByCompareNode, }?: {
206
218
  compareNode?: Node;
207
219
  isFullyByCompareNode?: boolean;
208
220
  }): boolean;
@@ -241,6 +253,7 @@ export declare class AssistsX {
241
253
  * @returns 是否成功
242
254
  */
243
255
  static paste(node: Node, text: string): boolean;
256
+ static focus(node: Node): boolean;
244
257
  /**
245
258
  * 选择文本
246
259
  * @param node 目标节点
@@ -270,7 +283,7 @@ export declare class AssistsX {
270
283
  * @param clickDuration 点击持续时间
271
284
  * @returns 是否成功
272
285
  */
273
- static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration }?: {
286
+ static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, }?: {
274
287
  offsetX?: number;
275
288
  offsetY?: number;
276
289
  switchWindowIntervalDelay?: number;
@@ -286,7 +299,7 @@ export declare class AssistsX {
286
299
  * @param clickInterval 点击间隔
287
300
  * @returns 是否成功
288
301
  */
289
- static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval }?: {
302
+ static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, }?: {
290
303
  offsetX?: number;
291
304
  offsetY?: number;
292
305
  switchWindowIntervalDelay?: number;
@@ -309,7 +322,7 @@ export declare class AssistsX {
309
322
  }, { duration }?: {
310
323
  duration?: number;
311
324
  }): Promise<boolean>;
312
- static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration }?: {
325
+ static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
313
326
  matchedPackageName?: string;
314
327
  matchedText?: string;
315
328
  timeoutMillis?: number;
@@ -318,7 +331,7 @@ export declare class AssistsX {
318
331
  static longPressGestureAutoPaste(point: {
319
332
  x: number;
320
333
  y: number;
321
- }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration }?: {
334
+ }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
322
335
  matchedPackageName?: string;
323
336
  matchedText?: string;
324
337
  timeoutMillis?: number;
@@ -360,4 +373,3 @@ export declare class AssistsX {
360
373
  */
361
374
  static getAccessibilityEventListenerCount(): number;
362
375
  }
363
- export {};
package/dist/AssistsX.js CHANGED
@@ -2,35 +2,42 @@
2
2
  * AssistsX 类
3
3
  * 提供与移动应用程序界面交互的工具类,包括节点查找、手势操作、屏幕操作等功能
4
4
  */
5
- import { Node } from './Node';
6
- import { CallMethod } from './CallMethod';
7
- import { CallResponse } from './CallResponse';
8
- import { Bounds } from './Bounds';
9
- import { generateUUID } from './Utils';
5
+ import { Node } from "./Node";
6
+ import { CallMethod } from "./CallMethod";
7
+ import { CallResponse } from "./CallResponse";
8
+ import { Bounds } from "./Bounds";
9
+ import { decodeBase64UTF8, generateUUID } from "./Utils";
10
10
  // 回调函数存储对象
11
- const callbacks = {};
11
+ export const callbacks = {};
12
12
  // 无障碍事件监听器存储
13
- const accessibilityEventListeners = [];
13
+ export const accessibilityEventListeners = [];
14
14
  // 初始化全局回调函数
15
- if (typeof window !== 'undefined' && !window.assistsxCallback) {
15
+ if (typeof window !== "undefined" && !window.assistsxCallback) {
16
16
  window.assistsxCallback = (data) => {
17
- const response = JSON.parse(data);
18
- const callback = callbacks[response.callbackId];
19
- if (callback) {
20
- callback(data);
17
+ try {
18
+ console.log(data);
19
+ const json = decodeBase64UTF8(data);
20
+ const response = JSON.parse(json);
21
+ const callback = callbacks[response.callbackId];
22
+ if (callback) {
23
+ callback(json);
24
+ }
25
+ }
26
+ catch (e) {
27
+ console.log(e);
21
28
  }
22
29
  };
23
30
  }
24
31
  // 初始化全局无障碍事件函数
25
- if (typeof window !== 'undefined' && !window.onAccessibilityEvent) {
32
+ if (typeof window !== "undefined" && !window.onAccessibilityEvent) {
26
33
  window.onAccessibilityEvent = (event) => {
27
34
  // 通知所有注册的监听器
28
- accessibilityEventListeners.forEach(listener => {
35
+ accessibilityEventListeners.forEach((listener) => {
29
36
  try {
30
37
  listener(event);
31
38
  }
32
39
  catch (error) {
33
- console.error('Accessibility event listener error:', error);
40
+ console.error("Accessibility event listener error:", error);
34
41
  }
35
42
  });
36
43
  };
@@ -49,12 +56,12 @@ export class AssistsX {
49
56
  node: node ? node : undefined,
50
57
  };
51
58
  const result = window.assistsx.call(JSON.stringify(params));
52
- if (typeof result === 'string') {
59
+ if (typeof result === "string") {
53
60
  const responseData = JSON.parse(result);
54
61
  const response = new CallResponse(responseData.code, responseData.data, responseData.callbackId);
55
62
  return response;
56
63
  }
57
- throw new Error('Call failed');
64
+ throw new Error("Call failed");
58
65
  }
59
66
  /**
60
67
  * 执行异步调用
@@ -81,12 +88,12 @@ export class AssistsX {
81
88
  });
82
89
  const result = window.assistsx.call(JSON.stringify(params));
83
90
  const promiseResult = await promise;
84
- if (typeof promiseResult === 'string') {
91
+ if (typeof promiseResult === "string") {
85
92
  const responseData = JSON.parse(promiseResult);
86
93
  const response = new CallResponse(responseData.code, responseData.data, responseData.callbackId);
87
94
  return response;
88
95
  }
89
- throw new Error('Call failed');
96
+ throw new Error("Call failed");
90
97
  }
91
98
  /**
92
99
  * 设置悬浮窗标志
@@ -94,7 +101,9 @@ export class AssistsX {
94
101
  * @returns 是否设置成功
95
102
  */
96
103
  static setOverlayFlags(flags) {
97
- const response = this.call(CallMethod.setOverlayFlags, { args: { flags: flags } });
104
+ const response = this.call(CallMethod.setOverlayFlags, {
105
+ args: { flags: flags },
106
+ });
98
107
  return response.getDataOrDefault(false);
99
108
  }
100
109
  /**
@@ -103,7 +112,9 @@ export class AssistsX {
103
112
  * @returns 是否设置成功
104
113
  */
105
114
  static setOverlayFlagList(flags) {
106
- const response = this.call(CallMethod.setOverlayFlags, { args: { flags: flags } });
115
+ const response = this.call(CallMethod.setOverlayFlags, {
116
+ args: { flags: flags },
117
+ });
107
118
  return response.getDataOrDefault(false);
108
119
  }
109
120
  /**
@@ -114,8 +125,10 @@ export class AssistsX {
114
125
  * @param filterText 文本过滤
115
126
  * @returns 节点数组
116
127
  */
117
- static getAllNodes({ filterClass, filterViewId, filterDes, filterText } = {}) {
118
- const response = this.call(CallMethod.getAllNodes, { args: { filterClass, filterViewId, filterDes, filterText } });
128
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, } = {}) {
129
+ const response = this.call(CallMethod.getAllNodes, {
130
+ args: { filterClass, filterViewId, filterDes, filterText },
131
+ });
119
132
  return Node.fromJSONArray(response.getDataOrDefault("[]"));
120
133
  }
121
134
  /**
@@ -125,7 +138,10 @@ export class AssistsX {
125
138
  * @returns 是否设置成功
126
139
  */
127
140
  static setNodeText(node, text) {
128
- const response = this.call(CallMethod.setNodeText, { args: { text }, node });
141
+ const response = this.call(CallMethod.setNodeText, {
142
+ args: { text },
143
+ node,
144
+ });
129
145
  return response.getDataOrDefault(false);
130
146
  }
131
147
  /**
@@ -135,7 +151,10 @@ export class AssistsX {
135
151
  * @returns 截图路径数组
136
152
  */
137
153
  static async takeScreenshotNodes(nodes, overlayHiddenScreenshotDelayMillis = 250) {
138
- const response = await this.asyncCall(CallMethod.takeScreenshot, { nodes, args: { overlayHiddenScreenshotDelayMillis } });
154
+ const response = await this.asyncCall(CallMethod.takeScreenshot, {
155
+ nodes,
156
+ args: { overlayHiddenScreenshotDelayMillis },
157
+ });
139
158
  const data = response.getDataOrDefault("");
140
159
  return data.images;
141
160
  }
@@ -145,8 +164,19 @@ export class AssistsX {
145
164
  return data.value;
146
165
  }
147
166
  static async loadWebViewOverlay(url, options = {}) {
148
- const { initialWidth, initialHeight, minWidth, minHeight, maxWidth, maxHeight, initialCenter } = options;
149
- const response = await this.asyncCall(CallMethod.loadWebViewOverlay, { args: { url, initialWidth, initialHeight, minWidth, minHeight, maxWidth, maxHeight, initialCenter } });
167
+ const { initialWidth, initialHeight, minWidth, minHeight, maxWidth, maxHeight, initialCenter, } = options;
168
+ const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
169
+ args: {
170
+ url,
171
+ initialWidth,
172
+ initialHeight,
173
+ minWidth,
174
+ minHeight,
175
+ maxWidth,
176
+ maxHeight,
177
+ initialCenter,
178
+ },
179
+ });
150
180
  const data = response.getDataOrDefault({});
151
181
  return data;
152
182
  }
@@ -192,7 +222,9 @@ export class AssistsX {
192
222
  * @returns 是否显示成功
193
223
  */
194
224
  static overlayToast(text, delay = 2000) {
195
- const response = this.call(CallMethod.overlayToast, { args: { text, delay } });
225
+ const response = this.call(CallMethod.overlayToast, {
226
+ args: { text, delay },
227
+ });
196
228
  return response.getDataOrDefault(false);
197
229
  }
198
230
  /**
@@ -204,8 +236,11 @@ export class AssistsX {
204
236
  * @param node 父节点范围
205
237
  * @returns 节点数组
206
238
  */
207
- static findById(id, { filterClass, filterText, filterDes, node } = {}) {
208
- const response = this.call(CallMethod.findById, { args: { id, filterClass, filterText, filterDes }, node });
239
+ static findById(id, { filterClass, filterText, filterDes, node, } = {}) {
240
+ const response = this.call(CallMethod.findById, {
241
+ args: { id, filterClass, filterText, filterDes },
242
+ node,
243
+ });
209
244
  return Node.fromJSONArray(response.getDataOrDefault("[]"));
210
245
  }
211
246
  /**
@@ -217,8 +252,11 @@ export class AssistsX {
217
252
  * @param node 父节点范围
218
253
  * @returns 节点数组
219
254
  */
220
- static findByText(text, { filterClass, filterViewId, filterDes, node } = {}) {
221
- const response = this.call(CallMethod.findByText, { args: { text, filterClass, filterViewId, filterDes }, node });
255
+ static findByText(text, { filterClass, filterViewId, filterDes, node, } = {}) {
256
+ const response = this.call(CallMethod.findByText, {
257
+ args: { text, filterClass, filterViewId, filterDes },
258
+ node,
259
+ });
222
260
  return Node.fromJSONArray(response.getDataOrDefault("[]"));
223
261
  }
224
262
  /**
@@ -230,8 +268,11 @@ export class AssistsX {
230
268
  * @param node 父节点范围
231
269
  * @returns 节点数组
232
270
  */
233
- static findByTags(className, { filterText, filterViewId, filterDes, node } = {}) {
234
- const response = this.call(CallMethod.findByTags, { args: { className, filterText, filterViewId, filterDes }, node });
271
+ static findByTags(className, { filterText, filterViewId, filterDes, node, } = {}) {
272
+ const response = this.call(CallMethod.findByTags, {
273
+ args: { className, filterText, filterViewId, filterDes },
274
+ node,
275
+ });
235
276
  return Node.fromJSONArray(response.getDataOrDefault("[]"));
236
277
  }
237
278
  /**
@@ -240,7 +281,9 @@ export class AssistsX {
240
281
  * @returns 节点数组
241
282
  */
242
283
  static findByTextAllMatch(text) {
243
- const response = this.call(CallMethod.findByTextAllMatch, { args: { text } });
284
+ const response = this.call(CallMethod.findByTextAllMatch, {
285
+ args: { text },
286
+ });
244
287
  return Node.fromJSONArray(response.getDataOrDefault("[]"));
245
288
  }
246
289
  /**
@@ -265,8 +308,11 @@ export class AssistsX {
265
308
  * @param className 类名
266
309
  * @returns 父节点
267
310
  */
268
- static findFirstParentByTags(className) {
269
- const response = this.call(CallMethod.findFirstParentByTags, { args: { className } });
311
+ static findFirstParentByTags(node, className) {
312
+ const response = this.call(CallMethod.findFirstParentByTags, {
313
+ args: { className },
314
+ node,
315
+ });
270
316
  return Node.create(response.getDataOrDefault("{}"));
271
317
  }
272
318
  /**
@@ -312,8 +358,11 @@ export class AssistsX {
312
358
  * @param isFullyByCompareNode 是否完全可见
313
359
  * @returns 是否可见
314
360
  */
315
- static isVisible(node, { compareNode, isFullyByCompareNode } = {}) {
316
- const response = this.call(CallMethod.isVisible, { node, args: { compareNode, isFullyByCompareNode } });
361
+ static isVisible(node, { compareNode, isFullyByCompareNode, } = {}) {
362
+ const response = this.call(CallMethod.isVisible, {
363
+ node,
364
+ args: { compareNode, isFullyByCompareNode },
365
+ });
317
366
  return response.getDataOrDefault(false);
318
367
  }
319
368
  /**
@@ -324,7 +373,9 @@ export class AssistsX {
324
373
  * @returns 是否成功
325
374
  */
326
375
  static async clickByGesture(x, y, duration) {
327
- const response = await this.asyncCall(CallMethod.clickByGesture, { args: { x, y, duration } });
376
+ const response = await this.asyncCall(CallMethod.clickByGesture, {
377
+ args: { x, y, duration },
378
+ });
328
379
  return response.getDataOrDefault(false);
329
380
  }
330
381
  /**
@@ -369,6 +420,10 @@ export class AssistsX {
369
420
  const response = this.call(CallMethod.paste, { args: { text }, node });
370
421
  return response.getDataOrDefault(false);
371
422
  }
423
+ static focus(node) {
424
+ const response = this.call(CallMethod.focus, { node });
425
+ return response.getDataOrDefault(false);
426
+ }
372
427
  /**
373
428
  * 选择文本
374
429
  * @param node 目标节点
@@ -377,7 +432,10 @@ export class AssistsX {
377
432
  * @returns 是否成功
378
433
  */
379
434
  static selectionText(node, selectionStart, selectionEnd) {
380
- const response = this.call(CallMethod.selectionText, { args: { selectionStart, selectionEnd }, node });
435
+ const response = this.call(CallMethod.selectionText, {
436
+ args: { selectionStart, selectionEnd },
437
+ node,
438
+ });
381
439
  return response.getDataOrDefault(false);
382
440
  }
383
441
  /**
@@ -407,8 +465,11 @@ export class AssistsX {
407
465
  * @param clickDuration 点击持续时间
408
466
  * @returns 是否成功
409
467
  */
410
- static async clickNodeByGesture(node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration } = {}) {
411
- const response = await this.asyncCall(CallMethod.clickNodeByGesture, { node, args: { offsetX, offsetY, switchWindowIntervalDelay, clickDuration } });
468
+ static async clickNodeByGesture(node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, } = {}) {
469
+ const response = await this.asyncCall(CallMethod.clickNodeByGesture, {
470
+ node,
471
+ args: { offsetX, offsetY, switchWindowIntervalDelay, clickDuration },
472
+ });
412
473
  return response.getDataOrDefault(false);
413
474
  }
414
475
  /**
@@ -421,8 +482,17 @@ export class AssistsX {
421
482
  * @param clickInterval 点击间隔
422
483
  * @returns 是否成功
423
484
  */
424
- static async doubleClickNodeByGesture(node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval } = {}) {
425
- const response = await this.asyncCall(CallMethod.doubleClickNodeByGesture, { node, args: { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval } });
485
+ static async doubleClickNodeByGesture(node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, } = {}) {
486
+ const response = await this.asyncCall(CallMethod.doubleClickNodeByGesture, {
487
+ node,
488
+ args: {
489
+ offsetX,
490
+ offsetY,
491
+ switchWindowIntervalDelay,
492
+ clickDuration,
493
+ clickInterval,
494
+ },
495
+ });
426
496
  return response.getDataOrDefault(false);
427
497
  }
428
498
  /**
@@ -433,19 +503,41 @@ export class AssistsX {
433
503
  * @returns
434
504
  */
435
505
  static async performLinearGesture(startPoint, endPoint, { duration } = {}) {
436
- const response = await this.asyncCall(CallMethod.performLinearGesture, { args: { startPoint, endPoint, duration } });
506
+ const response = await this.asyncCall(CallMethod.performLinearGesture, {
507
+ args: { startPoint, endPoint, duration },
508
+ });
437
509
  return response.getDataOrDefault(false);
438
510
  }
439
- static async longPressNodeByGestureAutoPaste(node, text, { matchedPackageName, matchedText, timeoutMillis, longPressDuration } = { matchedText: "粘贴", timeoutMillis: 1500, longPressDuration: 600 }) {
440
- const response = await this.asyncCall(CallMethod.longPressGestureAutoPaste, { node, args: { text, matchedPackageName, matchedText, timeoutMillis, longPressDuration } });
511
+ static async longPressNodeByGestureAutoPaste(node, text, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, } = { matchedText: "粘贴", timeoutMillis: 1500, longPressDuration: 600 }) {
512
+ const response = await this.asyncCall(CallMethod.longPressGestureAutoPaste, {
513
+ node,
514
+ args: {
515
+ text,
516
+ matchedPackageName,
517
+ matchedText,
518
+ timeoutMillis,
519
+ longPressDuration,
520
+ },
521
+ });
441
522
  return response.getDataOrDefault(false);
442
523
  }
443
- static async longPressGestureAutoPaste(point, text, { matchedPackageName, matchedText, timeoutMillis, longPressDuration } = { matchedText: "粘贴", timeoutMillis: 1500, longPressDuration: 600 }) {
444
- const response = await this.asyncCall(CallMethod.longPressGestureAutoPaste, { args: { point, text, matchedPackageName, matchedText, timeoutMillis, longPressDuration } });
524
+ static async longPressGestureAutoPaste(point, text, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, } = { matchedText: "粘贴", timeoutMillis: 1500, longPressDuration: 600 }) {
525
+ const response = await this.asyncCall(CallMethod.longPressGestureAutoPaste, {
526
+ args: {
527
+ point,
528
+ text,
529
+ matchedPackageName,
530
+ matchedText,
531
+ timeoutMillis,
532
+ longPressDuration,
533
+ },
534
+ });
445
535
  return response.getDataOrDefault(false);
446
536
  }
447
537
  static async getAppInfo(packageName) {
448
- const response = await this.asyncCall(CallMethod.getAppInfo, { args: { packageName } });
538
+ const response = await this.asyncCall(CallMethod.getAppInfo, {
539
+ args: { packageName },
540
+ });
449
541
  return response.getDataOrDefault({});
450
542
  }
451
543
  static getUniqueDeviceId() {
@@ -488,7 +580,7 @@ export class AssistsX {
488
580
  listener(event);
489
581
  }
490
582
  catch (error) {
491
- console.error('Accessibility event listener error:', error);
583
+ console.error("Accessibility event listener error:", error);
492
584
  }
493
585
  };
494
586
  // 将监听器包装并存储,使用ID作为键