-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[google_maps_flutter] Partial Android host API Pigeon conversion #6967
[google_maps_flutter] Partial Android host API Pigeon conversion #6967
Conversation
public @NonNull Double getZoomLevel() { | ||
if (googleMap == null) { | ||
throw new FlutterError( | ||
"GoogleMap uninitialized", "getZoomLevel called prior to map initialization", null); |
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 added this, since unlike most of the other methods there was no handling, so there was a possible-null-reference warning in Android Studio. I've been cleaning up warnings as I move code.
result.error(new FlutterError("GoogleMap uninitialized", "takeSnapshot", null)); | ||
} else { | ||
googleMap.snapshot( | ||
bitmap -> { |
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 change was made with the AS auto-conversion from an object to a lamba.
googleMap.snapshot( | ||
bitmap -> { | ||
if (bitmap == null) { | ||
result.error(new FlutterError("Snapshot failure", "Unable to take snapshot", null)); |
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 is another warning I added handling for; bitmap
can explicitly be null in the API docs, but that wasn't handled.
@Override | ||
public @NonNull Boolean areBuildingsEnabled() { | ||
return googleMap.isBuildingsEnabled(); | ||
return Objects.requireNonNull(googleMap).isBuildingsEnabled(); |
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.
These I just did requireNonNull to silence the warnings (to make the warning display in the IDE more useful) since they are integration-test only, so don't need graceful handling.
@@ -107,7 +109,7 @@ class GoogleMapController | |||
private List<Map<String, ?>> initialTileOverlays; | |||
// Null except between initialization and onMapReady. | |||
private @Nullable String initialMapStyle; | |||
private @Nullable String lastStyleError; | |||
private boolean lastSetStyleSucceeded; |
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 seems like a semantic change I would not have expected.
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.
It's not necessary as part of this PR, just an opportunistic move of logic that didn't need to be in Java over to the Dart side. But if I didn't do this now, then I'd need to add complexity to the Pigeon API definition just to carry a hard-coded string over from the Java side.
|
||
final double lat; | ||
final double lng; | ||
final double latitude; |
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.
if you know can you add some more information here about what the units are for latitude/longitude?
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'm not sure offhand what the units are; I assume degrees? In general I haven't been commenting the Pigeon data objects that correspond directly to some other class within the plugin.
flutter/packages@711b4ac...03f5f6d 2024-06-24 stuartmorgan@google.com [interactive_media_ads] Fix README badge image URL (flutter/packages#6979) 2024-06-24 36191829+biagiopietro@users.noreply.github.com [multicast_dns] Optimized Socket Binding: Always bind to 0.0.0.0 for simplicity and efficiency - #79772 (flutter/packages#6700) 2024-06-24 92950982+oravecz-jpmc@users.noreply.github.com [flutter_adaptive_scaffold] Allows for the animation duration to be adjusted using SlotLayout.from() (flutter/packages#6510) 2024-06-22 louisehsu@google.com [in_app_purchase_storekit] Remove OCMock (flutter/packages#6862) 2024-06-22 stuartmorgan@google.com [google_maps_flutter] Add iOS SDK 9.x support (flutter/packages#6902) 2024-06-21 stuartmorgan@google.com [google_maps_flutter] Partial Android host API Pigeon conversion (flutter/packages#6967) 2024-06-21 github@alexv525.com Revert "Migrate `camera/android` from `SurfaceTexture`->`SurfaceProducer`." (flutter/packages#6964) 2024-06-21 stuartmorgan@google.com [quick_actions] Update to Pigeon 20 (flutter/packages#6961) 2024-06-20 stuartmorgan@google.com [google_maps_flutter] Move Android inspector to Pigeon (flutter/packages#6958) 2024-06-20 engine-flutter-autoroll@skia.org Manual roll Flutter from ccf3abe to 6c06abb (21 revisions) (flutter/packages#6954) 2024-06-20 34871572+gmackall@users.noreply.github.com [many] More v1 embedding deletion that was missed in flutter/packages#6494 (flutter/packages#6923) 2024-06-20 joonas.kerttula@codemate.com [google_maps_flutter] deprecate old BitmapDescriptor methods (flutter/packages#6905) 2024-06-18 magder@google.com [pigeon] Fully-qualify types in Equatable extension test (flutter/packages#6946) 2024-06-18 jimmyxx@gmail.com [flutter_markdown] fixes null check operator used on null value if onSelectionChanged is� (flutter/packages#6883) 2024-06-17 engine-flutter-autoroll@skia.org Roll Flutter from 5187cab to ccf3abe (6 revisions) (flutter/packages#6940) 2024-06-17 50375243+Jerinji2016@users.noreply.github.com [google_sign_in_web] README.md typo (flutter/packages#6642) 2024-06-17 49699333+dependabot[bot]@users.noreply.github.com [camera]: Bump com.google.guava:guava from 32.0.1-android to 33.2.1-android and CameraX version to 1.3.4 in /packages/camera/camera_android_camerax/android (flutter/packages#6847) 2024-06-17 49699333+dependabot[bot]@users.noreply.github.com [sign_in]: Bump com.google.guava:guava from 32.0.1-android to 33.2.1-android in /packages/google_sign_in/google_sign_in_android/android (flutter/packages#6846) 2024-06-17 49699333+dependabot[bot]@users.noreply.github.com [quick_actions]: Bump com.android.tools.build:gradle from 7.2.1 to 8.4.1 in /packages/quick_actions/quick_actions_android/android (flutter/packages#6799) 2024-06-17 49699333+dependabot[bot]@users.noreply.github.com [path_provider]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.0 in /packages/path_provider/path_provider_android/android (flutter/packages#6773) 2024-06-17 49699333+dependabot[bot]@users.noreply.github.com [camera]: Bump androidx.annotation:annotation from 1.7.1 to 1.8.0 in /packages/camera/camera_android/android (flutter/packages#6766) 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Converts the host API methods other than the various map-object-update methods to Pigeon, as a starting point for a Pigeon conversion. This introduces the Pigeon structure for the main APIs, without getting into complex object serialization. Future work includes:
Also replaces the very minimal Dart unit tests with full tests of all the new methods.
Part of flutter/flutter#117907
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///
).