Skip to content

Commit

Permalink
Fixes to Sentry issues
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chico committed Dec 29, 2019
1 parent 740d261 commit 2d11b55
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
30 changes: 17 additions & 13 deletions App/Services/Bluetooth/Default/BlePLXManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9376,9 +9376,10 @@ [email protected]:
escape-string-regexp "1.0.5"
invariant "2.2.4"

[email protected]:
version "0.59.2"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.59.2.tgz#c2e2d9e185b04e54948f170841d97c24661a0fa9"
[email protected]:
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"
Expand Down

0 comments on commit 2d11b55

Please sign in to comment.