@onekeyfe/hd-transport-react-native
Advanced tools
Comparing version 0.1.36 to 0.1.37
@@ -312,2 +312,6 @@ 'use strict'; | ||
} | ||
else if (e.errorCode === reactNativeBlePlx.BleErrorCode.DeviceAlreadyConnected) { | ||
this.Log.debug('device already connected'); | ||
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleAlreadyConnected); | ||
} | ||
else { | ||
@@ -372,2 +376,9 @@ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleConnectedError, (_a = e.reason) !== null && _a !== void 0 ? _a : e); | ||
if (!infos) { | ||
try { | ||
this.Log.debug('cancel connection when service not found'); | ||
yield device.cancelConnection(); | ||
} | ||
catch (e) { | ||
this.Log.debug('cancel connection error when service not found: ', e.message || e.reason); | ||
} | ||
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleServiceNotFound); | ||
@@ -469,3 +480,3 @@ } | ||
release(uuid) { | ||
var _a, _b; | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -476,5 +487,3 @@ const transport = transportCache[uuid]; | ||
(_a = transport.nofitySubscription) === null || _a === void 0 ? void 0 : _a.call(transport); | ||
if (reactNative.Platform.OS === 'android') { | ||
yield ((_b = this.blePlxManager) === null || _b === void 0 ? void 0 : _b.cancelDeviceConnection(uuid)); | ||
} | ||
if (reactNative.Platform.OS === 'android') ; | ||
} | ||
@@ -481,0 +490,0 @@ return Promise.resolve(true); |
{ | ||
"name": "@onekeyfe/hd-transport-react-native", | ||
"version": "0.1.36", | ||
"version": "0.1.37", | ||
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme", | ||
@@ -23,8 +23,8 @@ "license": "MIT", | ||
"dependencies": { | ||
"@onekeyfe/hd-shared": "^0.1.36", | ||
"@onekeyfe/hd-transport": "^0.1.36", | ||
"@onekeyfe/hd-shared": "^0.1.37", | ||
"@onekeyfe/hd-transport": "^0.1.37", | ||
"react-native-ble-manager": "^8.1.0", | ||
"react-native-ble-plx": "^2.0.3" | ||
}, | ||
"gitHead": "46ed925a322c0717c74c6bb2e0bb5e7f5df21fcf" | ||
"gitHead": "c7aaa0d4af5ade4c9e07229f142ed85ee14db096" | ||
} |
@@ -217,2 +217,5 @@ import { Platform } from 'react-native'; | ||
device = await blePlxManager.connectToDevice(uuid); | ||
} else if (e.errorCode === BleErrorCode.DeviceAlreadyConnected) { | ||
this.Log.debug('device already connected'); | ||
throw ERRORS.TypedError(HardwareErrorCode.BleAlreadyConnected); | ||
} else { | ||
@@ -285,2 +288,8 @@ throw ERRORS.TypedError(HardwareErrorCode.BleConnectedError, e.reason ?? e); | ||
if (!infos) { | ||
try { | ||
this.Log.debug('cancel connection when service not found'); | ||
await device.cancelConnection(); | ||
} catch (e) { | ||
this.Log.debug('cancel connection error when service not found: ', e.message || e.reason); | ||
} | ||
throw ERRORS.TypedError(HardwareErrorCode.BleServiceNotFound); | ||
@@ -417,4 +426,5 @@ } | ||
transport.nofitySubscription?.(); | ||
// Temporary close the Android disconnect after each request | ||
if (Platform.OS === 'android') { | ||
await this.blePlxManager?.cancelDeviceConnection(uuid); | ||
// await this.blePlxManager?.cancelDeviceConnection(uuid); | ||
} | ||
@@ -421,0 +431,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56341
1286