Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[image_picker] add forceFullMetadata for iOS #3264

Closed
wants to merge 1 commit into from

Conversation

cpboyd
Copy link
Contributor

@cpboyd cpboyd commented Nov 11, 2020

Description

Originally #3090

Make iOS 11+ permissions requests optional per https://developer.apple.com/forums/thread/653414.
PHAssets aren't actually required and there was already some fallback code in place.

To keep this as a non-breaking change, I added an optional parameter of forceFullMetaData with a default of true.
Setting this to false will disable any permissions checking on iOS and simply display the image picker.

I still need to update the tests.

Related Issues

Fixes flutter/flutter#65995

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@cpboyd cpboyd requested a review from cyanglaz as a code owner November 11, 2020 20:38
@google-cla google-cla bot added the cla: yes label Nov 11, 2020
@cpboyd
Copy link
Contributor Author

cpboyd commented Nov 11, 2020

@cyanglaz I was unable to make any changes to the old PR.
I've made the requested changes and tried to simplify/reduce the description for conciseness.

Please let me know if you'd like me to make any additional changes.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, can we add an XCUITest to make sure the permission popup didn't show if forceFullMetaData is false

@cpboyd
Copy link
Contributor Author

cpboyd commented Nov 14, 2020

@cyanglaz Should I add a new FAB to the example with {forceFullMetaData: false}?

Also, I suppose I need to create a separate XCTestCase since the current has the UIInterruptionMonitor to automatically accept the permissions, correct? I'm new to XCUITests.

@cyanglaz
Copy link
Contributor

@cpboyd
This is what I have in mind.

  1. Create a new fab to the example with {forceFullMetaData: false}.
  2. Update the existing test to use the new fab instead.
  3. In the existing test, add an assertion that the UIInterruptionMonitor is never trigger.

@cyanglaz
Copy link
Contributor

@cpboyd It's been a while since I last commented, were you able to keep working on this? :)

@cpboyd
Copy link
Contributor Author

cpboyd commented Jan 26, 2021

@cyanglaz I hadn't had time for this over the holidays. I'll try to make sure it's up-to-date with master and proceed

@cyanglaz
Copy link
Contributor

cyanglaz commented Jan 26, 2021

@cpboyd Thank you so much! just FYI that we are going to migrate image picker to nnbd soon.

@cpboyd
Copy link
Contributor Author

cpboyd commented Jan 26, 2021

@cyanglaz Great! I've been attempting to do the same with my projects

@cyanglaz
Copy link
Contributor

cyanglaz commented Feb 8, 2021

@cpboyd the NNBD migration is done, you can safely rebase your PR. Then I'll review this and let's get this landed :)

@cyanglaz
Copy link
Contributor

cyanglaz commented Apr 2, 2021

@cpboyd Looks like you need another rebase master to fix CI. Please ping me when it's done and I'll do another review. Let's try to land it soon :)

@cpboyd cpboyd force-pushed the ios-optional-permissions branch from 33176ce to 2706bc6 Compare April 29, 2021 01:27
@cpboyd cpboyd force-pushed the ios-optional-permissions branch 7 times, most recently from e5e720c to e37df4b Compare May 11, 2021 15:17
@cpboyd cpboyd force-pushed the ios-optional-permissions branch from e37df4b to 7c1716b Compare May 22, 2021 21:48
@cpboyd cpboyd force-pushed the ios-optional-permissions branch from 7c1716b to 843eb99 Compare July 11, 2021 22:43
@cpboyd cpboyd force-pushed the ios-optional-permissions branch from 843eb99 to 18474d6 Compare July 25, 2021 18:34
@cpboyd
Copy link
Contributor Author

cpboyd commented Jul 26, 2021

@cyanglaz I've rebased, fixed failing tests, and added a checkbox to the example for toggling the forceFullMetadata value.

Please advise next steps.

@cpboyd cpboyd force-pushed the ios-optional-permissions branch 2 times, most recently from 5886aa1 to ed4bcea Compare August 5, 2021 19:10
@cpboyd
Copy link
Contributor Author

cpboyd commented Aug 5, 2021

I had corrected the casing to forceFullMetadata, should I revert to forceFullMetaData for consistency per @stuartmorgan's comment on PR #4215 (comment) ?

@stuartmorgan-g
Copy link
Contributor

I had corrected the casing to forceFullMetadata, should I revert to forceFullMetaData for consistency per @stuartmorgan's comment on PR #4215 (comment) ?

Are there other cases where it's wrong in the public API? I was looking at the ObjC code when I made that comment; I don't remember if it extended beyond there.

@cpboyd
Copy link
Contributor Author

cpboyd commented Aug 11, 2021

Are there other cases where it's wrong in the public API? I was looking at the ObjC code when I made that comment; I don't remember if it extended beyond there.

From searching etaData, it appears to be limited to the image_picker ObjC code.

@stuartmorgan-g
Copy link
Contributor

Then a new public API should definitely use the correct capitalization.

@cyanglaz
Copy link
Contributor

@cpboyd Thank you very much for this. I apologize for the delay. I just came back from a long time-off.
I think this PR is good to go. There are just a few things left to do:

  1. Extract the code in image_picker_platform_interface into a new PR. Then we can land the platform_Interface, publish it.
  2. Remove the platform_interface code in this PR.

Once that's done, I can help landing this.

@cpboyd cpboyd force-pushed the ios-optional-permissions branch 2 times, most recently from a3ed081 to 0f20461 Compare August 27, 2021 19:37
@cpboyd cpboyd force-pushed the ios-optional-permissions branch from 0f20461 to 024cc35 Compare August 27, 2021 19:55
@cpboyd cpboyd changed the title [image_picker] add forceFullMetaData parameter [image_picker] add forceFullMetadata for iOS Aug 27, 2021
@cpboyd cpboyd force-pushed the ios-optional-permissions branch from 024cc35 to 6b54992 Compare August 27, 2021 20:21
Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

Now that the platform_interface is updated, I think we need to update the version dependency in pubspec.yaml?

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

This cannot land without first fixing the interface change, which needs to be reverted.

@stuartmorgan-g
Copy link
Contributor

@cpboyd Are you planning on re-implementing the interface change as described here to move this forward?

@cpboyd
Copy link
Contributor Author

cpboyd commented Nov 13, 2021

@stuartmorgan I'm sorry, I just don't have the time to dedicate to this PR.

In all honesty, I'm not fully certain about the rebases that I did previously. I stopped using this optional approach in my own app months ago in favor of simply stripping out the permissions elevation code: https://github.com/cpboyd/plugins/tree/ios-no-permissions

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

Successfully merging this pull request may close these issues.

[image_picker] choosing Select Photos permission shows all photos
3 participants