zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.04k stars 828 forks source link

checkLocationAccuracy method throws an error if user denies location permissions #837

Closed CoryWritesCode closed 8 months ago

CoryWritesCode commented 8 months ago

Bug summary

I noticed that while using checkLocationAccuracy() that it throws an error instead of returning RESULTS.DENIED.

image

Library version

4.0.4

Environment info

System:
  OS: macOS 14.2.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 70.42 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/.nvm/versions/node/v18.18.2/bin/node
  Yarn:
    version: 4.0.0
    path: ~/.nvm/versions/node/v18.18.2/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.2/bin/npm
  Watchman:
    version: 2023.05.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/corycunningham/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - watchOS 10.2
  Android SDK:
    API Levels:
      - "31"
      - "32"
      - "33"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 33.0.0
    System Images:
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-31 | ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11255304
  Xcode:
    version: 15.1/15C65
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.7
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/corycunningham/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

  1. Deny location permissions to the app on iOS
  2. use checkLocationAccuracy() somewhere in the app.

Reproducible sample code

Here's my implementation

image
zoontek commented 8 months ago

That's the expected result according to the documentation, no issue here.

The typing even tells you that it resolves with "full" | "reduced", not PermissionStatus (which is the one that can be "denied")

You are supposed to run a check of the location always / when in use before.

image

CoryWritesCode commented 8 months ago

Sorry for missing that. That makes sense