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

Add some sanity to the ImageStream listener API #32936

Merged
merged 1 commit into from May 21, 2019

Conversation

Projects
None yet
5 participants
@tvolkert
Copy link
Contributor

commented May 17, 2019

Description

The current API was broken in that you registered multiple
callbacks at once, but when you removed listeners, only the
primary listener was used to determine what was removed.
This led to unintuitive cases where the caller could get
unexpected behavior.

This updates the API to add and remove listeners using a
newly introduced [ImageStreamListener] object, a value
object that has references to the individual callbacks that
may fire.

Related Issues

Tests

I updated all affected tests to match the new API/behavior.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

@googlebot googlebot added the cla: yes label May 17, 2019

@tvolkert tvolkert requested review from Hixie and goderbauer May 17, 2019

@Hixie

This comment has been minimized.

Copy link
Contributor

commented May 17, 2019

Your claim that this is not a breaking change is entertaining. :-P

The direction looks good.

cc @xster who wrote this initially.
cc @goderbauer for framework review.

@tvolkert tvolkert referenced this pull request May 18, 2019

Closed

Add support for image loading progress #32465

8 of 9 tasks complete
@goderbauer
Copy link
Member

left a comment

LGTM

Add some sanity to the ImageStream listener API
The current API was broken in that you registered multiple
callbacks at once, but when you removed listeners, only the
primary listener was used to determine what was removed.
This led to unintuitive cases where the caller could get
unexpected behavior.

This updates the API to add and remove listeners using
a newly introduced [ImageStreamListener] object, a value
object that has references to the individual callbacks
that may fire.

#24722
#32374
#32935

@tvolkert tvolkert force-pushed the tvolkert:listeners branch from 3d46066 to 40da9f5 May 20, 2019

@tvolkert tvolkert merged commit 592f81e into flutter:master May 21, 2019

34 checks passed

WIP Ready for review
Details
add2app-macos Task Summary
Details
add2app-macos
Details
analyze Task Summary
Details
analyze
Details
build_tests-linux Task Summary
Details
build_tests-linux
Details
build_tests-macos Task Summary
Details
build_tests-macos
Details
build_tests-windows Task Summary
Details
build_tests-windows
Details
cla/google All necessary CLAs are signed
deploy_gallery Task Summary
Details
deploy_gallery
Details
deploy_gallery-macos Task Summary
Details
deploy_gallery-macos
Details
docs Task Summary
Details
docs
Details
integration_tests-linux Task Summary
Details
integration_tests-linux
Details
integration_tests-windows Task Summary
Details
integration_tests-windows
Details
tests-linux Task Summary
Details
tests-linux
Details
tests-macos Task Summary
Details
tests-macos
Details
tests-windows Task Summary
Details
tests-windows
Details
tool_tests-linux Task Summary
Details
tool_tests-linux
Details
tool_tests-macos Task Summary
Details
tool_tests-macos
Details
tool_tests-windows Task Summary
Details
tool_tests-windows
Details

@tvolkert tvolkert deleted the tvolkert:listeners branch May 21, 2019

mollywoodnini added a commit to mollywoodnini/flutter_plugin_pdf_viewer that referenced this pull request May 22, 2019

Update page.dart
updated listener handling due to new flutter version: flutter/flutter#32936

DavBfr added a commit to DavBfr/dart_pdf that referenced this pull request May 28, 2019

amirh added a commit to amirh/plugins that referenced this pull request May 28, 2019

Update and comment out the 'set marker icon' sample.
This updates the sample to adapt to the ImageStream listener API changes
in flutter/flutter#32936

As we cannot use the new API before it makes it to stable I'm commenting
out the sample for now(if we update it now it won't compile on stable,
and if we leave it as is it breaks CI on master).

amirh added a commit to amirh/plugins that referenced this pull request May 28, 2019

Update and comment out the 'set marker icon' sample.
This updates the sample to adapt to the ImageStream listener API changes
in flutter/flutter#32936

As we cannot use the new API before it makes it to stable I'm commenting
out the sample for now(if we update it now it won't compile on stable,
and if we leave it as is it breaks CI on master).

amirh added a commit to flutter/plugins that referenced this pull request May 28, 2019

[google_maps_flutter] Update and comment out the 'set marker icon' sa…
…mple. (#1640)

This updates the sample to adapt to the ImageStream listener API changes
in flutter/flutter#32936

As we cannot use the new API before it makes it to stable I'm commenting
out the sample for now(if we update it now it won't compile on stable,
and if we leave it as is it breaks CI on master).

amirh added a commit to flutter/plugins that referenced this pull request May 28, 2019

[firebase_ml_vision] Update sample to use new ImageStreamListener API
This updates the sample to adapt to the ImageStream listener API changes
in flutter/flutter#32936

This is similar to the change we did to Google Maps in #1640, unfortunately in the firebase_ml_vision case where we commented out the sample that used the ImageStream listener API. Unfortunately in the firebase_ml_vision case, there's no point in the sample without the ImageStream listener(you need it to pick an image), so I'm just updating the sample to the new API knowing that it won't compile on stable until the breaking change makes it there.

Kiku-Reise added a commit to Kiku-Reise/flutter that referenced this pull request Jun 14, 2019

Add some sanity to the ImageStream listener API (flutter#32936)
The current API was broken in that you registered multiple
callbacks at once, but when you removed listeners, only the
primary listener was used to determine what was removed.
This led to unintuitive cases where the caller could get
unexpected behavior.

This updates the API to add and remove listeners using
a newly introduced [ImageStreamListener] object, a value
object that has references to the individual callbacks
that may fire.

flutter#24722
flutter#32374
flutter#32935

DavBfr added a commit to DavBfr/dart_pdf that referenced this pull request Jun 15, 2019

DavBfr added a commit to DavBfr/dart_pdf that referenced this pull request Jun 15, 2019

collinjackson pushed a commit to collinjackson/flutterfire that referenced this pull request Jun 24, 2019

[firebase_ml_vision] Update sample to use new ImageStreamListener API
This updates the sample to adapt to the ImageStream listener API changes
in flutter/flutter#32936

This is similar to the change we did to Google Maps in #1640, unfortunately in the firebase_ml_vision case where we commented out the sample that used the ImageStream listener API. Unfortunately in the firebase_ml_vision case, there's no point in the sample without the ImageStream listener(you need it to pick an image), so I'm just updating the sample to the new API knowing that it won't compile on stable until the breaking change makes it there.

DavBfr added a commit to DavBfr/dart_pdf that referenced this pull request Jul 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.