-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Google maps marker drag events impl #2838
Google maps marker drag events impl #2838
Conversation
d85ddc9
to
56fdb95
Compare
4a3e901
to
cf31ef1
Compare
cf31ef1
to
10c71a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good.
...ges/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/events/map_event.dart
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md
Outdated
Show resolved
Hide resolved
..._maps_flutter/android/src/test/java/io/flutter/plugins/googlemaps/MarkersControllerTest.java
Show resolved
Hide resolved
51e1faf
to
f80d45d
Compare
@stuartmorgan this is part 2 of #2653, which is blocked in "needs tests" status. I'll try to add some tests to 2653 so this one can be reviewed+merged too! |
Hi @ditman, did you have any suggestions for what tests would be suitable for the platform interface to get this finally merged? |
You should add tests that cover all of the new code you're adding in that PR:
|
65741b8
to
dceda4d
Compare
packages/google_maps_flutter/google_maps_flutter/example/pubspec.yaml
Outdated
Show resolved
Hide resolved
..._flutter_platform_interface/test/method_channel/method_channel_google_maps_flutter_test.dart
Outdated
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md
Outdated
Show resolved
Hide resolved
(Apologies, I didn't mean to do a full review of this, but I got carried away with a bunch of "single comments" :/) |
8f0623c
to
693adf9
Compare
@ditman I've made those changes, it looks like the build is currently failing the submit-queue with test failures in webview_flutter/webview_flutter: |
@JamesMcIntosh yes, we suspect those tests are flaky, and most likely don't have anything to do with the changes in this branch. I can restart them to get them to pass! |
I'm more concerned about the web-platform_tests, I suspect they're breaking because of forcing the platform interface to be ^2.1 before implementing the marker events in web. I'm trying to reproduce the issue, but it happens only on this branch, not in the current master (good :P) |
@ditman You are correct the test is failing because these are not implemented on web. From CI logs:
I don't think this should stop this PR from being merged as implementing these methods for web need to be done in a separate PR. |
@ditman Where are we at now with getting this merged? |
No. If something is deliberately being left un-implemented, that un-implemented behavior must not break our automated tests.
If there's a web implementation already ready to review and land, then landing that first such that this works on all platforms when enabled is much preferable. |
I'm sorry @JamesMcIntosh, I took a couple of days off, but forgot to update my github status before leaving. I'll work on getting this feature merged this week. Thanks for your patience! |
I wanted to understand better this failure, because adding methods to a platform interface should be supported without adding it to all platforms at the same time. The issue is that google_maps_flutter_web uses google_maps_flutter in one of its integration tests. Since this change inconditionally calls the new methods here when initializing a Maps Controller, the web implementation breaks. New methods need to be either called conditionally, wrapped in try/catch or avoided (in cross-platform code paths) until the web implementation (actually: all other platforms) land. (I'll take a look at the web implementation PR mentioned above!) |
693adf9
to
5f527e3
Compare
Yes, the web PR seems to be enough to fix the tests that are failing in this PR (verified by cloning this branch, and running the web tests, then cherry-picking the web PR and running the tests again). The only change required to this branch for tests to pass after the web branch is merged is one final rebase with master, since the dependency on the test app is by path, not a download from pub.dev. |
(I've landed the web PR: 90b2844) |
(Pushing the merge with master to see if it makes the tests here green) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, a little bit light on the testing front, but at least we're checking that things are being initialized as needed. Let's go!
final GoogleMap googleMap = mock(GoogleMap.class); | ||
controller.setGoogleMap(googleMap); | ||
|
||
final zzt z = mock(zzt.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is class zzt
? It's being imported from internal
, will it keep its name in the future?
Why not mock Marker
instead of zzt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may actually be very fragile if it's actually obfuscated code (with a name like that it could very well be).
I think that zzt might be something to do with the map projection but don't quote me, it's been a year and a half since I wrote that so I'm not totally sure without digging back into the source code as creation of Markers is hidden behind a factory pattern.
I just tested mocking only Marker and the test work fine, I'm not not sure why I didn't do that in the first place.
I'll create a new PR with this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for coming back to this one, I'll take a look at the new PR!!
@@ -34,6 +35,7 @@ final List<GoogleMapExampleAppPage> _allPages = <GoogleMapExampleAppPage>[ | |||
PlacePolylinePage(), | |||
PlacePolygonPage(), | |||
PlaceCirclePage(), | |||
DragMarkerPage(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's another demo that deals with dragging markers, maybe this one can be merged into the PlaceMarkerPage (or the dragging demo of the PlaceMarkerPage can be moved to this one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've merged them and add it to the PR #4400
* master: [google_maps_flutter] Add Marker drag events (flutter#2838) [flutter_plugin_tools] Validate pubspec description (flutter#4396) Add file_selector to the repo list (flutter#4395) [in_app_purchase] Fix in_app_purchase_android/README.md (flutter#4363) [google_maps_flutter_web] Add Marker drag events (flutter#4385) [webview_flutter] Fixed todos in FlutterWebView.java (flutter#4394) Handle `PurchaseStatus.restored` correctly in example. (flutter#4393) Handle restored purchases in iOS example app (flutter#4392) [file_selector] Remove custom analysis options (flutter#4382) [flutter_plugin_tools] Check licenses in Kotlin (flutter#4373) Fixed _CastError when running example App (flutter#4390) [in_app_purchase] Ensure the introductoryPriceMicros field is transported as a String. (flutter#4370) Load navigation controls immediately. (flutter#4377) [camera] Fix IllegalStateException being thrown in Android implementation when switching activities. (flutter#4319) # Conflicts: # packages/webview_flutter/webview_flutter/CHANGELOG.md # packages/webview_flutter/webview_flutter_android/CHANGELOG.md
* master: (1126 commits) [webview_flutter] Adjust test URLs again (flutter#4407) [google_sign_in] Add serverAuthCode attribute to google_sign_in_platform_interface user data (flutter#4179) [camera] Add filter for unsupported cameras on Android (flutter#4418) [webview_flutter] Update webview platform interface with new methods for running JavaScript. (flutter#4401) [webview_flutter] Add zoomEnabled to webview flutter platform interface (flutter#4404) [ci] Remove obsolete Dockerfile (flutter#4405) Fix order-dependant platform interface tests (flutter#4406) [google_maps_flutter]: LatLng longitude loses precision in constructor #90574 (flutter#4374) [google_maps_flutter] Add Marker drag events (flutter#2838) [flutter_plugin_tools] Validate pubspec description (flutter#4396) Add file_selector to the repo list (flutter#4395) [in_app_purchase] Fix in_app_purchase_android/README.md (flutter#4363) [google_maps_flutter_web] Add Marker drag events (flutter#4385) [webview_flutter] Fixed todos in FlutterWebView.java (flutter#4394) Handle `PurchaseStatus.restored` correctly in example. (flutter#4393) Handle restored purchases in iOS example app (flutter#4392) [file_selector] Remove custom analysis options (flutter#4382) [flutter_plugin_tools] Check licenses in Kotlin (flutter#4373) Fixed _CastError when running example App (flutter#4390) [in_app_purchase] Ensure the introductoryPriceMicros field is transported as a String. (flutter#4370) ... # Conflicts: # packages/quick_actions/ios/Classes/FLTQuickActionsPlugin.m
Description
Add events to track start of drag and position during drag
Related Issues
flutter/flutter#26117
#2653
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.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?