assistsx-js 0.0.2028 → 0.0.2029
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.
- package/dist/AssistsX.d.ts +2 -1
- package/dist/AssistsX.js +2 -1
- package/dist/AssistsXAsync.d.ts +2 -1
- package/dist/AssistsXAsync.js +2 -1
- package/dist/DeviceInfo.d.ts +69 -0
- package/dist/DeviceInfo.js +50 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/src/AssistsX.ts +3 -2
- package/src/AssistsXAsync.ts +3 -2
- package/src/DeviceInfo.ts +144 -0
- package/src/index.ts +1 -0
package/dist/AssistsX.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { CallResponse } from "./CallResponse";
|
|
|
7
7
|
import { Bounds } from "./Bounds";
|
|
8
8
|
import { AccessibilityEventFilter } from "AccessibilityEventFilter";
|
|
9
9
|
import { AppInfo } from "./AppInfo";
|
|
10
|
+
import { DeviceInfo } from "./DeviceInfo";
|
|
10
11
|
/**
|
|
11
12
|
* 无障碍事件数据结构
|
|
12
13
|
*/
|
|
@@ -404,7 +405,7 @@ export declare class AssistsX {
|
|
|
404
405
|
static getUniqueDeviceId(): any;
|
|
405
406
|
static getAndroidID(): any;
|
|
406
407
|
static getMacAddress(timeout?: number): Promise<any>;
|
|
407
|
-
static getDeviceInfo(timeout?: number): Promise<
|
|
408
|
+
static getDeviceInfo(timeout?: number): Promise<DeviceInfo>;
|
|
408
409
|
static getNetworkType(timeout?: number): Promise<any>;
|
|
409
410
|
static setAccessibilityEventFilters(value: AccessibilityEventFilter[]): Promise<any>;
|
|
410
411
|
static addAccessibilityEventFilter(value: AccessibilityEventFilter): Promise<any>;
|
package/dist/AssistsX.js
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 { AppInfo } from "./AppInfo";
|
|
11
|
+
import { DeviceInfo } from "./DeviceInfo";
|
|
11
12
|
// 回调函数存储对象
|
|
12
13
|
export const callbacks = new Map();
|
|
13
14
|
// 无障碍事件监听器存储
|
|
@@ -602,7 +603,7 @@ export class AssistsX {
|
|
|
602
603
|
const response = await this.asyncCall(CallMethod.getDeviceInfo, {
|
|
603
604
|
timeout,
|
|
604
605
|
});
|
|
605
|
-
return response.getDataOrDefault({});
|
|
606
|
+
return DeviceInfo.fromJSON(response.getDataOrDefault({}));
|
|
606
607
|
}
|
|
607
608
|
static async getNetworkType(timeout) {
|
|
608
609
|
const response = await this.asyncCall(CallMethod.getNetworkType, {
|
package/dist/AssistsXAsync.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Node } from "./Node";
|
|
6
6
|
import { Bounds } from "./Bounds";
|
|
7
7
|
import { AppInfo } from "./AppInfo";
|
|
8
|
+
import { DeviceInfo } from "./DeviceInfo";
|
|
8
9
|
import { WebFloatingWindowOptions } from "./AssistsX";
|
|
9
10
|
export declare class AssistsXAsync {
|
|
10
11
|
/**
|
|
@@ -359,7 +360,7 @@ export declare class AssistsXAsync {
|
|
|
359
360
|
static getUniqueDeviceId(timeout?: number): Promise<any>;
|
|
360
361
|
static getAndroidID(timeout?: number): Promise<any>;
|
|
361
362
|
static getMacAddress(timeout?: number): Promise<any>;
|
|
362
|
-
static getDeviceInfo(timeout?: number): Promise<
|
|
363
|
+
static getDeviceInfo(timeout?: number): Promise<DeviceInfo>;
|
|
363
364
|
/**
|
|
364
365
|
* 获取屏幕尺寸
|
|
365
366
|
* @param timeout 超时时间(秒),默认30秒
|
package/dist/AssistsXAsync.js
CHANGED
|
@@ -8,6 +8,7 @@ import { CallResponse } from "./CallResponse";
|
|
|
8
8
|
import { Bounds } from "./Bounds";
|
|
9
9
|
import { generateUUID } from "./Utils";
|
|
10
10
|
import { AppInfo } from "./AppInfo";
|
|
11
|
+
import { DeviceInfo } from "./DeviceInfo";
|
|
11
12
|
import { callbacks, } from "./AssistsX";
|
|
12
13
|
export class AssistsXAsync {
|
|
13
14
|
/**
|
|
@@ -600,7 +601,7 @@ export class AssistsXAsync {
|
|
|
600
601
|
const response = await this.asyncCall(CallMethod.getDeviceInfo, {
|
|
601
602
|
timeout,
|
|
602
603
|
});
|
|
603
|
-
return response.getDataOrDefault({});
|
|
604
|
+
return DeviceInfo.fromJSON(response.getDataOrDefault({}));
|
|
604
605
|
}
|
|
605
606
|
/**
|
|
606
607
|
* 获取屏幕尺寸
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设备信息实体类
|
|
3
|
+
*/
|
|
4
|
+
export declare class DeviceInfo {
|
|
5
|
+
/**
|
|
6
|
+
* 设备唯一标识
|
|
7
|
+
*/
|
|
8
|
+
uniqueDeviceId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Android ID
|
|
11
|
+
*/
|
|
12
|
+
androidID: string;
|
|
13
|
+
/**
|
|
14
|
+
* MAC地址
|
|
15
|
+
*/
|
|
16
|
+
macAddress: string;
|
|
17
|
+
/**
|
|
18
|
+
* 是否已Root
|
|
19
|
+
*/
|
|
20
|
+
isDeviceRooted: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 制造商
|
|
23
|
+
*/
|
|
24
|
+
manufacturer: string;
|
|
25
|
+
/**
|
|
26
|
+
* 设备型号
|
|
27
|
+
*/
|
|
28
|
+
model: string;
|
|
29
|
+
/**
|
|
30
|
+
* SDK版本号
|
|
31
|
+
*/
|
|
32
|
+
sdkVersionCode: number;
|
|
33
|
+
/**
|
|
34
|
+
* SDK版本名称
|
|
35
|
+
*/
|
|
36
|
+
sdkVersionName: string;
|
|
37
|
+
/**
|
|
38
|
+
* ABI列表
|
|
39
|
+
*/
|
|
40
|
+
abiList: string[];
|
|
41
|
+
/**
|
|
42
|
+
* 是否启用ADB调试
|
|
43
|
+
*/
|
|
44
|
+
isAdbEnabled: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 是否启用开发者选项
|
|
47
|
+
*/
|
|
48
|
+
isDevelopmentSettingsEnabled: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 是否为模拟器
|
|
51
|
+
*/
|
|
52
|
+
isEmulator: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* 是否为平板
|
|
55
|
+
*/
|
|
56
|
+
isTablet: boolean;
|
|
57
|
+
constructor(uniqueDeviceId?: string, androidID?: string, macAddress?: string, isDeviceRooted?: boolean, manufacturer?: string, model?: string, sdkVersionCode?: number, sdkVersionName?: string, abiList?: string[], isAdbEnabled?: boolean, isDevelopmentSettingsEnabled?: boolean, isEmulator?: boolean, isTablet?: boolean);
|
|
58
|
+
/**
|
|
59
|
+
* 从JSON对象创建DeviceInfo实例
|
|
60
|
+
* @param data JSON对象
|
|
61
|
+
* @returns DeviceInfo实例
|
|
62
|
+
*/
|
|
63
|
+
static fromJSON(data: any): DeviceInfo;
|
|
64
|
+
/**
|
|
65
|
+
* 转换为JSON对象
|
|
66
|
+
* @returns JSON对象
|
|
67
|
+
*/
|
|
68
|
+
toJSON(): any;
|
|
69
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设备信息实体类
|
|
3
|
+
*/
|
|
4
|
+
export class DeviceInfo {
|
|
5
|
+
constructor(uniqueDeviceId = "", androidID = "", macAddress = "", isDeviceRooted = false, manufacturer = "", model = "", sdkVersionCode = 0, sdkVersionName = "", abiList = [], isAdbEnabled = false, isDevelopmentSettingsEnabled = false, isEmulator = false, isTablet = false) {
|
|
6
|
+
this.uniqueDeviceId = uniqueDeviceId;
|
|
7
|
+
this.androidID = androidID;
|
|
8
|
+
this.macAddress = macAddress;
|
|
9
|
+
this.isDeviceRooted = isDeviceRooted;
|
|
10
|
+
this.manufacturer = manufacturer;
|
|
11
|
+
this.model = model;
|
|
12
|
+
this.sdkVersionCode = sdkVersionCode;
|
|
13
|
+
this.sdkVersionName = sdkVersionName;
|
|
14
|
+
this.abiList = abiList;
|
|
15
|
+
this.isAdbEnabled = isAdbEnabled;
|
|
16
|
+
this.isDevelopmentSettingsEnabled = isDevelopmentSettingsEnabled;
|
|
17
|
+
this.isEmulator = isEmulator;
|
|
18
|
+
this.isTablet = isTablet;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 从JSON对象创建DeviceInfo实例
|
|
22
|
+
* @param data JSON对象
|
|
23
|
+
* @returns DeviceInfo实例
|
|
24
|
+
*/
|
|
25
|
+
static fromJSON(data) {
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
27
|
+
return new DeviceInfo((_a = data.uniqueDeviceId) !== null && _a !== void 0 ? _a : "", (_b = data.androidID) !== null && _b !== void 0 ? _b : "", (_c = data.macAddress) !== null && _c !== void 0 ? _c : "", (_d = data.isDeviceRooted) !== null && _d !== void 0 ? _d : false, (_e = data.manufacturer) !== null && _e !== void 0 ? _e : "", (_f = data.model) !== null && _f !== void 0 ? _f : "", (_g = data.sdkVersionCode) !== null && _g !== void 0 ? _g : 0, (_h = data.sdkVersionName) !== null && _h !== void 0 ? _h : "", (_j = data.abiList) !== null && _j !== void 0 ? _j : [], (_k = data.isAdbEnabled) !== null && _k !== void 0 ? _k : false, (_l = data.isDevelopmentSettingsEnabled) !== null && _l !== void 0 ? _l : false, (_m = data.isEmulator) !== null && _m !== void 0 ? _m : false, (_o = data.isTablet) !== null && _o !== void 0 ? _o : false);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 转换为JSON对象
|
|
31
|
+
* @returns JSON对象
|
|
32
|
+
*/
|
|
33
|
+
toJSON() {
|
|
34
|
+
return {
|
|
35
|
+
uniqueDeviceId: this.uniqueDeviceId,
|
|
36
|
+
androidID: this.androidID,
|
|
37
|
+
macAddress: this.macAddress,
|
|
38
|
+
isDeviceRooted: this.isDeviceRooted,
|
|
39
|
+
manufacturer: this.manufacturer,
|
|
40
|
+
model: this.model,
|
|
41
|
+
sdkVersionCode: this.sdkVersionCode,
|
|
42
|
+
sdkVersionName: this.sdkVersionName,
|
|
43
|
+
abiList: this.abiList,
|
|
44
|
+
isAdbEnabled: this.isAdbEnabled,
|
|
45
|
+
isDevelopmentSettingsEnabled: this.isDevelopmentSettingsEnabled,
|
|
46
|
+
isEmulator: this.isEmulator,
|
|
47
|
+
isTablet: this.isTablet,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/src/AssistsX.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Bounds } from "./Bounds";
|
|
|
9
9
|
import { decodeBase64UTF8, generateUUID } from "./Utils";
|
|
10
10
|
import { AccessibilityEventFilter } from "AccessibilityEventFilter";
|
|
11
11
|
import { AppInfo } from "./AppInfo";
|
|
12
|
+
import { DeviceInfo } from "./DeviceInfo";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* 无障碍事件数据结构
|
|
@@ -872,11 +873,11 @@ export class AssistsX {
|
|
|
872
873
|
});
|
|
873
874
|
return response.getDataOrDefault({});
|
|
874
875
|
}
|
|
875
|
-
public static async getDeviceInfo(timeout?: number): Promise<
|
|
876
|
+
public static async getDeviceInfo(timeout?: number): Promise<DeviceInfo> {
|
|
876
877
|
const response = await this.asyncCall(CallMethod.getDeviceInfo, {
|
|
877
878
|
timeout,
|
|
878
879
|
});
|
|
879
|
-
return response.getDataOrDefault({});
|
|
880
|
+
return DeviceInfo.fromJSON(response.getDataOrDefault({}));
|
|
880
881
|
}
|
|
881
882
|
public static async getNetworkType(timeout?: number): Promise<any> {
|
|
882
883
|
const response = await this.asyncCall(CallMethod.getNetworkType, {
|
package/src/AssistsXAsync.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { CallResponse } from "./CallResponse";
|
|
|
8
8
|
import { Bounds } from "./Bounds";
|
|
9
9
|
import { generateUUID } from "./Utils";
|
|
10
10
|
import { AppInfo } from "./AppInfo";
|
|
11
|
+
import { DeviceInfo } from "./DeviceInfo";
|
|
11
12
|
import {
|
|
12
13
|
AssistsX,
|
|
13
14
|
callbacks,
|
|
@@ -867,11 +868,11 @@ export class AssistsXAsync {
|
|
|
867
868
|
});
|
|
868
869
|
return response.getDataOrDefault({});
|
|
869
870
|
}
|
|
870
|
-
public static async getDeviceInfo(timeout?: number): Promise<
|
|
871
|
+
public static async getDeviceInfo(timeout?: number): Promise<DeviceInfo> {
|
|
871
872
|
const response = await this.asyncCall(CallMethod.getDeviceInfo, {
|
|
872
873
|
timeout,
|
|
873
874
|
});
|
|
874
|
-
return response.getDataOrDefault({});
|
|
875
|
+
return DeviceInfo.fromJSON(response.getDataOrDefault({}));
|
|
875
876
|
}
|
|
876
877
|
|
|
877
878
|
/**
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设备信息实体类
|
|
3
|
+
*/
|
|
4
|
+
export class DeviceInfo {
|
|
5
|
+
/**
|
|
6
|
+
* 设备唯一标识
|
|
7
|
+
*/
|
|
8
|
+
uniqueDeviceId: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Android ID
|
|
12
|
+
*/
|
|
13
|
+
androidID: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* MAC地址
|
|
17
|
+
*/
|
|
18
|
+
macAddress: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 是否已Root
|
|
22
|
+
*/
|
|
23
|
+
isDeviceRooted: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 制造商
|
|
27
|
+
*/
|
|
28
|
+
manufacturer: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 设备型号
|
|
32
|
+
*/
|
|
33
|
+
model: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* SDK版本号
|
|
37
|
+
*/
|
|
38
|
+
sdkVersionCode: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* SDK版本名称
|
|
42
|
+
*/
|
|
43
|
+
sdkVersionName: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* ABI列表
|
|
47
|
+
*/
|
|
48
|
+
abiList: string[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 是否启用ADB调试
|
|
52
|
+
*/
|
|
53
|
+
isAdbEnabled: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 是否启用开发者选项
|
|
57
|
+
*/
|
|
58
|
+
isDevelopmentSettingsEnabled: boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 是否为模拟器
|
|
62
|
+
*/
|
|
63
|
+
isEmulator: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 是否为平板
|
|
67
|
+
*/
|
|
68
|
+
isTablet: boolean;
|
|
69
|
+
|
|
70
|
+
constructor(
|
|
71
|
+
uniqueDeviceId: string = "",
|
|
72
|
+
androidID: string = "",
|
|
73
|
+
macAddress: string = "",
|
|
74
|
+
isDeviceRooted: boolean = false,
|
|
75
|
+
manufacturer: string = "",
|
|
76
|
+
model: string = "",
|
|
77
|
+
sdkVersionCode: number = 0,
|
|
78
|
+
sdkVersionName: string = "",
|
|
79
|
+
abiList: string[] = [],
|
|
80
|
+
isAdbEnabled: boolean = false,
|
|
81
|
+
isDevelopmentSettingsEnabled: boolean = false,
|
|
82
|
+
isEmulator: boolean = false,
|
|
83
|
+
isTablet: boolean = false
|
|
84
|
+
) {
|
|
85
|
+
this.uniqueDeviceId = uniqueDeviceId;
|
|
86
|
+
this.androidID = androidID;
|
|
87
|
+
this.macAddress = macAddress;
|
|
88
|
+
this.isDeviceRooted = isDeviceRooted;
|
|
89
|
+
this.manufacturer = manufacturer;
|
|
90
|
+
this.model = model;
|
|
91
|
+
this.sdkVersionCode = sdkVersionCode;
|
|
92
|
+
this.sdkVersionName = sdkVersionName;
|
|
93
|
+
this.abiList = abiList;
|
|
94
|
+
this.isAdbEnabled = isAdbEnabled;
|
|
95
|
+
this.isDevelopmentSettingsEnabled = isDevelopmentSettingsEnabled;
|
|
96
|
+
this.isEmulator = isEmulator;
|
|
97
|
+
this.isTablet = isTablet;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 从JSON对象创建DeviceInfo实例
|
|
102
|
+
* @param data JSON对象
|
|
103
|
+
* @returns DeviceInfo实例
|
|
104
|
+
*/
|
|
105
|
+
static fromJSON(data: any): DeviceInfo {
|
|
106
|
+
return new DeviceInfo(
|
|
107
|
+
data.uniqueDeviceId ?? "",
|
|
108
|
+
data.androidID ?? "",
|
|
109
|
+
data.macAddress ?? "",
|
|
110
|
+
data.isDeviceRooted ?? false,
|
|
111
|
+
data.manufacturer ?? "",
|
|
112
|
+
data.model ?? "",
|
|
113
|
+
data.sdkVersionCode ?? 0,
|
|
114
|
+
data.sdkVersionName ?? "",
|
|
115
|
+
data.abiList ?? [],
|
|
116
|
+
data.isAdbEnabled ?? false,
|
|
117
|
+
data.isDevelopmentSettingsEnabled ?? false,
|
|
118
|
+
data.isEmulator ?? false,
|
|
119
|
+
data.isTablet ?? false
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 转换为JSON对象
|
|
125
|
+
* @returns JSON对象
|
|
126
|
+
*/
|
|
127
|
+
toJSON(): any {
|
|
128
|
+
return {
|
|
129
|
+
uniqueDeviceId: this.uniqueDeviceId,
|
|
130
|
+
androidID: this.androidID,
|
|
131
|
+
macAddress: this.macAddress,
|
|
132
|
+
isDeviceRooted: this.isDeviceRooted,
|
|
133
|
+
manufacturer: this.manufacturer,
|
|
134
|
+
model: this.model,
|
|
135
|
+
sdkVersionCode: this.sdkVersionCode,
|
|
136
|
+
sdkVersionName: this.sdkVersionName,
|
|
137
|
+
abiList: this.abiList,
|
|
138
|
+
isAdbEnabled: this.isAdbEnabled,
|
|
139
|
+
isDevelopmentSettingsEnabled: this.isDevelopmentSettingsEnabled,
|
|
140
|
+
isEmulator: this.isEmulator,
|
|
141
|
+
isTablet: this.isTablet,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}
|
package/src/index.ts
CHANGED