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

[image_picker] add forceFullMetadata to interface #4288

Merged
merged 1 commit into from Sep 5, 2021

Conversation

cpboyd
Copy link
Contributor

@cpboyd cpboyd commented Aug 27, 2021

Splitting interface portion from #3264 per #3264 (comment)

Description

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.

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.

@@ -1,3 +1,11 @@
## 2.3.1
Copy link
Contributor

Choose a reason for hiding this comment

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

should be 2.4.0 as there are non-breaking changes to the public API, same thing in pubspec.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated this as well as the version & changelog for web

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the web change needs to be in the other PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since web directly extends ImagePickerPlatform, it's required to match the function signatures for ImagePickerPlatform

As a result, the automated web tests fail if it's not also changed to match. Granted, there's no changes to web beyond adding bool forceFullMetadata = true, to the function signatures.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm. This is weird. I would think it is the other way around. Since the platform_interface change hasn't been published, the web shouldn't pick up the newest API, thus the override should report a compile error.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cpboyd Do you mind double checking again. The test for web should not fail because the web package is depending on an old version of platform_interface, where the method signature hasn't been changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cyanglaz I just pushed a clean commit without the web changes

Copy link
Contributor

Choose a reason for hiding this comment

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

Since web directly extends ImagePickerPlatform, it's required to match the function signatures for ImagePickerPlatform

As a result, the automated web tests fail if it's not also changed to match. Granted, there's no changes to web beyond adding bool forceFullMetadata = true, to the function signatures.

This is a description of why this is a breaking change, so I'm not clear on why this was landed. You cannot add parameters to methods to an interface without breaking all implementations.

You also cannot just ignore that something is a breaking change by also pushing a change in another package. I don't understand how this was approved with unpublished code changes to a separate package.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cyanglaz I just pushed a clean commit without the web changes

Part of the problem here is that this did not actually happen :(

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.

LGTM!

@cyanglaz cyanglaz added the waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. label Sep 5, 2021
@fluttergithubbot fluttergithubbot merged commit 998f51f into flutter:master Sep 5, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 5, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 5, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 5, 2021
zanderso added a commit that referenced this pull request Sep 5, 2021
@@ -73,6 +78,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
double? maxWidth,
double? maxHeight,
int? imageQuality,
bool forceFullMetadata = true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change. This needs to be reverted, as this version is broken (and we need to figure out how to make sure this kind of thing doesn't pass CI in the future).

stuartmorgan pushed a commit that referenced this pull request Sep 6, 2021
Reverts #4288 which published a breaking change as if it were a non-breaking change.

The discussion in that PR prior to it landing was incorrect, because adding a new parameter
with a default value is non-breaking *only for clients*. It is breaking for subclasses that
override it, and the purpose of the platform interface is for implementations to subclass it
and override everything.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 6, 2021
@stuartmorgan
Copy link
Contributor

Now that the fire is hopefully out due to the revert: please see https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-platform-interface-method-parameters for the right way to re-implement this.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 8, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 9, 2021
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
)

Reverts flutter#4288 which published a breaking change as if it were a non-breaking change.

The discussion in that PR prior to it landing was incorrect, because adding a new parameter
with a default value is non-breaking *only for clients*. It is breaking for subclasses that
override it, and the purpose of the platform interface is for implementations to subclass it
and override everything.
amantoux pushed a commit to amantoux/plugins that referenced this pull request Sep 27, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Sep 27, 2021
)

Reverts flutter#4288 which published a breaking change as if it were a non-breaking change.

The discussion in that PR prior to it landing was incorrect, because adding a new parameter
with a default value is non-breaking *only for clients*. It is breaking for subclasses that
override it, and the purpose of the platform interface is for implementations to subclass it
and override everything.
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
)

Reverts flutter#4288 which published a breaking change as if it were a non-breaking change.

The discussion in that PR prior to it landing was incorrect, because adding a new parameter
with a default value is non-breaking *only for clients*. It is breaking for subclasses that
override it, and the purpose of the platform interface is for implementations to subclass it
and override everything.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes p: image_picker platform-web waiting for tree to go green (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
4 participants