hunter-open-sdk 2.0.0-beta.31 → 2.0.0-beta.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.
- package/lib/abilities/eventManager/index.js +47 -58
- package/lib/abilities/getAndroidReport/index.js +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/resources/dll/{libinspectionkit_x64_0.6.1.dll → libinspectionkit_x64_0.7.2.dll} +0 -0
- package/lib/resources/dylib/{libinspectionkit_arm64_0.6.1.dylib → libinspectionkit_arm64_0.7.2.dylib} +0 -0
- package/lib/resources/version.online +1 -1
- package/package.json +2 -3
- package/lib/resources/dylib/libinspectionkit_amd64_0.6.1.dylib +0 -0
|
@@ -43,65 +43,55 @@ const getResourcePath = () => {
|
|
|
43
43
|
* @param {String} params 参数
|
|
44
44
|
* @returns {String} 发布配对结果
|
|
45
45
|
*/
|
|
46
|
-
const publishPair = (udid =
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
46
|
+
const publishPair = async (udid, payload, once = false) => {
|
|
47
|
+
// 防止设备拔出后仍一直循环占用cpu资源
|
|
48
|
+
if (!_deviceHelper.deviceHelper.hasUdid(udid)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const publishPairRes = (0, _utils3.abilityCallKit)('publish_pair', payload);
|
|
52
|
+
console.log('publishPairRes', publishPairRes);
|
|
53
|
+
if (publishPairRes) {
|
|
54
|
+
const {
|
|
55
|
+
code,
|
|
56
|
+
data
|
|
57
|
+
} = publishPairRes.payload;
|
|
58
|
+
if (code == 0 && data === true) {
|
|
59
|
+
return true;
|
|
60
|
+
} else if (!once) {
|
|
61
|
+
await (0, _utils2.sleep)();
|
|
62
|
+
return await publishPair(udid, payload);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
56
66
|
};
|
|
57
67
|
|
|
58
68
|
/**
|
|
59
|
-
*
|
|
69
|
+
* 发布配对
|
|
60
70
|
* @param {String} udid 设备id
|
|
61
|
-
* @
|
|
71
|
+
* @param {String} params 参数
|
|
72
|
+
* @returns {String} 发布配对结果
|
|
62
73
|
*/
|
|
63
|
-
const
|
|
74
|
+
const trustStatus = async (udid, payload, once = false) => {
|
|
75
|
+
// 防止设备拔出后仍一直循环占用cpu资源
|
|
64
76
|
if (!_deviceHelper.deviceHelper.hasUdid(udid)) {
|
|
65
|
-
// 防止一直循环占用cpu资源
|
|
66
77
|
return false;
|
|
67
78
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const paramsObj = Object.assign(JSON.parse(params), {
|
|
71
|
-
udid
|
|
72
|
-
});
|
|
73
|
-
let label = 'Windows';
|
|
74
|
-
if ((0, _utils.isMac)()) {
|
|
75
|
-
label = 'Mac';
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 通过调用 trust_status 来判断信任状态
|
|
79
|
-
const kitParamsObj = {
|
|
80
|
-
cmd: 'trust_status',
|
|
81
|
-
label,
|
|
82
|
-
params: JSON.stringify(paramsObj)
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// 获取信任状态
|
|
86
|
-
const trustStatusRes = (0, _utils3.callHunterInspectionKit)('TheForceKit', JSON.stringify(kitParamsObj));
|
|
79
|
+
const trustStatusRes = (0, _utils3.abilityCallKit)('trust_status', payload);
|
|
80
|
+
console.log('trustStatusRes', trustStatusRes);
|
|
87
81
|
if (trustStatusRes) {
|
|
88
|
-
const trustStatusResObj = JSON.parse(trustStatusRes);
|
|
89
82
|
const {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
} =
|
|
93
|
-
if (
|
|
94
|
-
return
|
|
83
|
+
code,
|
|
84
|
+
data
|
|
85
|
+
} = trustStatusRes.payload;
|
|
86
|
+
if (code == 0 && data === true) {
|
|
87
|
+
return true;
|
|
95
88
|
} else if (!once) {
|
|
96
89
|
await (0, _utils2.sleep)();
|
|
97
|
-
return await
|
|
90
|
+
return await trustStatus(udid, payload);
|
|
98
91
|
}
|
|
99
92
|
}
|
|
100
93
|
return false;
|
|
101
94
|
};
|
|
102
|
-
const getTrustStatusOnce = async (udid, params) => {
|
|
103
|
-
return await getTrustStatus(udid, params, true);
|
|
104
|
-
};
|
|
105
95
|
|
|
106
96
|
/**
|
|
107
97
|
* 配对并获取信任状态
|
|
@@ -109,6 +99,13 @@ const getTrustStatusOnce = async (udid, params) => {
|
|
|
109
99
|
* @returns
|
|
110
100
|
*/
|
|
111
101
|
const DevicePair = async (udid = '', params) => {
|
|
102
|
+
const oParams = typeof params === 'string' ? JSON.parse(params) : params;
|
|
103
|
+
Object.assign(oParams, {
|
|
104
|
+
params: {
|
|
105
|
+
udid
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const payload = (0, _utils2.parsePayload)(oParams);
|
|
112
109
|
const callBack = () => {
|
|
113
110
|
saasCallBack({
|
|
114
111
|
data: {
|
|
@@ -119,24 +116,16 @@ const DevicePair = async (udid = '', params) => {
|
|
|
119
116
|
});
|
|
120
117
|
};
|
|
121
118
|
|
|
122
|
-
//
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (!trustStatusOnceRes) {
|
|
127
|
-
// 发布配对
|
|
128
|
-
publishPair(udid, params);
|
|
129
|
-
|
|
130
|
-
// 通过 trust_status 来判断信任状态
|
|
131
|
-
const trustStatusRes = await getTrustStatus(udid, params);
|
|
132
|
-
if (trustStatusRes) {
|
|
133
|
-
callBack();
|
|
134
|
-
}
|
|
119
|
+
// 发起单次配对请求 已配对会直接通过
|
|
120
|
+
const publishPairOnceRes = await trustStatus(udid, payload, true);
|
|
121
|
+
if (publishPairOnceRes) {
|
|
122
|
+
callBack();
|
|
135
123
|
return;
|
|
136
124
|
}
|
|
137
125
|
|
|
138
|
-
//
|
|
139
|
-
|
|
126
|
+
// 未通过持续发起配对
|
|
127
|
+
const publishPairRes = await publishPair(udid, payload);
|
|
128
|
+
publishPairRes && callBack();
|
|
140
129
|
};
|
|
141
130
|
|
|
142
131
|
// 写入dll文件version
|
package/lib/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type EventCallback = (result: CallbackResult) => void
|
|
|
24
24
|
export type SnCallback = (result: SnCallbackResult) => void
|
|
25
25
|
export type ReportCallback = (result: any) => void
|
|
26
26
|
|
|
27
|
-
export declare function registerEvent(params:
|
|
27
|
+
export declare function registerEvent(params: any, callback: EventCallback): Promise<void>
|
|
28
28
|
export declare function unregisterEvent(): void
|
|
29
29
|
export declare function registerGetAndroidSn(params: any, callback: SnCallback): void
|
|
30
30
|
export declare function unregisterGetAndroidSn(): void
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.7.2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hunter-open-sdk",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.33",
|
|
4
4
|
"description": "采货侠SaaS版本桌面端sdk",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "zz dev",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"dev-doc": "zz doc --dev",
|
|
19
19
|
"build-doc": "zz doc",
|
|
20
20
|
"cz": "zz cz",
|
|
21
|
-
"test": "zz test"
|
|
22
|
-
"prepare": "npx lefthook install"
|
|
21
|
+
"test": "zz test"
|
|
23
22
|
},
|
|
24
23
|
"main": "lib/index.js",
|
|
25
24
|
"module": "lib/index.mjs",
|
|
Binary file
|