@onekeyfe/hd-transport-react-native 1.1.31 → 1.1.32-alpha.4

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.
@@ -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;AAoDF,MAAM,MAAM,aAAa,GAAG,oBAAoB,GAAG,MAAM,CAAC;AA0C1D,MAAM,CAAC,OAAO,OAAO,uBAAuB;IAC1C,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IAEzC,SAAS,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IAEnE,IAAI,SAA6B;IAEjC,UAAU,UAAS;IAEnB,OAAO,UAAS;IAEhB,WAAW,SAAQ;IAEnB,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAExC,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,8BAA8B,cAAqB;gBAEvC,OAAO,EAAE,gBAAgB;IAIrC,IAAI,CAAC,OAAO,EAAE,GAAG,E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AAI,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(getBluetoothServiceUuids(), {
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(getBleIdentityName(device), device === null || device === void 0 ? void 0 : device.id)) {
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 : ''}`);
@@ -493,15 +488,10 @@ class ReactNativeBleTransport {
493
488
  Log === null || Log === void 0 ? void 0 : Log.debug('search device end ======================\n');
494
489
  }
495
490
  });
496
- getConnectedDeviceIds(reactNative.Platform.OS === 'ios' ? getBluetoothServiceUuids() : []).then(devices => {
491
+ getConnectedDeviceIds(getBluetoothServiceUuids()).then(devices => {
497
492
  for (const device of devices) {
498
- const { serviceUUIDs } = device;
499
- const hasCachedServiceUuid = Boolean(serviceUUIDs === null || serviceUUIDs === void 0 ? void 0 : serviceUUIDs.length);
500
- const keepDevice = reactNative.Platform.OS === 'ios' || hasCachedServiceUuid;
501
- if (keepDevice) {
502
- Log === null || Log === void 0 ? void 0 : Log.debug('search connected peripheral: ', device.id);
503
- addDevice(device);
504
- }
493
+ Log === null || Log === void 0 ? void 0 : Log.debug('search connected peripheral: ', device.id);
494
+ addDevice(device);
505
495
  }
506
496
  });
507
497
  const addDevice = (device) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-react-native",
3
- "version": "1.1.31",
3
+ "version": "1.1.32-alpha.4",
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.31",
23
- "@onekeyfe/hd-shared": "1.1.31",
24
- "@onekeyfe/hd-transport": "1.1.31",
25
- "@onekeyfe/react-native-ble-utils": "^0.1.6",
22
+ "@onekeyfe/hd-core": "1.1.32-alpha.4",
23
+ "@onekeyfe/hd-shared": "1.1.32-alpha.4",
24
+ "@onekeyfe/hd-transport": "1.1.32-alpha.4",
25
+ "@onekeyfe/react-native-ble-utils": "^0.1.4",
26
26
  "react-native-ble-plx": "3.5.1"
27
27
  },
28
- "gitHead": "4cb6a5f92d34a17b6303e0c73c91d6feaf5dd1cb"
28
+ "gitHead": "fc3bd904e2d35e9185d34c11460b53d558644009"
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
- getBluetoothServiceUuids(),
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(getBleIdentityName(device), device?.id)) {
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(
@@ -404,19 +399,12 @@ export default class ReactNativeBleTransport {
404
399
  }
405
400
  );
406
401
 
407
- getConnectedDeviceIds(Platform.OS === 'ios' ? getBluetoothServiceUuids() : []).then(
408
- devices => {
409
- for (const device of devices) {
410
- const { serviceUUIDs } = device as { serviceUUIDs?: string[] };
411
- const hasCachedServiceUuid = Boolean(serviceUUIDs?.length);
412
- const keepDevice = Platform.OS === 'ios' || hasCachedServiceUuid;
413
- if (keepDevice) {
414
- Log?.debug('search connected peripheral: ', device.id);
415
- addDevice(device as unknown as Device);
416
- }
417
- }
402
+ getConnectedDeviceIds(getBluetoothServiceUuids()).then(devices => {
403
+ for (const device of devices) {
404
+ Log?.debug('search connected peripheral: ', device.id);
405
+ addDevice(device as unknown as Device);
418
406
  }
419
- );
407
+ });
420
408
 
421
409
  const addDevice = (device: Device) => {
422
410
  if (deviceList.every(d => d.id !== device.id)) {