assistsx-js 0.0.2027 → 0.0.2028

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.
@@ -0,0 +1,45 @@
1
+ /**
2
+ * 应用信息实体类
3
+ */
4
+ export declare class AppInfo {
5
+ /**
6
+ * 是否为系统应用
7
+ */
8
+ isSystem: boolean;
9
+ /**
10
+ * 最低SDK版本
11
+ */
12
+ minSdkVersion: number;
13
+ /**
14
+ * 应用名称
15
+ */
16
+ name: string;
17
+ /**
18
+ * 应用包名
19
+ */
20
+ packageName: string;
21
+ /**
22
+ * 目标SDK版本
23
+ */
24
+ targetSdkVersion: number;
25
+ /**
26
+ * 版本号
27
+ */
28
+ versionCode: number;
29
+ /**
30
+ * 版本名称
31
+ */
32
+ versionName: string;
33
+ constructor(isSystem?: boolean, minSdkVersion?: number, name?: string, packageName?: string, targetSdkVersion?: number, versionCode?: number, versionName?: string);
34
+ /**
35
+ * 从JSON对象创建AppInfo实例
36
+ * @param data JSON对象
37
+ * @returns AppInfo实例
38
+ */
39
+ static fromJSON(data: any): AppInfo;
40
+ /**
41
+ * 转换为JSON对象
42
+ * @returns JSON对象
43
+ */
44
+ toJSON(): any;
45
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 应用信息实体类
3
+ */
4
+ export class AppInfo {
5
+ constructor(isSystem = false, minSdkVersion = 0, name = "", packageName = "", targetSdkVersion = 0, versionCode = 0, versionName = "") {
6
+ this.isSystem = isSystem;
7
+ this.minSdkVersion = minSdkVersion;
8
+ this.name = name;
9
+ this.packageName = packageName;
10
+ this.targetSdkVersion = targetSdkVersion;
11
+ this.versionCode = versionCode;
12
+ this.versionName = versionName;
13
+ }
14
+ /**
15
+ * 从JSON对象创建AppInfo实例
16
+ * @param data JSON对象
17
+ * @returns AppInfo实例
18
+ */
19
+ static fromJSON(data) {
20
+ var _a, _b, _c, _d, _e, _f, _g;
21
+ return new AppInfo((_a = data.isSystem) !== null && _a !== void 0 ? _a : false, (_b = data.minSdkVersion) !== null && _b !== void 0 ? _b : 0, (_c = data.name) !== null && _c !== void 0 ? _c : "", (_d = data.packageName) !== null && _d !== void 0 ? _d : "", (_e = data.targetSdkVersion) !== null && _e !== void 0 ? _e : 0, (_f = data.versionCode) !== null && _f !== void 0 ? _f : 0, (_g = data.versionName) !== null && _g !== void 0 ? _g : "");
22
+ }
23
+ /**
24
+ * 转换为JSON对象
25
+ * @returns JSON对象
26
+ */
27
+ toJSON() {
28
+ return {
29
+ isSystem: this.isSystem,
30
+ minSdkVersion: this.minSdkVersion,
31
+ name: this.name,
32
+ packageName: this.packageName,
33
+ targetSdkVersion: this.targetSdkVersion,
34
+ versionCode: this.versionCode,
35
+ versionName: this.versionName,
36
+ };
37
+ }
38
+ }
@@ -6,6 +6,7 @@ import { Node } from "./Node";
6
6
  import { CallResponse } from "./CallResponse";
7
7
  import { Bounds } from "./Bounds";
8
8
  import { AccessibilityEventFilter } from "AccessibilityEventFilter";
9
+ import { AppInfo } from "./AppInfo";
9
10
  /**
10
11
  * 无障碍事件数据结构
11
12
  */
@@ -399,7 +400,7 @@ export declare class AssistsX {
399
400
  longPressDuration?: number;
400
401
  timeout?: number;
401
402
  }): Promise<boolean>;
402
- static getAppInfo(packageName: string, timeout?: number): Promise<any>;
403
+ static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
403
404
  static getUniqueDeviceId(): any;
404
405
  static getAndroidID(): any;
405
406
  static getMacAddress(timeout?: number): Promise<any>;
package/dist/AssistsX.js CHANGED
@@ -7,6 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { decodeBase64UTF8, generateUUID } from "./Utils";
10
+ import { AppInfo } from "./AppInfo";
10
11
  // 回调函数存储对象
11
12
  export const callbacks = new Map();
12
13
  // 无障碍事件监听器存储
@@ -581,7 +582,7 @@ export class AssistsX {
581
582
  args: { packageName },
582
583
  timeout,
583
584
  });
584
- return response.getDataOrDefault({});
585
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
585
586
  }
586
587
  static getUniqueDeviceId() {
587
588
  const response = this.call(CallMethod.getUniqueDeviceId);
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { Node } from "./Node";
6
6
  import { Bounds } from "./Bounds";
7
+ import { AppInfo } from "./AppInfo";
7
8
  import { WebFloatingWindowOptions } from "./AssistsX";
8
9
  export declare class AssistsXAsync {
9
10
  /**
@@ -354,7 +355,7 @@ export declare class AssistsXAsync {
354
355
  longPressDuration?: number;
355
356
  timeout?: number;
356
357
  }): Promise<boolean>;
357
- static getAppInfo(packageName: string, timeout?: number): Promise<any>;
358
+ static getAppInfo(packageName: string, timeout?: number): Promise<AppInfo>;
358
359
  static getUniqueDeviceId(timeout?: number): Promise<any>;
359
360
  static getAndroidID(timeout?: number): Promise<any>;
360
361
  static getMacAddress(timeout?: number): Promise<any>;
@@ -7,6 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { generateUUID } from "./Utils";
10
+ import { AppInfo } from "./AppInfo";
10
11
  import { callbacks, } from "./AssistsX";
11
12
  export class AssistsXAsync {
12
13
  /**
@@ -577,7 +578,7 @@ export class AssistsXAsync {
577
578
  args: { packageName },
578
579
  timeout,
579
580
  });
580
- return response.getDataOrDefault({});
581
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
581
582
  }
582
583
  static async getUniqueDeviceId(timeout) {
583
584
  const response = await this.asyncCall(CallMethod.getUniqueDeviceId, {
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./NodeAsync";
12
12
  export * from "./AssistsXAsync";
13
13
  export * from "./StepAsync";
14
14
  export * from "./AccessibilityEventFilter";
15
+ export * from "./AppInfo";
package/dist/index.js CHANGED
@@ -12,3 +12,4 @@ export * from "./NodeAsync";
12
12
  export * from "./AssistsXAsync";
13
13
  export * from "./StepAsync";
14
14
  export * from "./AccessibilityEventFilter";
15
+ export * from "./AppInfo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2027",
3
+ "version": "0.0.2028",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AppInfo.ts ADDED
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 应用信息实体类
3
+ */
4
+ export class AppInfo {
5
+ /**
6
+ * 是否为系统应用
7
+ */
8
+ isSystem: boolean;
9
+
10
+ /**
11
+ * 最低SDK版本
12
+ */
13
+ minSdkVersion: number;
14
+
15
+ /**
16
+ * 应用名称
17
+ */
18
+ name: string;
19
+
20
+ /**
21
+ * 应用包名
22
+ */
23
+ packageName: string;
24
+
25
+ /**
26
+ * 目标SDK版本
27
+ */
28
+ targetSdkVersion: number;
29
+
30
+ /**
31
+ * 版本号
32
+ */
33
+ versionCode: number;
34
+
35
+ /**
36
+ * 版本名称
37
+ */
38
+ versionName: string;
39
+
40
+ constructor(
41
+ isSystem: boolean = false,
42
+ minSdkVersion: number = 0,
43
+ name: string = "",
44
+ packageName: string = "",
45
+ targetSdkVersion: number = 0,
46
+ versionCode: number = 0,
47
+ versionName: string = ""
48
+ ) {
49
+ this.isSystem = isSystem;
50
+ this.minSdkVersion = minSdkVersion;
51
+ this.name = name;
52
+ this.packageName = packageName;
53
+ this.targetSdkVersion = targetSdkVersion;
54
+ this.versionCode = versionCode;
55
+ this.versionName = versionName;
56
+ }
57
+
58
+ /**
59
+ * 从JSON对象创建AppInfo实例
60
+ * @param data JSON对象
61
+ * @returns AppInfo实例
62
+ */
63
+ static fromJSON(data: any): AppInfo {
64
+ return new AppInfo(
65
+ data.isSystem ?? false,
66
+ data.minSdkVersion ?? 0,
67
+ data.name ?? "",
68
+ data.packageName ?? "",
69
+ data.targetSdkVersion ?? 0,
70
+ data.versionCode ?? 0,
71
+ data.versionName ?? ""
72
+ );
73
+ }
74
+
75
+ /**
76
+ * 转换为JSON对象
77
+ * @returns JSON对象
78
+ */
79
+ toJSON(): any {
80
+ return {
81
+ isSystem: this.isSystem,
82
+ minSdkVersion: this.minSdkVersion,
83
+ name: this.name,
84
+ packageName: this.packageName,
85
+ targetSdkVersion: this.targetSdkVersion,
86
+ versionCode: this.versionCode,
87
+ versionName: this.versionName,
88
+ };
89
+ }
90
+ }
package/src/AssistsX.ts CHANGED
@@ -8,6 +8,7 @@ import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { decodeBase64UTF8, generateUUID } from "./Utils";
10
10
  import { AccessibilityEventFilter } from "AccessibilityEventFilter";
11
+ import { AppInfo } from "./AppInfo";
11
12
 
12
13
  /**
13
14
  * 无障碍事件数据结构
@@ -850,12 +851,12 @@ export class AssistsX {
850
851
  public static async getAppInfo(
851
852
  packageName: string,
852
853
  timeout?: number
853
- ): Promise<any> {
854
+ ): Promise<AppInfo> {
854
855
  const response = await this.asyncCall(CallMethod.getAppInfo, {
855
856
  args: { packageName },
856
857
  timeout,
857
858
  });
858
- return response.getDataOrDefault({});
859
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
859
860
  }
860
861
  public static getUniqueDeviceId(): any {
861
862
  const response = this.call(CallMethod.getUniqueDeviceId);
@@ -7,6 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { generateUUID } from "./Utils";
10
+ import { AppInfo } from "./AppInfo";
10
11
  import {
11
12
  AssistsX,
12
13
  callbacks,
@@ -843,12 +844,12 @@ export class AssistsXAsync {
843
844
  public static async getAppInfo(
844
845
  packageName: string,
845
846
  timeout?: number
846
- ): Promise<any> {
847
+ ): Promise<AppInfo> {
847
848
  const response = await this.asyncCall(CallMethod.getAppInfo, {
848
849
  args: { packageName },
849
850
  timeout,
850
851
  });
851
- return response.getDataOrDefault({});
852
+ return AppInfo.fromJSON(response.getDataOrDefault({}));
852
853
  }
853
854
  public static async getUniqueDeviceId(timeout?: number): Promise<any> {
854
855
  const response = await this.asyncCall(CallMethod.getUniqueDeviceId, {
package/src/index.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./NodeAsync";
12
12
  export * from "./AssistsXAsync";
13
13
  export * from "./StepAsync";
14
14
  export * from "./AccessibilityEventFilter";
15
+ export * from "./AppInfo";