-
-
Notifications
You must be signed in to change notification settings - Fork 841
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
Support iOS 14 photo permission API changes #510
Conversation
@zoontek Hello! We'd like to use this fix! Having this merged would be awesome! |
@@ -23,14 +31,30 @@ - (void)checkWithResolver:(void (^ _Nonnull)(RNPermissionStatus))resolve | |||
return resolve(RNPermissionStatusDenied); | |||
case PHAuthorizationStatusAuthorized: | |||
return resolve(RNPermissionStatusAuthorized); | |||
case PHAuthorizationStatusLimited: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHAuthorizationStatusLimited
is not available on iOS < 14, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested it on simulator and works on both iOS 14 and iOS 13 without problems!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The simulator might not work correctly on iOS because, unlike Android, it's not a proper emulator. Have you tested it on a real device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jochem725 Sorry for the delay, and thanks for that fantastic work! I merged it in the upcoming 3.0.0 version branch. |
Summary
iOS 14 comes with some photo permission API changes that impact behavior for apps using this library.
→ Permissions are now split in “ReadWrite” and “AddOnly” permissions, so read permission is not always necessary.
→ Users can now grant “limited” permission, allowing them to pick which photos to share.
I’ve implemented both of these changes in the following way:
→ Updated the PhotoLibrary pod to make use of the new API, asking for “ReadWrite” permission (which is the old behavior)
→ Added PhotoLibraryAddOnly pod which asks AddOnly permission, (it behaves like a subset of ReadWrite, if ReadWrite is granted AddOnly is also granted)
→ When limited permission is given users can use a new method
presentLimitedLibraryPicker
to summon the limited selection picker to update the selection. This is a no-op if users give access to their full library. By making it a separate method library users are flexible when to show it (i.e. make it available via a button so users can update their shared photo subset at any time)Impacts only iOS.
Test Plan
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md
CHANGELOG.md
example/App.js
)