@onekeyfe/hd-transport-react-native 0.1.58 → 0.2.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,EAEf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,SAAiC,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAkB,QAAQ,EAA6B,MAAM,qBAAqB,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAavC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmBjE,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,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;IAYjC,SAAS;IA2ET,OAAO,CAAC,KAAK,EAAE,eAAe;;;IAgMpC,sBAAsB,CAAC,cAAc,EAAE,cAAc;IA4D/C,OAAO,CAAC,IAAI,EAAE,MAAM;IAepB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE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IA6FpE,IAAI;IAIJ,MAAM;CAOP"}
package/dist/index.js CHANGED
@@ -439,11 +439,15 @@ class ReactNativeBleTransport {
439
439
  let bufferLength = 0;
440
440
  let buffer$1 = [];
441
441
  const subscription = characteristic.monitor((error, c) => {
442
- var _a, _b, _c;
442
+ var _a, _b, _c, _d;
443
443
  if (error) {
444
444
  this.Log.debug(`error monitor ${characteristic.uuid}, deviceId: ${characteristic.deviceID}: ${error}`);
445
445
  if (this.runPromise) {
446
- this.runPromise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleCharacteristicNotifyError, (_a = error.reason) !== null && _a !== void 0 ? _a : error.message));
446
+ let ERROR = hdShared.HardwareErrorCode.BleCharacteristicNotifyError;
447
+ if ((_a = error.reason) === null || _a === void 0 ? void 0 : _a.includes('The connection has timed out unexpectedly')) {
448
+ ERROR = hdShared.HardwareErrorCode.BleTimeoutError;
449
+ }
450
+ this.runPromise.reject(hdShared.ERRORS.TypedError(ERROR, (_b = error.reason) !== null && _b !== void 0 ? _b : error.message));
447
451
  this.Log.debug(': monitor notify error, and has unreleased Promise');
448
452
  }
449
453
  return;
@@ -464,12 +468,12 @@ class ReactNativeBleTransport {
464
468
  const value = buffer.Buffer.from(buffer$1);
465
469
  bufferLength = 0;
466
470
  buffer$1 = [];
467
- (_b = this.runPromise) === null || _b === void 0 ? void 0 : _b.resolve(value.toString('hex'));
471
+ (_c = this.runPromise) === null || _c === void 0 ? void 0 : _c.resolve(value.toString('hex'));
468
472
  }
469
473
  }
470
474
  catch (error) {
471
475
  this.Log.debug('monitor data error: ', error);
472
- (_c = this.runPromise) === null || _c === void 0 ? void 0 : _c.reject(error);
476
+ (_d = this.runPromise) === null || _d === void 0 ? void 0 : _d.reject(error);
473
477
  }
474
478
  });
475
479
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-react-native",
3
- "version": "0.1.58",
3
+ "version": "0.2.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": "^0.1.58",
23
- "@onekeyfe/hd-transport": "^0.1.58",
22
+ "@onekeyfe/hd-shared": "^0.2.0",
23
+ "@onekeyfe/hd-transport": "^0.2.0",
24
24
  "react-native-ble-manager": "^8.1.0",
25
25
  "react-native-ble-plx": "^2.0.3"
26
26
  },
27
- "gitHead": "bf3eba53bcfdb27466f20a7392970764bcb9237b"
27
+ "gitHead": "7d63bbcdd05b277e361b8f6ed52c9c59973c40fa"
28
28
  }
package/src/index.ts CHANGED
@@ -368,12 +368,14 @@ export default class ReactNativeBleTransport {
368
368
  }`
369
369
  );
370
370
  if (this.runPromise) {
371
- this.runPromise.reject(
372
- ERRORS.TypedError(
373
- HardwareErrorCode.BleCharacteristicNotifyError,
374
- error.reason ?? error.message
375
- )
376
- );
371
+ let ERROR:
372
+ | typeof HardwareErrorCode.BleCharacteristicNotifyError
373
+ | typeof HardwareErrorCode.BleTimeoutError =
374
+ HardwareErrorCode.BleCharacteristicNotifyError;
375
+ if (error.reason?.includes('The connection has timed out unexpectedly')) {
376
+ ERROR = HardwareErrorCode.BleTimeoutError;
377
+ }
378
+ this.runPromise.reject(ERRORS.TypedError(ERROR, error.reason ?? error.message));
377
379
  this.Log.debug(': monitor notify error, and has unreleased Promise');
378
380
  }
379
381
  return;