Thanks to visit codestin.com
Credit goes to github.com

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

[google_maps_flutter] Add Google maps flutter platform interface #2577

Closed

Conversation

cylyl
Copy link
Contributor

@cylyl cylyl commented Mar 4, 2020

Description

A common platform interface for the google_maps_flutter plugin.

This interface allows platform-specific implementations of the google_maps_flutter plugin, as well as the plugin itself, to ensure they are supporting the same interface.

Related Issues

flutter/flutter#45292

Checklist

  • [x ] 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.

@cylyl cylyl closed this Mar 6, 2020
@cylyl
Copy link
Contributor Author

cylyl commented Mar 6, 2020

follow up with #2582

@cylyl cylyl reopened this Mar 9, 2020
@ditman
Copy link
Member

ditman commented Mar 18, 2020

Wow, this is great! Thanks for the contribution @cylyl! (I've just found out about this, I've been working in Google maps for web for the last couple of weeks or so)

Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

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

Hey, thanks for the PR!

I added some comments with what we have learned writing platform interfaces and plugins in the last couple of months!

I have time to work on this. If you give me permissions in your repo/branch, I can clone it and tackle some of the changes that I wrote about here.

Again, thank you very much for the contribution, really appreciated!

@cylyl
Copy link
Contributor Author

cylyl commented Mar 20, 2020

Hey, thanks for the PR!

I added some comments with what we have learned writing platform interfaces and plugins in the last couple of months!

I have time to work on this. If you give me permissions in your repo/branch, I can clone it and tackle some of the changes that I wrote about here.

Again, thank you very much for the contribution, really appreciated!

invite sent!

Comment on lines 41 to 52
final MethodChannel channel;
MethodChannel get channel {
return _googleMapsFlutterPlatform.channel;
}
Copy link
Member

Choose a reason for hiding this comment

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

The plugin cannot use the MethodChannel for anything. The MethodChannel is only used as an implementation of the GoogleMaps platform for certain devices. We need to remove the need for an instance of the channel within the plugin (I'll give this a try later as well!)

Copy link
Member

Choose a reason for hiding this comment

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

This is required for the e2e tests (which won't work in mobile, then). This is an issue for the full migration.

@ditman
Copy link
Member

ditman commented Mar 25, 2020

Hey @cylyl, are you testing the lib in mobile (device or emu) to make sure that this is still working as expected, could you take a look at my changes and see if they make sense to you? Thanks!

@cylyl
Copy link
Contributor Author

cylyl commented Mar 25, 2020

l

ok

@ditman
Copy link
Member

ditman commented Mar 30, 2020

Hey @cylyl I intend to rebase the branch with the latest master and push-force. Do you have any work in progress in the google_maps_flutter_platform_interface branch of your repo?

@cylyl cylyl reopened this Apr 2, 2020
@ditman
Copy link
Member

ditman commented Apr 2, 2020

@cylyl note that there has been a new method added to the platform_interface that you might want to check if it can be implemented: takeSnapshot

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

Mostly LGTM but needs to be split up so the platform interface changes can land before the plugin changes

Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

Mostly LGTM but needs to be split up so the platform interface changes can land before the plugin changes

@ditman
Copy link
Member

ditman commented Apr 2, 2020

Mostly LGTM but needs to be split up so the platform interface changes can land before the plugin changes

You're right, I'll get that done ASAP.

@ditman ditman requested a review from cyanglaz April 2, 2020 21:16
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.

Left some nits, this PR is too long to be an afternoon review :) Will continue reviewing tomorrow when i have a refreshed mind :)

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.

Did another round of review, left some comments. :)


/// Updates configuration options of the map user interface.
///
/// Change listeners are notified once the update has been made on the
Copy link
Contributor

Choose a reason for hiding this comment

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

What are change listeners? Could we include a reference here?
ditto below.

Copy link
Member

Choose a reason for hiding this comment

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

I have no idea, this comment comes verbatim from the old implementation.

Map<String, dynamic> creationParams,
Set<Factory<OneSequenceGestureRecognizer>> gestureRecognizers,
PlatformViewCreatedCallback onPlatformViewCreated) {
if (defaultTargetPlatform == TargetPlatform.android) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a little weird that the platform_interface contains platform specific code, is there a way we can avoid this?

Copy link
Member

Choose a reason for hiding this comment

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

This is the MethodChannel implementation, which can be platform-specific (at least for the devices that use MethodChannel).

It needs to live in this package, so it can be the "default" implementation, if the plugin is not overriding anything.

(This code is platform-specific already, because it uses MethodChannels, pretty much)

@ditman
Copy link
Member

ditman commented Apr 4, 2020

The tests that are failing are those that are using methods on the google_map_inspector.dart class that calls directly methods in the MethodChannel. I'll try to debug those next.

@ditman
Copy link
Member

ditman commented Apr 7, 2020

The failing tests were a flake. I ran them manually (and asked on discord) and eventually they passed in Cirrus. I'll split this PR in two; one with the platform_interface only code, and another one with the core plugin changes.

@ditman
Copy link
Member

ditman commented Apr 7, 2020

I have published the platform_interface-only PR here: #2637. @cylyl please take a look there, it needs you to accept the CLA (because I brought over your commits to my repo)

@cylyl
Copy link
Contributor Author

cylyl commented Apr 8, 2020

I have published the platform_interface-only PR here: #2637. @cylyl please take a look there, it needs you to accept the CLA (because I brought over your commits to my repo)

look great!

@ditman
Copy link
Member

ditman commented Apr 8, 2020

Please @cylyl, can you add the following comment in my PR? It is needed to authorize me to push changes with your username from my repository:

@googlebot I consent.

Here is a similar (not identical) example in another PR.

Thanks!

@cylyl
Copy link
Contributor Author

cylyl commented Apr 9, 2020

#2637

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

Successfully merging this pull request may close these issues.

5 participants