Added limited contact permission support for iOS 18
Summary
The limited contact permission is coming for iOS 18 (Apple's documentation). The PR is to support that
Test Plan
What's required for testing (prerequisites)?
- iOS 18.0 beta 5
- Xcode Version 16.0 beta 5
What are the steps to test it (after prerequisites)?
- Launch the react-native-permission example app on iOS 18.0 beta 1 on Xcode Version 16.0 beta 1
- Click on the contacts request
- Select only limited contacts as shown in the below recording
Expected result: The Contacts permission result should be "limited"
https://github.com/zoontek/react-native-permissions/assets/1524485/34df2326-e78b-4597-b657-310191e87948
Compatibility
| OS | Implemented |
|---|---|
| iOS | ✅ |
| Android | ❌ |
Checklist
- [x] I have tested this on a device and a simulator
- [x] I added the documentation in
README.md - [x] I added a sample use of the API in the example project (
example/App.tsx) - N/A the contact permission example already existed
@changey Can you add a function to open the picker, similar to open openPhotoPicker?
@changey Can you add a function to open the picker, similar to open
openPhotoPicker?
@zoontek thanks for the feedback, but from Apple's documentation, there's presentLimitedLibraryPickerFromViewController:, which is used in - (void)openPhotoPickerWithResolver
but for contact permission, it doesn't look like there's a picker function? And requesting the permission is already available with RNPermissionHandlerContacts.mm checkWithResolver?
Thanks for implementing this! @changey are you planning to implement this function and merge this, as this update would be useful for myself as well!! Trying to get ahead of Apple's policies 😅
^ @zoontek should we merge this?
for contact permission, it doesn't look like there's a picker function? And requesting the permission is already available with RNPermissionHandlerContacts.mm checkWithResolver?
cc @sahil-ahuja-1
@changey In next beta (v5). We cannot force people to install Xcode beta to compile this library: merging it in v4 will result in an unknown symbol error for everyone, it's a breaking.
A solution appears to exist, but it's a button, not a function (which is kinda a weird choice): https://developer.apple.com/videos/play/wwdc2024/10121?time=176 / https://developer.apple.com/documentation/contactsui/contactaccessbutton?changes=latest_minor&language=objc
More infos: https://www.hackingwithswift.com/quick-start/swiftui/how-to-read-user-contacts-with-contactaccessbutton
Thanks, merged in v5 branch.