@onekeyfe/hd-transport-react-native 1.1.29-alpha.2 → 1.1.29
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/index.d.ts.map +1 -1
- package/dist/index.js +3 -8
- package/package.json +6 -6
- package/src/index.ts +2 -10
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAIL,UAAU,IAAI,aAAa,EAE5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAGhB,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAahC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkBjE,KAAK,0BAA0B,GAAG;IAChC,mBAAmB,EAAE,cAAc,CAAC;IACpC,oBAAoB,EAAE,cAAc,CAAC;CACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAIL,UAAU,IAAI,aAAa,EAE5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAS,EAAE,EAGhB,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAahC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAG1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBA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A4BpB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIjE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA6MpE,IAAI;IAIE,UAAU,CAAC,OAAO,EAAE,MAAM;IA0EhC,MAAM;CAOP"}
|
package/dist/index.js
CHANGED
|
@@ -222,11 +222,6 @@ const FIRMWARE_UPLOAD_RECONNECT_RETRY_DELAY_MS = 2000;
|
|
|
222
222
|
const ANDROID_FIRMWARE_UPLOAD_PACKET_LENGTH = 192;
|
|
223
223
|
const FIRMWARE_UPLOAD_WRITE_PACKET_CAPACITY = reactNative.Platform.OS === 'ios' ? IOS_PACKET_LENGTH : ANDROID_FIRMWARE_UPLOAD_PACKET_LENGTH;
|
|
224
224
|
const ANDROID_GATT_CONGESTED_STATUS = 143;
|
|
225
|
-
const getBleIdentityName = (device) => {
|
|
226
|
-
var _a, _b;
|
|
227
|
-
const localName = device === null || device === void 0 ? void 0 : device.localName;
|
|
228
|
-
return (_b = (_a = device === null || device === void 0 ? void 0 : device.name) !== null && _a !== void 0 ? _a : localName) !== null && _b !== void 0 ? _b : null;
|
|
229
|
-
};
|
|
230
225
|
const delay = (ms) => new Promise(resolve => {
|
|
231
226
|
setTimeout(resolve, ms);
|
|
232
227
|
});
|
|
@@ -461,10 +456,10 @@ class ReactNativeBleTransport {
|
|
|
461
456
|
return;
|
|
462
457
|
}
|
|
463
458
|
}
|
|
464
|
-
blePlxManager.startDeviceScan(
|
|
459
|
+
blePlxManager.startDeviceScan(null, {
|
|
465
460
|
scanMode: reactNativeBlePlx.ScanMode.LowLatency,
|
|
466
461
|
}, (error, device) => {
|
|
467
|
-
var _a;
|
|
462
|
+
var _a, _b;
|
|
468
463
|
if (error) {
|
|
469
464
|
Log === null || Log === void 0 ? void 0 : Log.debug('ble scan manager: ', blePlxManager);
|
|
470
465
|
Log === null || Log === void 0 ? void 0 : Log.debug('ble scan error: ', error);
|
|
@@ -485,7 +480,7 @@ class ReactNativeBleTransport {
|
|
|
485
480
|
}
|
|
486
481
|
return;
|
|
487
482
|
}
|
|
488
|
-
if (hdShared.isOnekeyDevice(
|
|
483
|
+
if (hdShared.isOnekeyDevice((_b = device === null || device === void 0 ? void 0 : device.name) !== null && _b !== void 0 ? _b : null, device === null || device === void 0 ? void 0 : device.id)) {
|
|
489
484
|
Log === null || Log === void 0 ? void 0 : Log.debug('search device start ======================');
|
|
490
485
|
const { name, localName, id } = device !== null && device !== void 0 ? device : {};
|
|
491
486
|
Log === null || Log === void 0 ? void 0 : Log.debug(`device name: ${name !== null && name !== void 0 ? name : ''}\nlocalName: ${localName !== null && localName !== void 0 ? localName : ''}\nid: ${id !== null && id !== void 0 ? id : ''}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport-react-native",
|
|
3
|
-
"version": "1.1.29
|
|
3
|
+
"version": "1.1.29",
|
|
4
4
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"lint:fix": "eslint . --fix"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@onekeyfe/hd-core": "1.1.29
|
|
23
|
-
"@onekeyfe/hd-shared": "1.1.29
|
|
24
|
-
"@onekeyfe/hd-transport": "1.1.29
|
|
25
|
-
"@onekeyfe/react-native-ble-utils": "^0.1.
|
|
22
|
+
"@onekeyfe/hd-core": "1.1.29",
|
|
23
|
+
"@onekeyfe/hd-shared": "1.1.29",
|
|
24
|
+
"@onekeyfe/hd-transport": "1.1.29",
|
|
25
|
+
"@onekeyfe/react-native-ble-utils": "^0.1.4",
|
|
26
26
|
"react-native-ble-plx": "3.5.1"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "fb02cb13e741b51de2db7acf402cb27c35feed2d"
|
|
29
29
|
}
|
package/src/index.ts
CHANGED
|
@@ -54,11 +54,6 @@ type ResolvedBleCharacteristics = {
|
|
|
54
54
|
notifyCharacteristic: Characteristic;
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const getBleIdentityName = (device?: { name?: string | null } | null): string | null => {
|
|
58
|
-
const localName = (device as { localName?: string | null } | undefined)?.localName;
|
|
59
|
-
return device?.name ?? localName ?? null;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
57
|
const delay = (ms: number) =>
|
|
63
58
|
new Promise<void>(resolve => {
|
|
64
59
|
setTimeout(resolve, ms);
|
|
@@ -363,7 +358,7 @@ export default class ReactNativeBleTransport {
|
|
|
363
358
|
}
|
|
364
359
|
|
|
365
360
|
blePlxManager.startDeviceScan(
|
|
366
|
-
|
|
361
|
+
null,
|
|
367
362
|
{
|
|
368
363
|
scanMode: ScanMode.LowLatency,
|
|
369
364
|
},
|
|
@@ -392,7 +387,7 @@ export default class ReactNativeBleTransport {
|
|
|
392
387
|
return;
|
|
393
388
|
}
|
|
394
389
|
|
|
395
|
-
if (isOnekeyDevice(
|
|
390
|
+
if (isOnekeyDevice(device?.name ?? null, device?.id)) {
|
|
396
391
|
Log?.debug('search device start ======================');
|
|
397
392
|
const { name, localName, id } = device ?? {};
|
|
398
393
|
Log?.debug(
|
|
@@ -406,9 +401,6 @@ export default class ReactNativeBleTransport {
|
|
|
406
401
|
|
|
407
402
|
getConnectedDeviceIds(getBluetoothServiceUuids()).then(devices => {
|
|
408
403
|
for (const device of devices) {
|
|
409
|
-
// Already filtered by the OneKey service UUID via getConnectedDeviceIds;
|
|
410
|
-
// no extra name-based filter (it would drop real OneKey devices that
|
|
411
|
-
// report a null name on iOS).
|
|
412
404
|
Log?.debug('search connected peripheral: ', device.id);
|
|
413
405
|
addDevice(device as unknown as Device);
|
|
414
406
|
}
|