@onekeyfe/hd-transport-react-native 1.1.11-alpha.2 → 1.1.12-alpha.0

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,EACL,UAAU,IAAI,aAAa,EAC3B,MAAM,EAEN,cAAc,EAIf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAkD,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAEL,QAAQ,EAIT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAiBvC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAoDjE,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,GAAG,CAAC,EAAE,GAAG,CAAC;IAEV,OAAO,CAAC,EAAE,YAAY,CAAC;gBAEX,OAAO,EAAE,gBAAgB;IAIrC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY;IAKvC,SAAS,CAAC,UAAU,EAAE,GAAG;IAMzB,MAAM;IAIN,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAWjC,SAAS;IA6FT,OAAO,CAAC,KAAK,EAAE,eAAe;;;IAyNpC,sBAAsB,CAAC,cAAc,EAAE,cAAc;IAkF/C,OAAO,CAAC,IAAI,EAAE,MAAM;IAepB,IAAI,CAAC,OAAO,EAAE,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AAc,EAAE,cAAc;IAkF/C,OAAO,CAAC,IAAI,EAAE,MAAM;IAepB,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;IA2HpE,IAAI;IAIJ,MAAM;CAOP"}
package/dist/index.js CHANGED
@@ -47,7 +47,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
47
47
 
48
48
  const Logger = hdCore.getLogger(hdCore.LoggerNames.HdBleTransport);
49
49
  const getConnectedDeviceIds = (serviceUuids) => BleUtils__default["default"].getConnectedPeripherals(serviceUuids);
50
- const getBondedDevices = () => BleUtils__default["default"].getBondedPeripherals();
51
50
  const pairDevice = (macAddress) => BleUtils__default["default"].pairDevice(macAddress);
52
51
  const onDeviceBondState = (bleMacAddress) => new Promise((resolve, reject) => {
53
52
  let timeout;
@@ -374,13 +373,9 @@ class ReactNativeBleTransport {
374
373
  throw error;
375
374
  }
376
375
  if (reactNative.Platform.OS === 'android') {
377
- const bondedDevices = yield getBondedDevices();
378
- const existsBondedList = bondedDevices.find(device => device.id.toLowerCase() === uuid.toLowerCase());
379
- if (!existsBondedList) {
380
- const bondState = yield pairDevice(uuid);
381
- if (bondState.bonding) {
382
- yield onDeviceBondState(uuid);
383
- }
376
+ const bondState = yield pairDevice(uuid);
377
+ if (bondState.bonding) {
378
+ yield onDeviceBondState(uuid);
384
379
  }
385
380
  }
386
381
  if (!device) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-react-native",
3
- "version": "1.1.11-alpha.2",
3
+ "version": "1.1.12-alpha.0",
4
4
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -19,10 +19,10 @@
19
19
  "lint:fix": "eslint . --fix"
20
20
  },
21
21
  "dependencies": {
22
- "@onekeyfe/hd-shared": "1.1.11-alpha.2",
23
- "@onekeyfe/hd-transport": "1.1.11-alpha.2",
24
- "@onekeyfe/react-native-ble-utils": "npm:react-native-ble-utils@^0.1.7",
22
+ "@onekeyfe/hd-shared": "1.1.12-alpha.0",
23
+ "@onekeyfe/hd-transport": "1.1.12-alpha.0",
24
+ "@onekeyfe/react-native-ble-utils": "^0.1.4",
25
25
  "react-native-ble-plx": "3.5.0"
26
26
  },
27
- "gitHead": "4c2adec6fa4eaca0b5b97cdfbdca8cebfa10943d"
27
+ "gitHead": "844e234c9f5061169fec6cbc737ff918beb95900"
28
28
  }
package/src/index.ts CHANGED
@@ -19,12 +19,7 @@ import {
19
19
  isOnekeyDevice,
20
20
  } from '@onekeyfe/hd-shared';
21
21
  import type EventEmitter from 'events';
22
- import {
23
- getConnectedDeviceIds,
24
- onDeviceBondState,
25
- pairDevice,
26
- getBondedDevices,
27
- } from './BleManager';
22
+ import { getConnectedDeviceIds, onDeviceBondState, pairDevice } from './BleManager';
28
23
  import { subscribeBleOn } from './subscribeBleOn';
29
24
  import {
30
25
  getBluetoothServiceUuids,
@@ -265,16 +260,9 @@ export default class ReactNativeBleTransport {
265
260
 
266
261
  // check device is bonded
267
262
  if (Platform.OS === 'android') {
268
- const bondedDevices = await getBondedDevices();
269
- const existsBondedList = bondedDevices.find(
270
- device => device.id.toLowerCase() === uuid.toLowerCase()
271
- );
272
-
273
- if (!existsBondedList) {
274
- const bondState = await pairDevice(uuid);
275
- if (bondState.bonding) {
276
- await onDeviceBondState(uuid);
277
- }
263
+ const bondState = await pairDevice(uuid);
264
+ if (bondState.bonding) {
265
+ await onDeviceBondState(uuid);
278
266
  }
279
267
  }
280
268