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

Conversation

@klaes-ashford
Copy link
Contributor

@klaes-ashford klaes-ashford commented Feb 5, 2020

Description

This PR will implement the pointForMeters projection api method in the plugin for iOS. This method helps you get the distance in meters to content size from the specified LatLng in the map.

iOS maps sdk doesn't support drawing dotted polylines out of the box. Instead we make use of drawing circles between two LatLngs. We have to make use of pointForMeters api method to draw circles without specifying a constant radius so that the circle scales regardless of zoom.

Related Issues

flutter/flutter#37959
#2108

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.

@klaes-ashford
Copy link
Contributor Author

@cyanglaz drawing dotted polylines in iOS makes use of this api since SDK doesn't support it out of the box. I can't find android equivalent for the same as the map sdk for android doesn't seem to expose this method. What should be done in this case ?

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.

Thanks for the PR. I left some comments.
Is there a way to add Android implementation?

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.

Hello there! Thank you very much for the PR!

We're about to merge a change to google_maps_flutter, so it follows the "federated implementation" style. This will allow new platforms (like web) to be supported.

Once that change lands, some of the code that you've created/touched should live in the google_maps_flutter_platform_interface package, and not here.

Check out this PR on how we migrated the whole plugin to the new architecture. It should give you clues on how to modify your code to conform to it.

Feel free to reach out to me if you need any assistance with this!

@ditman
Copy link
Member

ditman commented Apr 24, 2020

The refactor has landed.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@klaes-ashford
Copy link
Contributor Author

@googlebot I fixed it.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@iskakaushik iskakaushik removed their request for review April 28, 2020 16:38
@klaes-ashford
Copy link
Contributor Author

@ditman @cyanglaz , I am integrating Federated plugin implementations changes to my open PR , and is facing some issues. Help resolving this is much appreciated.

I've added an api to the google_maps_flutter_platform_interface and bumped the version number according to sem versioning. But since this is not hosted anywhere I am getting this issue.
google_maps_flutter depends on google_maps_flutter_platform_interface ^1.0.2 which doesn't match any versions, version solving failed.

To solve this issue, I have to use relative path in my local project, rather than hosted one. But doing so will make my changes unpublishable in github tests.
Don't depend on "google_maps_flutter_platform_interface" from the path source. Use the hosted source instead.

and if I stick with the google_maps_flutter_platform_interface ^1.0.1, the new changes are not available for the CI and tests would fail.
error - The method 'getPoint' isn't defined for the type 'GoogleMapsFlutterPlatform' at lib/src/controller.dart:259:39 - (undefined_method)

Now, the tests are failing due to this. How should I solve this problem ?

@ditman
Copy link
Member

ditman commented Apr 28, 2020

@aswinkviswanath you're correct. In order for you to push this change, you'll need to first get the changes in the platform_interface package reviewed and published, then the changes in the core plugin. This requires two separate PRs.

It is normal to have a version of the core plugin that depends on the platform_interface via path, that is unpublishable until the platform_interface lands.

Let me know if you have more questions, and thanks for adopting the new style so quickly!

@ditman
Copy link
Member

ditman commented May 4, 2020

I've introduced a change to this PR that should be reverted once the platform interface changes land, and are published to pub.dev. This is to make sure that all tests pass (except the "publishable" one, of course)

@ditman
Copy link
Member

ditman commented May 4, 2020

(It seems there's ~38 tests broken in Android, can you take a look at those @aswinkviswanath?)

+---------+------------------------+--------------------------------+
| OUTCOME |    TEST_AXIS_VALUE     |          TEST_DETAILS          |
+---------+------------------------+--------------------------------+
| Failed  | flame-29-en-portrait   | 38 test cases failed, 8 passed |
| Failed  | walleye-26-en-portrait | 38 test cases failed, 8 passed |
+---------+------------------------+--------------------------------+

Some traces (don't look very useful):

05-04 12:36:16.807: I/TestRunner(10192): started: testTraffic(io.flutter.plugins.googlemaps.EmbeddingV1ActivityTest)
05-04 12:36:16.808: I/MonitoringInstr(10192): Activities that are still in CREATED to STOPPED: 0
05-04 12:36:16.809: E/TestRunner(10192): failed: testTraffic(io.flutter.plugins.googlemaps.EmbeddingV1ActivityTest)
05-04 12:36:16.809: E/TestRunner(10192): ----- begin exception -----
05-04 12:36:16.809: E/TestRunner(10192): java.lang.Exception: failed
05-04 12:36:16.809: E/TestRunner(10192): 	at dev.flutter.plugins.e2e.FlutterRunner.run(FlutterRunner.java:62)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.Suite.runChild(Suite.java:128)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.Suite.runChild(Suite.java:27)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
05-04 12:36:16.809: E/TestRunner(10192): 	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
05-04 12:36:16.809: E/TestRunner(10192): 	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
05-04 12:36:16.809: E/TestRunner(10192): 	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
05-04 12:36:16.809: E/TestRunner(10192): 	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2074)
05-04 12:36:16.809: E/TestRunner(10192): ----- end exception -----
05-04 12:36:16.810: I/TestRunner(10192): finished: testTraffic(io.flutter.plugins.googlemaps.EmbeddingV1ActivityTest)

PS: Does your master branch contain all the changes in aswinkviswanath:feature/GetPoint?

@klaes-ashford
Copy link
Contributor Author

@ditman flutter driver --target test_driver/google_maps_e2e.dart for android would fail due to MissingPluginException(No implementation found for method projection#getPointsForMeters on channel as getPointsForMeters is not implemented for android as the android google maps sdk itself doesn't expose the same. I was unable to see the getPointsForMeters in android projection api's documentation. Correct me if I am wrong, I assume this is the failure with integration tests. what should be done in this case ?

We could use the logic used in the driver test to verify getPointsForMeters to make an implementation for andriod, but I am not sure how accurate that is / if its the way to go.

and master branch contains all the changes in aswinkviswanath:feature/GetPoint.

@ditman
Copy link
Member

ditman commented May 4, 2020

@aswinkviswanath this is the list of failing tests in Android:

testRotateGesturesEnabled
testZoomGesturesEnabled
testSetMapStyle valid Json String
testSetMapStyle invalid Json String
testGetVisibleRegion
testScreenCoordinate
testInitialCenterLocationAtCenter
testTiltGesturesEnabled
testGetPointsForMeters
testTraffic
testGetLatLng
testSetMapStyle null string
testZoomControlsEnabled
testMapToolbarToggle
updateMinMaxZoomLevels
testCompassToggle
testScrollGesturesEnabled
testGetZoomLevel
testBuildings
testRotateGesturesEnabled
testZoomGesturesEnabled
testSetMapStyle valid Json String
testSetMapStyle invalid Json String
testGetVisibleRegion
testScreenCoordinate
testInitialCenterLocationAtCenter
testTiltGesturesEnabled
testGetPointsForMeters
testTraffic
testGetLatLng
testSetMapStyle null string
testZoomControlsEnabled
testMapToolbarToggle
updateMinMaxZoomLevels
testCompassToggle
testScrollGesturesEnabled
testGetZoomLevel
testBuildings

I'd understand testGetPointsForMeters fails, but I don't understand why the others do.

BTW, can you make testGetPointsForMeters test to be skipped when not run on iOS?

@ditman
Copy link
Member

ditman commented May 4, 2020

See an example of a skipped test.

@klaes-ashford
Copy link
Contributor Author

@ditman skipped testGetPointsForMeters in non iOS platforms, and the integration tests seems to pass now.

@ditman
Copy link
Member

ditman commented May 5, 2020

@ditman skipped testGetPointsForMeters in non iOS platforms, and the integration tests seems to pass now.

Yes, this is great, thanks for taking care of this @aswinkviswanath!!

@klaes-ashford klaes-ashford requested review from cyanglaz and ditman May 15, 2020 07:01
@cyanglaz
Copy link
Contributor

Can we make this API available for android as well?

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.

4 participants