Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5.0.0 #890

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

v5.0.0 #890

wants to merge 23 commits into from

Conversation

zoontek
Copy link
Owner

@zoontek zoontek commented Sep 3, 2024

As iOS 18 / Android 15 are around the corner, it's time to publish a new major version, as it will needs the latest Xcode version (v16) to be built. Let's perform some changes to improve this library in the same time.

I'm opening this to discuss about some points. I think it will be for the better, but I would love a community confirmation about them:

  • Add limited contacts support (on iOS 18+) ✅
  • Drop support for iOS < 13.4 ✅
  • Drop support for Android < 6.0 ✅
  • Remove the UNAVAILABLE status, return BLOCKED instead (as it cannot be requested). That's one less thing to check, and it allows me to solves this issue. ✅
  • Migrate the Android code to Kotlin ✅
  • Make check and checkMultiple synchronous
  • Make check and checkMultiple return a boolean (granted) (as Android will never return blocked on check, you have to call request to get the info anyway) ✅

And, this is extra, but:

@fobos531
Copy link
Contributor

fobos531 commented Sep 3, 2024

About hooks and reactivity, especially in context of permissions, this github thread at expo has some interesting insight on the API design: expo/expo#31171 (comment)

@guillempuche
Copy link

Hooks!

@zoontek
Copy link
Owner Author

zoontek commented Sep 12, 2024

I published a beta version, try it: yarn add react-native-permission@next / npm i --save react-native-permission@next

Beta changelog

  • Drop support for React native < 0.73, iOS < 13.4 and Android < 6
  • Add LIMITED contacts permissions support (requires Xcode 16 beta)
  • Rewrite android codebase in Kotlin
  • Remove the UNAVAILABLE status, BLOCKED is now returned in such cases
  • Unify all platforms to a unique permission flow
  • check, checkMultiple and checkNotifications now return granted boolean instead of statuses (as it was not truly possible on Android to determine if it was BLOCKED without requesting it)
  • requestNotifications now accept a rationale argument

EDIT: Just published a second beta that switch back to async check / checkMultiple, as after some tests it was too slow for some iOS permissions (Face ID…), and was locking the JS thread. Plus, it reduces the amount of breaking changes / add back working windows compat.

@zoontek
Copy link
Owner Author

zoontek commented Sep 14, 2024

Juste published beta 2 to fix an issue with bob + the expo plugin (more infos callstack/react-native-builder-bob#598 (comment))

@valeeum
Copy link

valeeum commented Sep 19, 2024

I don't quite understand what the flow would be to check and then request permissions if the check method returns a boolean. what if a user provides limited permissions but I want to force granted permissions. how would i know that permissions are limited and present user to click on a button to be redirected to Linking.openSettings().

Right now, i have this block of code. But if a user is presented this for the first time and they select limited permissions, then once request completes, they will be redirected to settings immediately.

const contactsPermissionResult = await check(PERMISSIONS.IOS.CONTACTS);
if (!contactsPermissionResult) {
  request(PERMISSIONS.IOS.CONTACTS)
    .then(status => {
      if (status === RESULTS.GRANTED) {
        //...dismiss modal
      } else {
        Linking.openSettings();
      }
    })
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants