@onekeyfe/hd-web-sdk 0.1.22 → 0.1.23

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.
@@ -14915,20 +14915,24 @@ class Device extends events.exports {
14915
14915
  _runInner(fn, options) {
14916
14916
  return __awaiter(this, void 0, void 0, function* () {
14917
14917
  if (!this.isUsedHere() || this.commands.disposed) {
14918
- yield this.acquire();
14918
+ const env = DataManager.getSettings('env');
14919
14919
 
14920
- try {
14921
- if (fn) {
14922
- yield this.initialize();
14923
- }
14924
- } catch (error) {
14925
- this.runPromise = null;
14920
+ if (env !== 'react-native') {
14921
+ yield this.acquire();
14926
14922
 
14927
- if (error instanceof hdShared.HardwareError) {
14928
- return Promise.reject(error);
14929
- }
14923
+ try {
14924
+ if (fn) {
14925
+ yield this.initialize();
14926
+ }
14927
+ } catch (error) {
14928
+ this.runPromise = null;
14930
14929
 
14931
- return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
14930
+ if (error instanceof hdShared.HardwareError) {
14931
+ return Promise.reject(error);
14932
+ }
14933
+
14934
+ return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed, `Initialize failed: ${error.message}, code: ${error.code}`));
14935
+ }
14932
14936
  }
14933
14937
  }
14934
14938
 
@@ -19159,7 +19163,7 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
19159
19163
  callApiQueue.push(method);
19160
19164
 
19161
19165
  if (callApiQueue.length > 1) {
19162
- Log.debug('should cancel the previous method execution: ', callApiQueue);
19166
+ Log.debug('should cancel the previous method execution: ', callApiQueue.map(m => m.name));
19163
19167
  }
19164
19168
 
19165
19169
  if (pollingState[pollingId]) {
@@ -19270,11 +19274,11 @@ const callAPI = message => __awaiter(void 0, void 0, void 0, function* () {
19270
19274
  }
19271
19275
  }
19272
19276
 
19273
- const index = messageResponse && messageResponse.id ? callApiQueue.findIndex(m => m.responseID === messageResponse.id) : -1;
19277
+ const index = method.responseID ? callApiQueue.findIndex(m => m.responseID === method.responseID) : -1;
19274
19278
 
19275
19279
  if (index > -1) {
19276
19280
  callApiQueue.splice(index, 1);
19277
- Log.debug('Remove the finished method from the queue: ', callApiQueue);
19281
+ Log.debug('Remove the finished method from the queue: ', callApiQueue.map(m => m.name));
19278
19282
  }
19279
19283
 
19280
19284
  closePopup();
@@ -19419,7 +19423,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
19419
19423
  } catch (error) {
19420
19424
  Log.debug('device error: ', error);
19421
19425
 
19422
- if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError].includes(error.errorCode)) {
19426
+ if ([hdShared.HardwareErrorCode.BlePermissionError, hdShared.HardwareErrorCode.BleLocationError, hdShared.HardwareErrorCode.BleDeviceNotBonded, hdShared.HardwareErrorCode.BleCharacteristicNotifyError, hdShared.HardwareErrorCode.BleWriteCharacteristicError].includes(error.errorCode)) {
19423
19427
  reject(error);
19424
19428
  return;
19425
19429
  }
@@ -20865,6 +20869,7 @@ const HardwareErrorCode = {
20865
20869
  BleCharacteristicNotFound: 707,
20866
20870
  BleMonitorError: 708,
20867
20871
  BleCharacteristicNotifyError: 709,
20872
+ BleWriteCharacteristicError: 710,
20868
20873
  RuntimeError: 800,
20869
20874
  PinInvalid: 801,
20870
20875
  PinCancelled: 802,
@@ -20915,6 +20920,7 @@ const HardwareErrorCodeMessage = {
20915
20920
  [HardwareErrorCode.BleCharacteristicNotFound]: 'BLEServiceNotFound: service not found',
20916
20921
  [HardwareErrorCode.BleMonitorError]: 'Monitor Error: characteristic not found',
20917
20922
  [HardwareErrorCode.BleCharacteristicNotifyError]: 'Characteristic Notify Error',
20923
+ [HardwareErrorCode.BleWriteCharacteristicError]: 'Write Characteristic Error',
20918
20924
  [HardwareErrorCode.RuntimeError]: 'Runtime error',
20919
20925
  [HardwareErrorCode.PinInvalid]: 'Pin invalid',
20920
20926
  [HardwareErrorCode.PinCancelled]: 'Pin cancelled',
@@ -46156,7 +46162,7 @@ const src_init = async settings => {
46156
46162
 
46157
46163
  try {
46158
46164
  await init({ ..._settings,
46159
- version: "0.1.22"
46165
+ version: "0.1.23"
46160
46166
  });
46161
46167
  return true;
46162
46168
  } catch (e) {