react-native-settings icon indicating copy to clipboard operation
react-native-settings copied to clipboard

API inconsistency

Open padupuy opened this issue 5 years ago • 2 comments

Issue

Describe your issue here with as much detail possible.

When RNSettings.getSetting(RNSettings.LOCATION_SETTING) is called, the success callback is called with a string RNSettings.ENABLED or RNSettings.DISABLED. But when the device listener is called DeviceEventEmitter.addListener(RNSettings.GPS_PROVIDER_EVENT, updatePhonePermissionState);, the success callback is called with an object

{
[RNSettings.LOCATION_SETTING]: RNSettings.ENABLED | RNSettings.DISABLED
}

I suggest to standardize the callback signature, so we could re use the same success callback.


Environment

Click To Expand

react-native info output:

System:
    OS: macOS 10.15.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 154.79 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 13.5.0 - ~/.nvm/versions/node/v13.5.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v13.5.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 23, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.60.0 => 0.60.0
  • Platform that you're experiencing the issue on:
    • [x] iOS
    • [x] Android

padupuy avatar Feb 21 '20 15:02 padupuy

Thanks for opening this, I'll try to find some time to look into it this week.

erezrokah avatar Feb 24 '20 08:02 erezrokah

Merged a fix into a future branch https://github.com/rmrs/react-native-settings/pull/55, will look into https://github.com/rmrs/react-native-settings/issues/50 and will do a release after that.

erezrokah avatar Mar 21 '20 21:03 erezrokah