Skip to content

[image_picker_web] Listens to file input cancel event. #4453

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

Merged
merged 8 commits into from
Aug 4, 2023

Conversation

ditman
Copy link
Member

@ditman ditman commented Jul 13, 2023

Changes

This PR listens to the cancel event from the input type=file used by the web implementation of the image_picker plugin, so apps don't end up endlessly awaiting for a file that will never come in modern browsers (Chrome 113, Safari 16.4, or newer). Same API as #3683.

Additionally, this PR:

  • Removes all code and tests mentioning PickedFile. (Deprecated years ago, and unused since [image_picker] Update to 1.0 #4285) (Breaking change)
  • Updates README to mention XFile which is the current return type of the package.
  • Updates the dependency on image_picker_platform_interface to ^2.9.0.
    • Implements all non-deprecated methods from the interface, and makes deprecated methods use the fresh ones.
    • Updates tests.

Issues

Testing

  • Added integration testing coverage for the 'cancel' event.
  • Tested manually in Chrome with the example app running on web.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ditman ditman force-pushed the image-picker-web-cancel-event branch from f8c9ba3 to 4f1047f Compare July 17, 2023 21:16
@ditman
Copy link
Member Author

ditman commented Jul 17, 2023

I've updated the README to mention the current methods (not the ones I'm removing), and marked this change as a major version to prevent any issues with package resolution (I'll send a PR updating image_picker to v.3 of the web implementation after this lands). PTAL @stuartmorgan!

@ditman ditman requested a review from stuartmorgan-g July 17, 2023 21:24
@ditman ditman force-pushed the image-picker-web-cancel-event branch from 4f1047f to 08eb6d1 Compare July 19, 2023 18:06
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.

LGTM modulo the version constraint.

@ditman ditman force-pushed the image-picker-web-cancel-event branch from 08eb6d1 to c40b18c Compare August 3, 2023 23:13
ditman added 5 commits August 3, 2023 17:34
* Delegates deprecated methods to non-deprecated ones.
* Moves tests of old methods to a "Deprecated" group so they can be
  cleaned up easily later.
@ditman
Copy link
Member Author

ditman commented Aug 4, 2023

Hey @stuartmorgan, here's the refresh to the image_picker_web to implement the latest platform interface! PTAL (and change/merge at will)

@ditman ditman requested a review from stuartmorgan-g August 4, 2023 00:55
@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 4, 2023
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.

StillLGTM

@auto-submit auto-submit bot merged commit ce53da1 into flutter:main Aug 4, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 4, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 4, 2023
flutter/packages@d00c1f9...ce53da1

2023-08-04 ditman@gmail.com [image_picker_web] Listens to file input cancel event. (flutter/packages#4453)
2023-08-04 maurits@vnbskm.nl [in_app_purchase] Updates handling of subscription price changes in README. (flutter/packages#4643)
2023-08-03 stuartmorgan@google.com [pigeon] Consolidate main Dart unit tests (flutter/packages#4641)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: image_picker platform-web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[image_picker][web] cancel cause picker to never return
2 participants