@onekeyfe/hd-core 0.3.23-alpha.3 → 0.3.24

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.
Files changed (41) hide show
  1. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  2. package/dist/api/firmware/getBinary.d.ts.map +1 -1
  3. package/dist/core/index.d.ts +1 -2
  4. package/dist/core/index.d.ts.map +1 -1
  5. package/dist/data-manager/DataManager.d.ts +1 -1
  6. package/dist/data-manager/DataManager.d.ts.map +1 -1
  7. package/dist/data-manager/TransportManager.d.ts +2 -3
  8. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  9. package/dist/device/Device.d.ts.map +1 -1
  10. package/dist/index.d.ts +12 -11
  11. package/dist/index.js +79 -76
  12. package/dist/types/api/getFeatures.d.ts +2 -2
  13. package/dist/types/api/getFeatures.d.ts.map +1 -1
  14. package/dist/types/api/init.d.ts +1 -2
  15. package/dist/types/api/init.d.ts.map +1 -1
  16. package/dist/types/settings.d.ts +1 -2
  17. package/dist/types/settings.d.ts.map +1 -1
  18. package/dist/utils/deviceFeaturesUtils.d.ts +9 -3
  19. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  20. package/dist/utils/index.d.ts +0 -1
  21. package/dist/utils/index.d.ts.map +1 -1
  22. package/dist/utils/logger.d.ts +0 -2
  23. package/dist/utils/logger.d.ts.map +1 -1
  24. package/package.json +4 -4
  25. package/src/api/FirmwareUpdateV2.ts +1 -1
  26. package/src/api/GetPassphraseState.ts +3 -10
  27. package/src/api/SearchDevices.ts +1 -1
  28. package/src/api/firmware/getBinary.ts +6 -9
  29. package/src/api/firmware/uploadFirmware.ts +2 -2
  30. package/src/core/index.ts +11 -15
  31. package/src/data-manager/DataManager.ts +30 -12
  32. package/src/data-manager/TransportManager.ts +2 -17
  33. package/src/device/Device.ts +12 -19
  34. package/src/device/DeviceConnector.ts +1 -1
  35. package/src/inject.ts +1 -1
  36. package/src/types/api/getFeatures.ts +2 -2
  37. package/src/types/api/init.ts +1 -3
  38. package/src/types/settings.ts +1 -2
  39. package/src/utils/deviceFeaturesUtils.ts +35 -6
  40. package/src/utils/index.ts +0 -2
  41. package/src/utils/logger.ts +0 -2
package/dist/index.js CHANGED
@@ -44,7 +44,7 @@ const inject = ({ call, cancel, dispose, eventEmitter, init, updateSettings, uiR
44
44
  const createCoreApi = (call) => ({
45
45
  getLogs: () => call({ method: 'getLogs' }),
46
46
  searchDevices: () => call({ method: 'searchDevices' }),
47
- getFeatures: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'getFeatures' })),
47
+ getFeatures: connectId => call({ connectId, method: 'getFeatures' }),
48
48
  checkFirmwareRelease: connectId => call({ connectId, method: 'checkFirmwareRelease' }),
49
49
  checkBLEFirmwareRelease: connectId => call({ connectId, method: 'checkBLEFirmwareRelease' }),
50
50
  checkTransportRelease: () => call({ method: 'checkTransportRelease' }),
@@ -22497,7 +22497,6 @@ exports.LoggerNames = void 0;
22497
22497
  LoggerNames["HdCommonConnectSdk"] = "@onekey/common-connect-sdk";
22498
22498
  LoggerNames["HdBleSdk"] = "@onekey/hd-ble-sdk";
22499
22499
  LoggerNames["HdTransportHttp"] = "@onekey/hd-transport-http";
22500
- LoggerNames["HdTransportLowLevel"] = "@onekey/hd-transport-lowlevel";
22501
22500
  LoggerNames["HdBleTransport"] = "@onekey/hd-ble-transport";
22502
22501
  LoggerNames["Connect"] = "@onekey/connect";
22503
22502
  LoggerNames["Iframe"] = "IFrame";
@@ -22515,7 +22514,6 @@ const LoggerMap = {
22515
22514
  [exports.LoggerNames.HdBleSdk]: initLog(exports.LoggerNames.HdBleSdk),
22516
22515
  [exports.LoggerNames.HdTransportHttp]: initLog(exports.LoggerNames.HdTransportHttp),
22517
22516
  [exports.LoggerNames.HdBleTransport]: initLog(exports.LoggerNames.HdBleTransport),
22518
- [exports.LoggerNames.HdTransportLowLevel]: initLog(exports.LoggerNames.HdTransportLowLevel),
22519
22517
  [exports.LoggerNames.Connect]: initLog(exports.LoggerNames.Connect),
22520
22518
  [exports.LoggerNames.Iframe]: initLog(exports.LoggerNames.Iframe),
22521
22519
  [exports.LoggerNames.SendMessage]: initLog(exports.LoggerNames.SendMessage),
@@ -22765,7 +22763,6 @@ const getHomeScreenHex = (deviceType, name) => {
22765
22763
  const wait = (ms) => new Promise(resolve => {
22766
22764
  setTimeout(resolve, ms);
22767
22765
  });
22768
- const isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
22769
22766
 
22770
22767
  const getReleaseStatus = (releases, currentVersion) => {
22771
22768
  const newVersions = releases.filter(r => semver__default["default"].gt(r.version.join('.'), currentVersion));
@@ -22873,7 +22870,7 @@ DataManager.getFirmwareStatus = (features) => {
22873
22870
  if (deviceType === 'classic' && features.bootloader_mode) {
22874
22871
  return 'unknown';
22875
22872
  }
22876
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22873
+ const firmwareUpdateField = getFirmwareUpdateField({ features, updateType: 'firmware' });
22877
22874
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22878
22875
  const currentVersion = deviceFirmwareVersion.join('.');
22879
22876
  return getReleaseStatus(targetDeviceConfigList, currentVersion);
@@ -22884,7 +22881,10 @@ DataManager.getSysResourcesLatestRelease = (features, forcedUpdateRes) => {
22884
22881
  const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
22885
22882
  if (deviceType !== 'pro' && deviceType !== 'touch')
22886
22883
  return undefined;
22887
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22884
+ const firmwareUpdateField = getFirmwareUpdateField({
22885
+ features,
22886
+ updateType: 'firmware',
22887
+ });
22888
22888
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22889
22889
  const currentVersion = deviceFirmwareVersion.join('.');
22890
22890
  const targetDeviceConfig = targetDeviceConfigList.filter(item => forcedUpdateRes
@@ -22897,7 +22897,10 @@ DataManager.getSysFullResource = (features) => {
22897
22897
  const deviceType = getDeviceType(features);
22898
22898
  if (deviceType !== 'pro' && deviceType !== 'touch')
22899
22899
  return undefined;
22900
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22900
+ const firmwareUpdateField = getFirmwareUpdateField({
22901
+ features,
22902
+ updateType: 'firmware',
22903
+ });
22901
22904
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22902
22905
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.fullResource);
22903
22906
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.fullResource;
@@ -22907,7 +22910,10 @@ DataManager.getBootloaderResource = (features) => {
22907
22910
  const deviceType = getDeviceType(features);
22908
22911
  if (deviceType !== 'pro' && deviceType !== 'touch')
22909
22912
  return undefined;
22910
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22913
+ const firmwareUpdateField = getFirmwareUpdateField({
22914
+ features,
22915
+ updateType: 'firmware',
22916
+ });
22911
22917
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22912
22918
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
22913
22919
  return (_d = findLatestRelease(targetDeviceConfig)) === null || _d === void 0 ? void 0 : _d.bootloaderResource;
@@ -22915,7 +22921,10 @@ DataManager.getBootloaderResource = (features) => {
22915
22921
  DataManager.getBootloaderTargetVersion = (features) => {
22916
22922
  var _b, _c, _d, _e;
22917
22923
  const deviceType = getDeviceType(features);
22918
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22924
+ const firmwareUpdateField = getFirmwareUpdateField({
22925
+ features,
22926
+ updateType: 'firmware',
22927
+ });
22919
22928
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22920
22929
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderResource);
22921
22930
  return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderVersion) !== null && _e !== void 0 ? _e : undefined;
@@ -22925,7 +22934,10 @@ DataManager.getBootloaderRelatedFirmwareVersion = (features) => {
22925
22934
  const deviceType = getDeviceType(features);
22926
22935
  if (!(deviceType === 'classic' || deviceType === 'mini'))
22927
22936
  return undefined;
22928
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22937
+ const firmwareUpdateField = getFirmwareUpdateField({
22938
+ features,
22939
+ updateType: 'firmware',
22940
+ });
22929
22941
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22930
22942
  const targetDeviceConfig = targetDeviceConfigList.filter(item => !!item.bootloaderRelatedFirmwareVersion);
22931
22943
  return (_e = (_d = targetDeviceConfig === null || targetDeviceConfig === void 0 ? void 0 : targetDeviceConfig[0]) === null || _d === void 0 ? void 0 : _d.bootloaderRelatedFirmwareVersion) !== null && _e !== void 0 ? _e : undefined;
@@ -22938,7 +22950,10 @@ DataManager.getFirmwareChangelog = (features) => {
22938
22950
  (deviceType === 'classic' && features.bootloader_mode)) {
22939
22951
  return [];
22940
22952
  }
22941
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22953
+ const firmwareUpdateField = getFirmwareUpdateField({
22954
+ features,
22955
+ updateType: 'firmware',
22956
+ });
22942
22957
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22943
22958
  const currentVersion = deviceFirmwareVersion.join('.');
22944
22959
  return getReleaseChangelog(targetDeviceConfigList, currentVersion);
@@ -22946,7 +22961,10 @@ DataManager.getFirmwareChangelog = (features) => {
22946
22961
  DataManager.getFirmwareLatestRelease = (features) => {
22947
22962
  var _b, _c;
22948
22963
  const deviceType = getDeviceType(features);
22949
- const firmwareUpdateField = getFirmwareUpdateField(features, 'firmware');
22964
+ const firmwareUpdateField = getFirmwareUpdateField({
22965
+ features,
22966
+ updateType: 'firmware',
22967
+ });
22950
22968
  const targetDeviceConfigList = (_c = (_b = _a.deviceMap[deviceType]) === null || _b === void 0 ? void 0 : _b[firmwareUpdateField]) !== null && _c !== void 0 ? _c : [];
22951
22969
  const target = findLatestRelease(targetDeviceConfigList);
22952
22970
  if (!target)
@@ -22993,7 +23011,6 @@ DataManager.getTransportStatus = (localVersion) => {
22993
23011
  const isLatest = semver__default["default"].gte(localVersion, latestTransportVersion.join('.'));
22994
23012
  return isLatest ? 'valid' : 'outdated';
22995
23013
  };
22996
- DataManager.isBleConnect = (env) => env === 'react-native' || env === 'lowlevel';
22997
23014
 
22998
23015
  const PROTOBUF_MESSAGE_CONFIG = {
22999
23016
  model_mini: [
@@ -23141,6 +23158,16 @@ const supportNewPassphrase = (features) => {
23141
23158
  const currentVersion = getDeviceFirmwareVersion(features).join('.');
23142
23159
  return { support: semver__default["default"].gte(currentVersion, '2.4.0'), require: '2.4.0' };
23143
23160
  };
23161
+ const getPassphraseStateWithRefreshDeviceInfo = (device) => __awaiter(void 0, void 0, void 0, function* () {
23162
+ const { features, commands } = device;
23163
+ const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
23164
+ const passphraseState = yield getPassphraseState(features, commands);
23165
+ const isModeT = getDeviceType(features) === 'touch' || getDeviceType(features) === 'pro';
23166
+ if (isModeT && locked) {
23167
+ yield device.getFeatures();
23168
+ }
23169
+ return passphraseState;
23170
+ });
23144
23171
  const getPassphraseState = (features, commands) => __awaiter(void 0, void 0, void 0, function* () {
23145
23172
  if (!features)
23146
23173
  return false;
@@ -23175,7 +23202,7 @@ const supportModifyHomescreen = (features) => {
23175
23202
  }
23176
23203
  return { support: semver__default["default"].gte(currentVersion, '3.4.0') };
23177
23204
  };
23178
- const getFirmwareUpdateField = (features, updateType) => {
23205
+ const getFirmwareUpdateField = ({ features, updateType, targetVersion, }) => {
23179
23206
  const deviceType = getDeviceType(features);
23180
23207
  const deviceFirmwareVersion = getDeviceFirmwareVersion(features);
23181
23208
  if (updateType === 'ble') {
@@ -23185,6 +23212,12 @@ const getFirmwareUpdateField = (features, updateType) => {
23185
23212
  return 'firmware-v4';
23186
23213
  }
23187
23214
  if (deviceType === 'touch') {
23215
+ if (targetVersion) {
23216
+ if (semver__default["default"].eq(targetVersion, '4.0.0'))
23217
+ return 'firmware-v2';
23218
+ if (semver__default["default"].gt(targetVersion, '4.0.0'))
23219
+ return 'firmware-v4';
23220
+ }
23188
23221
  if (semver__default["default"].lt(deviceFirmwareVersion.join('.'), '3.4.0'))
23189
23222
  return 'firmware';
23190
23223
  return 'firmware-v4';
@@ -23509,7 +23542,6 @@ DevicePool.emitter = new events.exports();
23509
23542
  const Log$7 = getLogger(exports.LoggerNames.Transport);
23510
23543
  const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
23511
23544
  const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
23512
- const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
23513
23545
  class TransportManager {
23514
23546
  static load() {
23515
23547
  Log$7.debug('transport manager load');
@@ -23531,12 +23563,6 @@ class TransportManager {
23531
23563
  Log$7.debug('React Native Do Not Initializing transports');
23532
23564
  }
23533
23565
  }
23534
- else if (env === 'lowlevel') {
23535
- if (!this.plugin) {
23536
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured, 'Lowlevel transport mast have plugin');
23537
- }
23538
- yield this.transport.init(LowLevelLogger, DevicePool.emitter, this.plugin);
23539
- }
23540
23566
  else {
23541
23567
  yield this.transport.init(HttpLogger);
23542
23568
  }
@@ -23570,7 +23596,7 @@ class TransportManager {
23570
23596
  }
23571
23597
  });
23572
23598
  }
23573
- static setTransport(TransportConstructor, plugin) {
23599
+ static setTransport(TransportConstructor) {
23574
23600
  const env = DataManager.getSettings('env');
23575
23601
  if (env === 'react-native') {
23576
23602
  this.transport = new TransportConstructor({ scanTimeout: 3000 });
@@ -23578,10 +23604,6 @@ class TransportManager {
23578
23604
  else {
23579
23605
  this.transport = new TransportConstructor();
23580
23606
  }
23581
- if (plugin) {
23582
- this.plugin = plugin;
23583
- Log$7.debug('set transport plugin: ', this.plugin);
23584
- }
23585
23607
  Log$7.debug('set transport: ', this.transport);
23586
23608
  }
23587
23609
  static getTransport() {
@@ -23599,7 +23621,6 @@ class TransportManager {
23599
23621
  }
23600
23622
  TransportManager.reactNativeInit = false;
23601
23623
  TransportManager.messageVersion = 'latest';
23602
- TransportManager.plugin = null;
23603
23624
 
23604
23625
  const assertType = (res, resType) => {
23605
23626
  const splitResTypes = Array.isArray(resType) ? resType : resType.split('|');
@@ -23871,7 +23892,7 @@ class Device extends events.exports {
23871
23892
  return null;
23872
23893
  const env = DataManager.getSettings('env');
23873
23894
  return {
23874
- connectId: DataManager.isBleConnect(env) ? this.mainId || null : getDeviceUUID(this.features),
23895
+ connectId: env === 'react-native' ? this.mainId || null : getDeviceUUID(this.features),
23875
23896
  uuid: getDeviceUUID(this.features),
23876
23897
  deviceType: this.features.bootloader_mode
23877
23898
  ? getDeviceTypeOnBootloader(this.features)
@@ -23892,7 +23913,7 @@ class Device extends events.exports {
23892
23913
  connect() {
23893
23914
  const env = DataManager.getSettings('env');
23894
23915
  return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
23895
- if (DataManager.isBleConnect(env)) {
23916
+ if (env === 'react-native') {
23896
23917
  try {
23897
23918
  yield this.acquire();
23898
23919
  resolve(true);
@@ -23923,9 +23944,9 @@ class Device extends events.exports {
23923
23944
  var _a, _b, _c, _d;
23924
23945
  return __awaiter(this, void 0, void 0, function* () {
23925
23946
  const env = DataManager.getSettings('env');
23926
- const mainIdKey = DataManager.isBleConnect(env) ? 'id' : 'session';
23947
+ const mainIdKey = env === 'react-native' ? 'id' : 'session';
23927
23948
  try {
23928
- if (DataManager.isBleConnect(env)) {
23949
+ if (env === 'react-native') {
23929
23950
  const res = yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.originalDescriptor.id));
23930
23951
  this.mainId = (_b = res.uuid) !== null && _b !== void 0 ? _b : '';
23931
23952
  Log$5.debug('Expected uuid:', this.mainId);
@@ -23956,7 +23977,7 @@ class Device extends events.exports {
23956
23977
  return __awaiter(this, void 0, void 0, function* () {
23957
23978
  const env = DataManager.getSettings('env');
23958
23979
  if ((this.isUsedHere() && !this.keepSession && this.mainId) ||
23959
- (this.mainId && DataManager.isBleConnect(env))) {
23980
+ (this.mainId && env === 'react-native')) {
23960
23981
  if (this.commands) {
23961
23982
  this.commands.dispose(false);
23962
23983
  if (this.commands.callPromise) {
@@ -24086,7 +24107,7 @@ class Device extends events.exports {
24086
24107
  }
24087
24108
  updateDescriptor(descriptor, forceUpdate = false) {
24088
24109
  const env = DataManager.getSettings('env');
24089
- if (DataManager.isBleConnect(env)) {
24110
+ if (env === 'react-native') {
24090
24111
  return;
24091
24112
  }
24092
24113
  const originalSession = this.originalDescriptor.session;
@@ -24209,7 +24230,7 @@ class Device extends events.exports {
24209
24230
  }
24210
24231
  isUsedHere() {
24211
24232
  const env = DataManager.getSettings('env');
24212
- if (DataManager.isBleConnect(env)) {
24233
+ if (env === 'react-native') {
24213
24234
  return false;
24214
24235
  }
24215
24236
  return this.isUsed() && this.originalDescriptor.session === this.mainId;
@@ -24249,7 +24270,7 @@ class Device extends events.exports {
24249
24270
  hasUsePassphrase() {
24250
24271
  var _a;
24251
24272
  const isModeT = getDeviceType(this.features) === 'touch' || getDeviceType(this.features) === 'pro';
24252
- const preCheckTouch = isModeT && ((_a = this.features) === null || _a === void 0 ? void 0 : _a.unlocked) === true;
24273
+ const preCheckTouch = isModeT && ((_a = this.features) === null || _a === void 0 ? void 0 : _a.unlocked) === false;
24253
24274
  return this.features && (!!this.features.passphrase_protection || preCheckTouch);
24254
24275
  }
24255
24276
  checkDeviceId(deviceId) {
@@ -24259,16 +24280,10 @@ class Device extends events.exports {
24259
24280
  return false;
24260
24281
  }
24261
24282
  checkPassphraseState() {
24262
- var _a;
24263
24283
  return __awaiter(this, void 0, void 0, function* () {
24264
24284
  if (!this.features)
24265
24285
  return false;
24266
- const locked = ((_a = this.features) === null || _a === void 0 ? void 0 : _a.unlocked) === true;
24267
- const isModeT = getDeviceType(this.features) === 'touch' || getDeviceType(this.features) === 'pro';
24268
- const newState = yield getPassphraseState(this.features, this.commands);
24269
- if (isModeT && locked) {
24270
- yield this.getFeatures();
24271
- }
24286
+ const newState = yield getPassphraseStateWithRefreshDeviceInfo(this);
24272
24287
  if (this.passphraseState && this.passphraseState !== newState) {
24273
24288
  this.clearInternalState();
24274
24289
  return newState;
@@ -24403,7 +24418,7 @@ class SearchDevices extends BaseMethod {
24403
24418
  const deviceDiff = yield ((_a = this.connector) === null || _a === void 0 ? void 0 : _a.enumerate());
24404
24419
  const devicesDescriptor = (_b = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _b !== void 0 ? _b : [];
24405
24420
  const env = DataManager.getSettings('env');
24406
- if (DataManager.isBleConnect(env)) {
24421
+ if (env === 'react-native') {
24407
24422
  return devicesDescriptor.map(device => {
24408
24423
  var _a;
24409
24424
  return (Object.assign(Object.assign({}, device), { connectId: device.id, deviceType: getDeviceTypeByBleName((_a = device.name) !== null && _a !== void 0 ? _a : '') }));
@@ -24436,18 +24451,11 @@ class GetPassphraseState extends BaseMethod {
24436
24451
  this.useDevicePassphraseState = false;
24437
24452
  }
24438
24453
  run() {
24439
- var _a, _b;
24440
24454
  return __awaiter(this, void 0, void 0, function* () {
24441
24455
  if (!this.device.features)
24442
24456
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceInitializeFailed));
24443
- let { features } = this.device;
24444
- const locked = ((_b = (_a = this.device) === null || _a === void 0 ? void 0 : _a.features) === null || _b === void 0 ? void 0 : _b.unlocked) === true;
24445
- const passphraseState = yield getPassphraseState(this.device.features, this.device.commands);
24446
- const isModeT = getDeviceType(features) === 'touch' || getDeviceType(features) === 'pro';
24447
- if (isModeT && locked) {
24448
- const { message } = yield this.device.commands.typedCall('GetFeatures', 'Features', {});
24449
- features = message;
24450
- }
24457
+ const passphraseState = yield getPassphraseStateWithRefreshDeviceInfo(this.device);
24458
+ const { features } = this.device;
24451
24459
  if (features && features.passphrase_protection === true) {
24452
24460
  if (passphraseState && features.device_id) {
24453
24461
  this.device.tryFixInternalState(passphraseState, features.device_id, features.session_id);
@@ -25194,15 +25202,11 @@ const getInfo = ({ features, updateType, targetVersion }) => {
25194
25202
  var _a, _b;
25195
25203
  const deviceType = getDeviceType(features);
25196
25204
  const { deviceMap } = DataManager;
25197
- let firmwareUpdateField = getFirmwareUpdateField(features, updateType);
25198
- if (deviceType === 'touch' && targetVersion) {
25199
- if (semver__default["default"].eq(targetVersion, '4.0.0')) {
25200
- firmwareUpdateField = 'firmware-v2';
25201
- }
25202
- else if (semver__default["default"].gt(targetVersion, '4.0.0')) {
25203
- firmwareUpdateField = 'firmware-v3';
25204
- }
25205
- }
25205
+ const firmwareUpdateField = getFirmwareUpdateField({
25206
+ features,
25207
+ updateType,
25208
+ targetVersion,
25209
+ });
25206
25210
  const releaseInfo = (_b = (_a = deviceMap === null || deviceMap === void 0 ? void 0 : deviceMap[deviceType]) === null || _a === void 0 ? void 0 : _a[firmwareUpdateField]) !== null && _b !== void 0 ? _b : [];
25207
25211
  return findLatestRelease(releaseInfo);
25208
25212
  };
@@ -25296,7 +25300,7 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }) =>
25296
25300
  postProgressTip(device, 'StartTransferData', postMessage);
25297
25301
  const filePath = `0:${updateType === 'ble' ? 'ble-' : ''}firmware.bin`;
25298
25302
  const env = DataManager.getSettings('env');
25299
- const perPackageSize = DataManager.isBleConnect(env) ? 16 : 128;
25303
+ const perPackageSize = env === 'react-native' ? 16 : 128;
25300
25304
  const chunkSize = 1024 * perPackageSize;
25301
25305
  const totalChunks = Math.ceil(payload.byteLength / chunkSize);
25302
25306
  let offset = 0;
@@ -25360,7 +25364,7 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
25360
25364
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'emmc file write firmware error');
25361
25365
  }
25362
25366
  const env = DataManager.getSettings('env');
25363
- if (DataManager.isBleConnect(env)) {
25367
+ if (env === 'react-native') {
25364
25368
  yield wait(3000);
25365
25369
  yield ((_a = device.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(device.originalDescriptor.id, null, true));
25366
25370
  yield device.initialize();
@@ -25635,7 +25639,7 @@ class FirmwareUpdateV2 extends BaseMethod {
25635
25639
  checkDeviceToBootloader(connectId) {
25636
25640
  this.checkPromise = hdShared.createDeferred();
25637
25641
  const env = DataManager.getSettings('env');
25638
- const isBleReconnect = connectId && DataManager.isBleConnect(env);
25642
+ const isBleReconnect = connectId && env === 'react-native';
25639
25643
  Log$3.log('FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
25640
25644
  const intervalTimer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
25641
25645
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -31462,7 +31466,7 @@ class DeviceConnector {
31462
31466
  const env = DataManager.getSettings('env');
31463
31467
  try {
31464
31468
  let res;
31465
- if (DataManager.isBleConnect(env)) {
31469
+ if (env === 'react-native') {
31466
31470
  res = yield this.transport.acquire({ uuid: path, forceCleanRunPromise });
31467
31471
  }
31468
31472
  else {
@@ -31695,7 +31699,7 @@ const callAPI = (message) => __awaiter(void 0, void 0, void 0, function* () {
31695
31699
  function initDeviceList(method) {
31696
31700
  return __awaiter(this, void 0, void 0, function* () {
31697
31701
  const env = DataManager.getSettings('env');
31698
- if (DataManager.isBleConnect(env) && method.connectId) {
31702
+ if (env === 'react-native' && method.connectId) {
31699
31703
  yield TransportManager.configure();
31700
31704
  return;
31701
31705
  }
@@ -31807,7 +31811,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
31807
31811
  const env = DataManager.getSettings('env');
31808
31812
  let device;
31809
31813
  try {
31810
- if (DataManager.isBleConnect(env)) {
31814
+ if (env === 'react-native') {
31811
31815
  device = initDeviceForBle(method);
31812
31816
  }
31813
31817
  else {
@@ -31817,7 +31821,7 @@ const ensureConnected = (method, pollingId) => __awaiter(void 0, void 0, void 0,
31817
31821
  if (timer) {
31818
31822
  clearTimeout(timer);
31819
31823
  }
31820
- if (DataManager.isBleConnect(env)) {
31824
+ if (env === 'react-native') {
31821
31825
  bleTimeoutRetry = 0;
31822
31826
  yield connectDeviceForBle(method, device);
31823
31827
  }
@@ -31862,7 +31866,7 @@ const cancel = (connectId) => {
31862
31866
  try {
31863
31867
  if (connectId) {
31864
31868
  let device;
31865
- if (DataManager.isBleConnect(env)) {
31869
+ if (env === 'react-native') {
31866
31870
  device = initDeviceForBle({ connectId });
31867
31871
  }
31868
31872
  else {
@@ -31904,12 +31908,12 @@ const closePopup = () => {
31904
31908
  };
31905
31909
  const onDeviceConnectHandler = (device) => {
31906
31910
  const env = DataManager.getSettings('env');
31907
- const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
31911
+ const deviceObject = env === 'react-native' ? device : device.toMessageObject();
31908
31912
  postMessage(createDeviceMessage(DEVICE.CONNECT, { device: deviceObject }));
31909
31913
  };
31910
31914
  const onDeviceDisconnectHandler = (device) => {
31911
31915
  const env = DataManager.getSettings('env');
31912
- const deviceObject = DataManager.isBleConnect(env) ? device : device.toMessageObject();
31916
+ const deviceObject = env === 'react-native' ? device : device.toMessageObject();
31913
31917
  postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
31914
31918
  };
31915
31919
  const onDevicePinHandler = (...[device, type, callback]) => __awaiter(void 0, void 0, void 0, function* () {
@@ -32022,14 +32026,14 @@ const initConnector = () => {
32022
32026
  DevicePool.emitter.on(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
32023
32027
  return _connector;
32024
32028
  };
32025
- const initTransport = (Transport, plugin) => {
32026
- TransportManager.setTransport(Transport, plugin);
32029
+ const initTransport = (Transport) => {
32030
+ TransportManager.setTransport(Transport);
32027
32031
  };
32028
- const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0, function* () {
32032
+ const init = (settings, Transport) => __awaiter(void 0, void 0, void 0, function* () {
32029
32033
  try {
32030
32034
  try {
32031
32035
  yield DataManager.load(settings);
32032
- initTransport(Transport, plugin);
32036
+ initTransport(Transport);
32033
32037
  }
32034
32038
  catch (_b) {
32035
32039
  Log.error('DataManager.load error');
@@ -32121,7 +32125,6 @@ exports.getScriptType = getScriptType;
32121
32125
  exports.getTimeStamp = getTimeStamp;
32122
32126
  exports.httpRequest = httpRequest;
32123
32127
  exports.initCore = init;
32124
- exports.isBleConnect = isBleConnect;
32125
32128
  exports.isValidVersionArray = isValidVersionArray;
32126
32129
  exports.isValidVersionString = isValidVersionString;
32127
32130
  exports.normalizeVersionArray = normalizeVersionArray;
@@ -1,4 +1,4 @@
1
- import type { CommonParams, Response } from '../params';
1
+ import type { Response } from '../params';
2
2
  import type { Features } from '../device';
3
- export declare function getFeatures(connectId?: string, params?: CommonParams): Response<Features>;
3
+ export declare function getFeatures(connectId?: string): Response<Features>;
4
4
  //# sourceMappingURL=getFeatures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFeatures.d.ts","sourceRoot":"","sources":["../../../src/types/api/getFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"getFeatures.d.ts","sourceRoot":"","sources":["../../../src/types/api/getFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,6 +1,5 @@
1
- import type { LowlevelTransportSharedPlugin } from '@onekeyfe/hd-transport';
2
1
  import { LowLevelCoreApi } from '../../lowLevelInject';
3
2
  import type { ConnectSettings } from '../settings';
4
- export declare function init(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi, pulgin?: LowlevelTransportSharedPlugin): Promise<boolean>;
3
+ export declare function init(settings: Partial<ConnectSettings>, lowLevelApi?: LowLevelCoreApi): Promise<boolean>;
5
4
  export declare function updateSettings(settings: Partial<ConnectSettings>): Promise<boolean>;
6
5
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/types/api/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,EAClC,WAAW,CAAC,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/types/api/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,EAClC,WAAW,CAAC,EAAE,eAAe,GAC5B,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC"}
@@ -12,7 +12,7 @@ export declare type ConnectSettings = {
12
12
  priority: number;
13
13
  trustedHost: boolean;
14
14
  supportedBrowser?: boolean;
15
- env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb' | 'lowlevel';
15
+ env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native' | 'webusb';
16
16
  timestamp: number;
17
17
  isFrame?: boolean;
18
18
  preRelease?: boolean;
@@ -52,7 +52,6 @@ export declare type DeviceTypeMap = {
52
52
  [k in IDeviceType]: {
53
53
  firmware: IFirmwareReleaseInfo[];
54
54
  'firmware-v2'?: IFirmwareReleaseInfo[];
55
- 'firmware-v3'?: IFirmwareReleaseInfo[];
56
55
  'firmware-v4'?: IFirmwareReleaseInfo[];
57
56
  ble: IBLEFirmwareReleaseInfo[];
58
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA,OAAO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ersionArray, SupportFeatureType } from '../types';
3
- import { MessageVersion } from '../data-manager/DataManager';
3
+ import { FirmwareField, MessageVersion } from '../data-manager/DataManager';
4
+ import { Device } from '../device/Device';
4
5
  export declare const getDeviceModel: (features?: import("packages/hd-transport/dist").Features | undefined) => IDeviceModel;
5
6
  export declare const getDeviceType: (features?: import("packages/hd-transport/dist").Features | undefined) => IDeviceType;
6
7
  export declare const getDeviceTypeOnBootloader: (features?: import("packages/hd-transport/dist").Features | undefined) => IDeviceType;
@@ -17,8 +18,13 @@ export declare const getSupportMessageVersion: (features: Features | undefined)
17
18
  };
18
19
  export declare const supportInputPinOnSoftware: (features: Features) => SupportFeatureType;
19
20
  export declare const supportNewPassphrase: (features?: import("packages/hd-transport/dist").Features | undefined) => SupportFeatureType;
20
- export declare const getPassphraseState: (features: Features, commands: DeviceCommands) => Promise<string | false>;
21
+ export declare const getPassphraseStateWithRefreshDeviceInfo: (device: Device) => Promise<string | false>;
22
+ export declare const getPassphraseState: (features: Features | undefined, commands: DeviceCommands) => Promise<string | false>;
21
23
  export declare const supportBatchPublicKey: (features?: import("packages/hd-transport/dist").Features | undefined) => boolean;
22
24
  export declare const supportModifyHomescreen: (features?: import("packages/hd-transport/dist").Features | undefined) => SupportFeatureType;
23
- export declare const getFirmwareUpdateField: (features: Features, updateType: 'firmware' | 'ble') => 'firmware' | 'ble' | 'firmware-v4';
25
+ export declare const getFirmwareUpdateField: ({ features, updateType, targetVersion, }: {
26
+ features: Features;
27
+ updateType: 'firmware' | 'ble';
28
+ targetVersion?: string | undefined;
29
+ }) => 'ble' | FirmwareField;
24
30
  //# sourceMappingURL=deviceFeaturesUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deviceFeaturesUtils.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ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AM,qBAAqB,4EAA0B,OAU3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,4EAA0B,kBAU7D,CAAC;AAKF,eAAO,MAAM,sBAAsB;cAKvB,QAAQ;gBACN,UAAU,GAAG,KAAK;;MAE5B,KAAK,GAAG,aAsBX,CAAC"}
@@ -7,5 +7,4 @@ export { checkNeedUpdateBootForTouch, checkNeedUpdateBootForClassicAndMini, } fr
7
7
  export { getLogger, enableLog, LoggerNames, getLog, setLoggerPostMessage } from './logger';
8
8
  export { getHomeScreenHex } from './homescreen';
9
9
  export declare const wait: (ms: number) => Promise<unknown>;
10
- export declare const isBleConnect: (env: string) => boolean;
11
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EACL,2BAA2B,EAC3B,oCAAoC,GACrC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC;AAEL,eAAO,MAAM,YAAY,QAAS,MAAM,YAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EACL,2BAA2B,EAC3B,oCAAoC,GACrC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAE3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,IAAI,OAAQ,MAAM,qBAG3B,CAAC"}
@@ -32,7 +32,6 @@ export declare enum LoggerNames {
32
32
  HdCommonConnectSdk = "@onekey/common-connect-sdk",
33
33
  HdBleSdk = "@onekey/hd-ble-sdk",
34
34
  HdTransportHttp = "@onekey/hd-transport-http",
35
- HdTransportLowLevel = "@onekey/hd-transport-lowlevel",
36
35
  HdBleTransport = "@onekey/hd-ble-transport",
37
36
  Connect = "@onekey/connect",
38
37
  Iframe = "IFrame",
@@ -50,7 +49,6 @@ export declare const LoggerMap: {
50
49
  "@onekey/hd-ble-sdk": Log;
51
50
  "@onekey/hd-transport-http": Log;
52
51
  "@onekey/hd-ble-transport": Log;
53
- "@onekey/hd-transport-lowlevel": Log;
54
52
  "@onekey/connect": Log;
55
53
  IFrame: Log;
56
54
  "[SendMessage]": Log;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,aAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,GA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AA6B;IAC3C,OAAO,oBAAoB;IAC3B,MAAM,WAAW;IACjB,WAAW,kBAAkB;IAC7B,MAAM,aAAa;CACpB;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;CAgBrB,CAAC;AAEF,eAAO,MAAM,SAAS,QAAS,WAAW,QAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "0.3.23-alpha.3",
3
+ "version": "0.3.24",
4
4
  "description": "> TODO: description",
5
5
  "author": "OneKey",
6
6
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
@@ -25,8 +25,8 @@
25
25
  "url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
26
26
  },
27
27
  "dependencies": {
28
- "@onekeyfe/hd-shared": "^0.3.23-alpha.3",
29
- "@onekeyfe/hd-transport": "^0.3.23-alpha.3",
28
+ "@onekeyfe/hd-shared": "^0.3.24",
29
+ "@onekeyfe/hd-transport": "^0.3.24",
30
30
  "axios": "^0.27.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/semver": "^7.3.9",
45
45
  "ripple-keypairs": "^1.1.4"
46
46
  },
47
- "gitHead": "e8ec072791ec729b76fbead4a6c42713aea8f868"
47
+ "gitHead": "cf0501a0a46436855b6a34f23b31ee97777a644e"
48
48
  }
@@ -88,7 +88,7 @@ export default class FirmwareUpdateV2 extends BaseMethod<Params> {
88
88
  checkDeviceToBootloader(connectId: string | undefined) {
89
89
  this.checkPromise = createDeferred();
90
90
  const env = DataManager.getSettings('env');
91
- const isBleReconnect = connectId && DataManager.isBleConnect(env);
91
+ const isBleReconnect = connectId && env === 'react-native';
92
92
 
93
93
  Log.log('FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
94
94