assistsx-js 0.1.31 → 0.1.33

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.
@@ -51,6 +51,8 @@ export interface WebFloatingWindowOptions {
51
51
  showTopOperationArea?: boolean;
52
52
  /** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
53
53
  showBottomOperationArea?: boolean;
54
+ /** Background color: hex string (e.g. "#ffffff") or Android color int */
55
+ backgroundColor?: string | number;
54
56
  }
55
57
  export declare const callbacks: Map<string, (data: string) => void>;
56
58
  export declare const accessibilityEventListeners: AccessibilityEventListener[];
package/dist/AssistsX.js CHANGED
@@ -240,7 +240,7 @@ export class AssistsX {
240
240
  return data.value;
241
241
  }
242
242
  static async loadWebViewOverlay(url, options = {}) {
243
- const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, timeout, } = options;
243
+ const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, backgroundColor, timeout, } = options;
244
244
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
245
245
  args: {
246
246
  url,
@@ -255,6 +255,7 @@ export class AssistsX {
255
255
  initialCenter,
256
256
  showTopOperationArea,
257
257
  showBottomOperationArea,
258
+ backgroundColor,
258
259
  },
259
260
  timeout,
260
261
  });
@@ -151,6 +151,12 @@ export declare class AssistsXAsync {
151
151
  static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
152
152
  timeout?: number;
153
153
  }): Promise<any>;
154
+ /**
155
+ * 关闭当前 WebView 悬浮窗
156
+ * @param timeout 超时时间(秒),默认30秒
157
+ * @returns 是否关闭成功(当前页面在悬浮窗内时返回 true,否则 false)
158
+ */
159
+ static closeOverlay(timeout?: number): Promise<boolean>;
154
160
  /**
155
161
  * 点击节点
156
162
  * @param node 要点击的节点
@@ -203,7 +203,7 @@ export class AssistsXAsync {
203
203
  return data.value;
204
204
  }
205
205
  static async loadWebViewOverlay(url, options = {}) {
206
- const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, timeout, } = options;
206
+ const { initialWidth, initialHeight, initialX, initialY, minWidth, minHeight, maxWidth, maxHeight, initialCenter, showTopOperationArea, showBottomOperationArea, backgroundColor, timeout, } = options;
207
207
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
208
208
  args: {
209
209
  url,
@@ -218,12 +218,24 @@ export class AssistsXAsync {
218
218
  initialCenter,
219
219
  showTopOperationArea,
220
220
  showBottomOperationArea,
221
+ backgroundColor,
221
222
  },
222
223
  timeout,
223
224
  });
224
225
  const data = response.getDataOrDefault({});
225
226
  return data;
226
227
  }
228
+ /**
229
+ * 关闭当前 WebView 悬浮窗
230
+ * @param timeout 超时时间(秒),默认30秒
231
+ * @returns 是否关闭成功(当前页面在悬浮窗内时返回 true,否则 false)
232
+ */
233
+ static async closeOverlay(timeout) {
234
+ const response = await this.asyncCall(CallMethod.closeOverlay, {
235
+ timeout,
236
+ });
237
+ return response.getDataOrDefault(false);
238
+ }
227
239
  /**
228
240
  * 点击节点
229
241
  * @param node 要点击的节点
@@ -35,6 +35,7 @@ export declare const CallMethod: {
35
35
  readonly setOverlayFlags: "setOverlayFlags";
36
36
  readonly scanQR: "scanQR";
37
37
  readonly loadWebViewOverlay: "loadWebViewOverlay";
38
+ readonly closeOverlay: "closeOverlay";
38
39
  readonly recognizeTextInScreenshot: "recognizeTextInScreenshot";
39
40
  readonly clickByGesture: "clickByGesture";
40
41
  readonly clickNodeByGesture: "clickNodeByGesture";
@@ -36,6 +36,7 @@ export const CallMethod = {
36
36
  setOverlayFlags: "setOverlayFlags",
37
37
  scanQR: "scanQR",
38
38
  loadWebViewOverlay: "loadWebViewOverlay",
39
+ closeOverlay: "closeOverlay",
39
40
  recognizeTextInScreenshot: "recognizeTextInScreenshot",
40
41
  clickByGesture: "clickByGesture",
41
42
  clickNodeByGesture: "clickNodeByGesture",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -57,6 +57,8 @@ export interface WebFloatingWindowOptions {
57
57
  showTopOperationArea?: boolean;
58
58
  /** Whether to show bottom operation area (zoom, back/forward/refresh, etc.) */
59
59
  showBottomOperationArea?: boolean;
60
+ /** Background color: hex string (e.g. "#ffffff") or Android color int */
61
+ backgroundColor?: string | number;
60
62
  }
61
63
 
62
64
  // 回调函数存储对象
@@ -353,6 +355,7 @@ export class AssistsX {
353
355
  initialCenter,
354
356
  showTopOperationArea,
355
357
  showBottomOperationArea,
358
+ backgroundColor,
356
359
  timeout,
357
360
  } = options;
358
361
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
@@ -369,6 +372,7 @@ export class AssistsX {
369
372
  initialCenter,
370
373
  showTopOperationArea,
371
374
  showBottomOperationArea,
375
+ backgroundColor,
372
376
  },
373
377
  timeout,
374
378
  });
@@ -363,6 +363,7 @@ export class AssistsXAsync {
363
363
  initialCenter,
364
364
  showTopOperationArea,
365
365
  showBottomOperationArea,
366
+ backgroundColor,
366
367
  timeout,
367
368
  } = options;
368
369
  const response = await this.asyncCall(CallMethod.loadWebViewOverlay, {
@@ -379,6 +380,7 @@ export class AssistsXAsync {
379
380
  initialCenter,
380
381
  showTopOperationArea,
381
382
  showBottomOperationArea,
383
+ backgroundColor,
382
384
  },
383
385
  timeout,
384
386
  });
@@ -386,6 +388,18 @@ export class AssistsXAsync {
386
388
  return data;
387
389
  }
388
390
 
391
+ /**
392
+ * 关闭当前 WebView 悬浮窗
393
+ * @param timeout 超时时间(秒),默认30秒
394
+ * @returns 是否关闭成功(当前页面在悬浮窗内时返回 true,否则 false)
395
+ */
396
+ public static async closeOverlay(timeout?: number): Promise<boolean> {
397
+ const response = await this.asyncCall(CallMethod.closeOverlay, {
398
+ timeout,
399
+ });
400
+ return response.getDataOrDefault(false);
401
+ }
402
+
389
403
  /**
390
404
  * 点击节点
391
405
  * @param node 要点击的节点
package/src/CallMethod.ts CHANGED
@@ -36,6 +36,7 @@ export const CallMethod = {
36
36
  setOverlayFlags: "setOverlayFlags",
37
37
  scanQR: "scanQR",
38
38
  loadWebViewOverlay: "loadWebViewOverlay",
39
+ closeOverlay: "closeOverlay",
39
40
  recognizeTextInScreenshot: "recognizeTextInScreenshot",
40
41
 
41
42
  clickByGesture: "clickByGesture",