From 2d11b55bee34471ca78fb76a5dbd965aa5b57dee Mon Sep 17 00:00:00 2001 From: Chico Date: Sun, 29 Dec 2019 09:26:05 +0000 Subject: [PATCH] Fixes to Sentry issues Changes: - Potential fix using 1 second timeout when calling PermissionsAndroid to address the Sentry issue 'Tried to use permissions API while not attached to an Activity' - Upgrade to react native 0.59.5 to fix NoSuchKeyException when parsing JS stack frames without line numbers that was reported by Sentry --- .../Bluetooth/Default/BlePLXManager.js | 30 +++++++++++-------- package.json | 2 +- yarn.lock | 7 +++-- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/App/Services/Bluetooth/Default/BlePLXManager.js b/App/Services/Bluetooth/Default/BlePLXManager.js index b1d3b19..7cb77ea 100644 --- a/App/Services/Bluetooth/Default/BlePLXManager.js +++ b/App/Services/Bluetooth/Default/BlePLXManager.js @@ -28,19 +28,23 @@ export default class BlePLXManager { // } if (Platform.OS === 'android' && Platform.Version >= 23) { - PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => { - if (result) { - // Permission is OK - } else { - PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => { - if (result) { - // User accepted - } else { - // TODO User refused, what to do? - } - }) - } - }) + // Potential fix using 1 second timeout to 'Tried to use permissions API while not attached to an Activity' + // See https://github.com/facebook/react-native/issues/10009#issuecomment-380968524 + setTimeout(() => { + PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => { + if (result) { + // Permission is OK + } else { + PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION).then((result) => { + if (result) { + // User accepted + } else { + // TODO User refused, what to do? + } + }) + } + }) + }, 1000) } } diff --git a/package.json b/package.json index e9bd655..24dd26f 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "querystringify": "2.0.0", "ramda": "^0.25.0", "react": "16.8.3", - "react-native": "0.59.2", + "react-native": "0.59.5", "react-native-actionsheet": "^2.4.2", "react-native-app-settings": "^2.0.0", "react-native-base64": "^0.0.2", diff --git a/yarn.lock b/yarn.lock index 01e9a21..94361ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9376,9 +9376,10 @@ react-native-webview@5.8.1: escape-string-regexp "1.0.5" invariant "2.2.4" -react-native@0.59.2: - version "0.59.2" - resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.2.tgz#c2e2d9e185b04e54948f170841d97c24661a0fa9" +react-native@0.59.5: + version "0.59.5" + resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.5.tgz#79500d2885a3dc83216715e1fc6effa878ad6ea9" + integrity sha512-8Q/9cS6IMsGNiFhJgzmncbUeuacXQMe5EJl0c63fW30DvjEjeTVCvhM08eGzSpsNlOvL2XDRa4YOiCrwI7S1TA== dependencies: "@babel/runtime" "^7.0.0" "@react-native-community/cli" "^1.2.1"