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

Added limited contact permission support for iOS 18

Open changey opened this issue 1 year ago • 2 comments

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)?

  1. Launch the react-native-permission example app on iOS 18.0 beta 1 on Xcode Version 16.0 beta 1
  2. Click on the contacts request
  3. 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 avatar Jun 21 '24 22:06 changey

@changey Can you add a function to open the picker, similar to open openPhotoPicker?

zoontek avatar Aug 14 '24 08:08 zoontek

@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?

changey avatar Aug 14 '24 18:08 changey

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 😅

sahil-ahuja-1 avatar Aug 28 '24 23:08 sahil-ahuja-1

^ @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 avatar Aug 28 '24 23:08 changey

@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

zoontek avatar Aug 29 '24 08:08 zoontek

Thanks, merged in v5 branch.

zoontek avatar Sep 02 '24 10:09 zoontek