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

Support iOS 14 photo permission API changes #510

Merged
merged 6 commits into from
Oct 10, 2020

Conversation

jochem725
Copy link
Contributor

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

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@jochem725 jochem725 requested a review from zoontek as a code owner September 16, 2020 10:00
@FRizzonelli
Copy link

@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:
Copy link
Owner

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?

Copy link

@FRizzonelli FRizzonelli Sep 23, 2020

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!

Copy link
Owner

@zoontek zoontek Sep 23, 2020

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?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zoontek zoontek mentioned this pull request Sep 26, 2020
11 tasks
@zoontek zoontek changed the base branch from master to 3.0.0 October 10, 2020 12:20
@zoontek zoontek merged commit 8f4eeb8 into zoontek:3.0.0 Oct 10, 2020
@zoontek
Copy link
Owner

zoontek commented Oct 10, 2020

@jochem725 Sorry for the delay, and thanks for that fantastic work! I merged it in the upcoming 3.0.0 version branch.

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.

3 participants