From 5b85941af6a7c020fd2af672350b35777050622d Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 19 Nov 2025 16:17:03 -0500 Subject: [PATCH 1/4] [google_maps_flutter] Replace deprecated APIs This fixes two sets of API deprecations: - Within the package, cloudMapId was deprecated in the platform interface, and replaced with mapId. This updates everything that's not client-facing to use the mapId name instead (except for local variables in native code, where it ensure there's no potential confusion with the plugin-level map ID that tracks map instances in the plugin). - `Color.value` is deprecated. Rather than just replace it with `toARGB()`, this adds structured data to the Pigeon interface, so that it's not relying on magic knowledge on both sides of the interface that the ints are ARGB: - On Android, where the native SDK color representation is just a 32-bit ARGB, this adds a wrapper class to make that explicit in the Pigeon API surface. - On iOS, where `UIColor` uses four doubles, this passes the underlying `Color` doubles directly via the wrapper class, so that it's not lossy. - For legacy JSON representations, it continues to use the equivalent `toARGB()` directly, since it must remain compatible. This also annotates a couple of intentional internal uses of the deprecated `legacy` renderer type so that it won't show up in future repository deprecation audits. Also pays down some tech debt by renaming the now-very-poorly-named FLTGoogleMapJSONConversions.* file to FGMConversionUtils, since it is now mostly Pigeon type conversions. It also renames the legacy FLTGoogleMapJSONConversions bag-of-class-methods class to reflect that it is now only used for heatmaps, the last type that still uses JSON serialization in the Pigeon interface (https://github.com/flutter/flutter/issues/117907). Part of https://github.com/flutter/flutter/issues/159739 --- .../google_maps_flutter/CHANGELOG.md | 3 +- .../example/lib/map_map_id.dart | 1 + .../lib/src/google_map.dart | 2 +- .../google_maps_flutter/pubspec.yaml | 2 +- .../google_maps_flutter_android/CHANGELOG.md | 4 + .../flutter/plugins/googlemaps/Convert.java | 10 +- .../plugins/googlemaps/GoogleMapFactory.java | 2 +- .../flutter/plugins/googlemaps/Messages.java | 268 +++++++++++------- .../googlemaps/CirclesControllerTest.java | 4 +- .../integration_test/google_maps_test.dart | 5 +- .../example/lib/example_google_map.dart | 6 +- .../example/lib/map_map_id.dart | 3 +- .../lib/src/google_maps_flutter_android.dart | 17 +- .../lib/src/messages.g.dart | 177 +++++++----- .../lib/src/serialization.dart | 4 +- .../pigeons/messages.dart | 27 +- .../google_maps_flutter_android/pubspec.yaml | 2 +- .../google_maps_flutter_android_test.dart | 31 +- .../google_maps_flutter_ios/CHANGELOG.md | 4 + .../integration_test/google_maps_test.dart | 2 +- .../ios14/ios/Flutter/AppFrameworkInfo.plist | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 10 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 + ...sionTests.m => FGMConversionsUtilsTests.m} | 21 +- .../GoogleMapsCircleControllerTests.m | 10 +- .../GoogleMapsPolygonControllerTests.m | 27 +- .../GoogleMapsPolylineControllerTests.m | 32 ++- .../lib/example_google_map.dart | 6 +- .../maps_example_dart/lib/map_map_id.dart | 2 +- .../Classes/FGMClusterManagersController.m | 2 +- ...JSONConversions.h => FGMConversionUtils.h} | 7 +- ...JSONConversions.m => FGMConversionUtils.m} | 30 +- .../ios/Classes/FGMGroundOverlayController.m | 2 +- .../Classes/FLTGoogleMapHeatmapController.m | 11 +- .../FLTGoogleMapTileOverlayController.m | 2 +- .../ios/Classes/GoogleMapCircleController.m | 6 +- .../ios/Classes/GoogleMapController.m | 4 +- .../ios/Classes/GoogleMapMarkerController.m | 2 +- .../ios/Classes/GoogleMapPolygonController.m | 6 +- .../ios/Classes/GoogleMapPolylineController.m | 4 +- .../google_maps_flutter_ios-umbrella.h | 2 +- .../ios/Classes/messages.g.h | 36 ++- .../ios/Classes/messages.g.m | 113 +++++--- .../lib/src/google_maps_flutter_ios.dart | 42 ++- .../lib/src/messages.g.dart | 123 +++++--- .../lib/src/serialization.dart | 6 +- .../pigeons/messages.dart | 33 ++- .../google_maps_flutter_ios/pubspec.yaml | 2 +- .../test/google_maps_flutter_ios_test.dart | 29 +- .../lib/src/method_channel/serialization.dart | 4 +- .../lib/src/types/bitmap.dart | 9 +- .../lib/src/types/circle.dart | 4 +- .../lib/src/types/heatmap.dart | 2 +- .../lib/src/types/polygon.dart | 4 +- .../lib/src/types/polyline.dart | 2 +- .../test/types/bitmap_test.dart | 17 +- .../test/types/heatmap_test.dart | 2 +- 57 files changed, 761 insertions(+), 431 deletions(-) rename packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/{FLTGoogleMapJSONConversionsConversionTests.m => FGMConversionsUtilsTests.m} (95%) rename packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/{FLTGoogleMapJSONConversions.h => FGMConversionUtils.h} (94%) rename packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/{FLTGoogleMapJSONConversions.m => FGMConversionUtils.m} (95%) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 64bc5dc7a8b..2386feeee9d 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.14.1 +* Replaces internal use of deprecated methods. * Updates minimum supported SDK version to Flutter 3.32/Dart 3.8. ## 2.14.0 diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart index d9befb15a88..362cbea31de 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart @@ -54,6 +54,7 @@ class MapIdBodyState extends State { switch (_initializedRenderer) { case AndroidMapRenderer.latest: return 'latest'; + // ignore: deprecated_member_use case AndroidMapRenderer.legacy: return 'legacy'; case AndroidMapRenderer.platformDefault: diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart index 44f6dd5d812..627efae290d 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart @@ -723,7 +723,7 @@ MapConfiguration _configurationFromMapWidget(GoogleMap map) { indoorViewEnabled: map.indoorViewEnabled, trafficEnabled: map.trafficEnabled, buildingsEnabled: map.buildingsEnabled, - cloudMapId: map.cloudMapId, + mapId: map.cloudMapId, // A null style in the widget means no style, which is expressed as '' in // the configuration to distinguish from no change (null). style: map.style ?? '', diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index 7f16bf9fb63..d928fb3b21f 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.14.0 +version: 2.14.1 environment: sdk: ^3.8.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index d7d88983c3e..6c42bdb8a51 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.18.6 + +* Replaces internal use of deprecated methods. + ## 2.18.5 * Updates to Pigeon 26. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java index 871f1eb24d7..44765122a1f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java @@ -627,8 +627,8 @@ static String interpretPolygonOptions(Messages.PlatformPolygon polygon, PolygonO sink.setConsumeTapEvents(polygon.getConsumesTapEvents()); sink.setGeodesic(polygon.getGeodesic()); sink.setVisible(polygon.getVisible()); - sink.setFillColor(polygon.getFillColor().intValue()); - sink.setStrokeColor(polygon.getStrokeColor().intValue()); + sink.setFillColor(polygon.getFillColor().getArgbValue().intValue()); + sink.setStrokeColor(polygon.getStrokeColor().getArgbValue().intValue()); sink.setStrokeWidth(polygon.getStrokeWidth()); sink.setZIndex(polygon.getZIndex()); sink.setPoints(pointsFromPigeon(polygon.getPoints())); @@ -654,7 +654,7 @@ static String interpretPolylineOptions( AssetManager assetManager, float density) { sink.setConsumeTapEvents(polyline.getConsumesTapEvents()); - sink.setColor(polyline.getColor().intValue()); + sink.setColor(polyline.getColor().getArgbValue().intValue()); sink.setEndCap(capFromPigeon(polyline.getEndCap(), assetManager, density)); sink.setStartCap(capFromPigeon(polyline.getStartCap(), assetManager, density)); sink.setGeodesic(polyline.getGeodesic()); @@ -669,8 +669,8 @@ static String interpretPolylineOptions( static String interpretCircleOptions(Messages.PlatformCircle circle, CircleOptionsSink sink) { sink.setConsumeTapEvents(circle.getConsumeTapEvents()); - sink.setFillColor(circle.getFillColor().intValue()); - sink.setStrokeColor(circle.getStrokeColor().intValue()); + sink.setFillColor(circle.getFillColor().getArgbValue().intValue()); + sink.setStrokeColor(circle.getStrokeColor().getArgbValue().intValue()); sink.setStrokeWidth(circle.getStrokeWidth()); sink.setZIndex(circle.getZIndex().floatValue()); sink.setCenter(toLatLng(circle.getCenter().toList())); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java index a0a25948efd..0cd2c6920f2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java @@ -48,7 +48,7 @@ public PlatformView create(@NonNull Context context, int id, @Nullable Object ar builder.setInitialTileOverlays(params.getInitialTileOverlays()); builder.setInitialGroundOverlays(params.getInitialGroundOverlays()); - final String cloudMapId = mapConfig.getCloudMapId(); + final String cloudMapId = mapConfig.getMapId(); if (cloudMapId != null) { builder.setMapId(cloudMapId); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java index 8507c6de157..d37e4854fba 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java @@ -1074,26 +1074,26 @@ public void setConsumeTapEvents(@NonNull Boolean setterArg) { this.consumeTapEvents = setterArg; } - private @NonNull Long fillColor; + private @NonNull PlatformColor fillColor; - public @NonNull Long getFillColor() { + public @NonNull PlatformColor getFillColor() { return fillColor; } - public void setFillColor(@NonNull Long setterArg) { + public void setFillColor(@NonNull PlatformColor setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"fillColor\" is null."); } this.fillColor = setterArg; } - private @NonNull Long strokeColor; + private @NonNull PlatformColor strokeColor; - public @NonNull Long getStrokeColor() { + public @NonNull PlatformColor getStrokeColor() { return strokeColor; } - public void setStrokeColor(@NonNull Long setterArg) { + public void setStrokeColor(@NonNull PlatformColor setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"strokeColor\" is null."); } @@ -1225,18 +1225,18 @@ public static final class Builder { return this; } - private @Nullable Long fillColor; + private @Nullable PlatformColor fillColor; @CanIgnoreReturnValue - public @NonNull Builder setFillColor(@NonNull Long setterArg) { + public @NonNull Builder setFillColor(@NonNull PlatformColor setterArg) { this.fillColor = setterArg; return this; } - private @Nullable Long strokeColor; + private @Nullable PlatformColor strokeColor; @CanIgnoreReturnValue - public @NonNull Builder setStrokeColor(@NonNull Long setterArg) { + public @NonNull Builder setStrokeColor(@NonNull PlatformColor setterArg) { this.strokeColor = setterArg; return this; } @@ -1324,9 +1324,9 @@ ArrayList toList() { Object consumeTapEvents = pigeonVar_list.get(0); pigeonResult.setConsumeTapEvents((Boolean) consumeTapEvents); Object fillColor = pigeonVar_list.get(1); - pigeonResult.setFillColor((Long) fillColor); + pigeonResult.setFillColor((PlatformColor) fillColor); Object strokeColor = pigeonVar_list.get(2); - pigeonResult.setStrokeColor((Long) strokeColor); + pigeonResult.setStrokeColor((PlatformColor) strokeColor); Object visible = pigeonVar_list.get(3); pigeonResult.setVisible((Boolean) visible); Object strokeWidth = pigeonVar_list.get(4); @@ -1585,6 +1585,79 @@ ArrayList toList() { } } + /** + * Pigeon equivalent of the Color class. + * + *

See https://developer.android.com/reference/android/graphics/Color.html. + * + *

Generated class from Pigeon that represents data sent in messages. + */ + public static final class PlatformColor { + private @NonNull Long argbValue; + + public @NonNull Long getArgbValue() { + return argbValue; + } + + public void setArgbValue(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"argbValue\" is null."); + } + this.argbValue = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + PlatformColor() {} + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PlatformColor that = (PlatformColor) o; + return argbValue.equals(that.argbValue); + } + + @Override + public int hashCode() { + return Objects.hash(argbValue); + } + + public static final class Builder { + + private @Nullable Long argbValue; + + @CanIgnoreReturnValue + public @NonNull Builder setArgbValue(@NonNull Long setterArg) { + this.argbValue = setterArg; + return this; + } + + public @NonNull PlatformColor build() { + PlatformColor pigeonReturn = new PlatformColor(); + pigeonReturn.setArgbValue(argbValue); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList<>(1); + toListResult.add(argbValue); + return toListResult; + } + + static @NonNull PlatformColor fromList(@NonNull ArrayList pigeonVar_list) { + PlatformColor pigeonResult = new PlatformColor(); + Object argbValue = pigeonVar_list.get(0); + pigeonResult.setArgbValue((Long) argbValue); + return pigeonResult; + } + } + /** * Pigeon equivalent of the InfoWindow class. * @@ -2127,13 +2200,13 @@ public void setConsumesTapEvents(@NonNull Boolean setterArg) { this.consumesTapEvents = setterArg; } - private @NonNull Long fillColor; + private @NonNull PlatformColor fillColor; - public @NonNull Long getFillColor() { + public @NonNull PlatformColor getFillColor() { return fillColor; } - public void setFillColor(@NonNull Long setterArg) { + public void setFillColor(@NonNull PlatformColor setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"fillColor\" is null."); } @@ -2192,13 +2265,13 @@ public void setVisible(@NonNull Boolean setterArg) { this.visible = setterArg; } - private @NonNull Long strokeColor; + private @NonNull PlatformColor strokeColor; - public @NonNull Long getStrokeColor() { + public @NonNull PlatformColor getStrokeColor() { return strokeColor; } - public void setStrokeColor(@NonNull Long setterArg) { + public void setStrokeColor(@NonNull PlatformColor setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"strokeColor\" is null."); } @@ -2288,10 +2361,10 @@ public static final class Builder { return this; } - private @Nullable Long fillColor; + private @Nullable PlatformColor fillColor; @CanIgnoreReturnValue - public @NonNull Builder setFillColor(@NonNull Long setterArg) { + public @NonNull Builder setFillColor(@NonNull PlatformColor setterArg) { this.fillColor = setterArg; return this; } @@ -2328,10 +2401,10 @@ public static final class Builder { return this; } - private @Nullable Long strokeColor; + private @Nullable PlatformColor strokeColor; @CanIgnoreReturnValue - public @NonNull Builder setStrokeColor(@NonNull Long setterArg) { + public @NonNull Builder setStrokeColor(@NonNull PlatformColor setterArg) { this.strokeColor = setterArg; return this; } @@ -2391,7 +2464,7 @@ ArrayList toList() { Object consumesTapEvents = pigeonVar_list.get(1); pigeonResult.setConsumesTapEvents((Boolean) consumesTapEvents); Object fillColor = pigeonVar_list.get(2); - pigeonResult.setFillColor((Long) fillColor); + pigeonResult.setFillColor((PlatformColor) fillColor); Object geodesic = pigeonVar_list.get(3); pigeonResult.setGeodesic((Boolean) geodesic); Object points = pigeonVar_list.get(4); @@ -2401,7 +2474,7 @@ ArrayList toList() { Object visible = pigeonVar_list.get(6); pigeonResult.setVisible((Boolean) visible); Object strokeColor = pigeonVar_list.get(7); - pigeonResult.setStrokeColor((Long) strokeColor); + pigeonResult.setStrokeColor((PlatformColor) strokeColor); Object strokeWidth = pigeonVar_list.get(8); pigeonResult.setStrokeWidth((Long) strokeWidth); Object zIndex = pigeonVar_list.get(9); @@ -2442,13 +2515,13 @@ public void setConsumesTapEvents(@NonNull Boolean setterArg) { this.consumesTapEvents = setterArg; } - private @NonNull Long color; + private @NonNull PlatformColor color; - public @NonNull Long getColor() { + public @NonNull PlatformColor getColor() { return color; } - public void setColor(@NonNull Long setterArg) { + public void setColor(@NonNull PlatformColor setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"color\" is null."); } @@ -2639,10 +2712,10 @@ public static final class Builder { return this; } - private @Nullable Long color; + private @Nullable PlatformColor color; @CanIgnoreReturnValue - public @NonNull Builder setColor(@NonNull Long setterArg) { + public @NonNull Builder setColor(@NonNull PlatformColor setterArg) { this.color = setterArg; return this; } @@ -2762,7 +2835,7 @@ ArrayList toList() { Object consumesTapEvents = pigeonVar_list.get(1); pigeonResult.setConsumesTapEvents((Boolean) consumesTapEvents); Object color = pigeonVar_list.get(2); - pigeonResult.setColor((Long) color); + pigeonResult.setColor((PlatformColor) color); Object geodesic = pigeonVar_list.get(3); pigeonResult.setGeodesic((Boolean) geodesic); Object jointType = pigeonVar_list.get(4); @@ -4735,14 +4808,14 @@ public void setLiteModeEnabled(@Nullable Boolean setterArg) { this.liteModeEnabled = setterArg; } - private @Nullable String cloudMapId; + private @Nullable String mapId; - public @Nullable String getCloudMapId() { - return cloudMapId; + public @Nullable String getMapId() { + return mapId; } - public void setCloudMapId(@Nullable String setterArg) { - this.cloudMapId = setterArg; + public void setMapId(@Nullable String setterArg) { + this.mapId = setterArg; } private @Nullable String style; @@ -4782,7 +4855,7 @@ public boolean equals(Object o) { && Objects.equals(trafficEnabled, that.trafficEnabled) && Objects.equals(buildingsEnabled, that.buildingsEnabled) && Objects.equals(liteModeEnabled, that.liteModeEnabled) - && Objects.equals(cloudMapId, that.cloudMapId) + && Objects.equals(mapId, that.mapId) && Objects.equals(style, that.style); } @@ -4807,7 +4880,7 @@ public int hashCode() { trafficEnabled, buildingsEnabled, liteModeEnabled, - cloudMapId, + mapId, style); } @@ -4958,11 +5031,11 @@ public static final class Builder { return this; } - private @Nullable String cloudMapId; + private @Nullable String mapId; @CanIgnoreReturnValue - public @NonNull Builder setCloudMapId(@Nullable String setterArg) { - this.cloudMapId = setterArg; + public @NonNull Builder setMapId(@Nullable String setterArg) { + this.mapId = setterArg; return this; } @@ -4994,7 +5067,7 @@ public static final class Builder { pigeonReturn.setTrafficEnabled(trafficEnabled); pigeonReturn.setBuildingsEnabled(buildingsEnabled); pigeonReturn.setLiteModeEnabled(liteModeEnabled); - pigeonReturn.setCloudMapId(cloudMapId); + pigeonReturn.setMapId(mapId); pigeonReturn.setStyle(style); return pigeonReturn; } @@ -5021,7 +5094,7 @@ ArrayList toList() { toListResult.add(trafficEnabled); toListResult.add(buildingsEnabled); toListResult.add(liteModeEnabled); - toListResult.add(cloudMapId); + toListResult.add(mapId); toListResult.add(style); return toListResult; } @@ -5064,8 +5137,8 @@ ArrayList toList() { pigeonResult.setBuildingsEnabled((Boolean) buildingsEnabled); Object liteModeEnabled = pigeonVar_list.get(17); pigeonResult.setLiteModeEnabled((Boolean) liteModeEnabled); - Object cloudMapId = pigeonVar_list.get(18); - pigeonResult.setCloudMapId((String) cloudMapId); + Object mapId = pigeonVar_list.get(18); + pigeonResult.setMapId((String) mapId); Object style = pigeonVar_list.get(19); pigeonResult.setStyle((String) style); return pigeonResult; @@ -6275,56 +6348,58 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 148: return PlatformDoublePair.fromList((ArrayList) readValue(buffer)); case (byte) 149: - return PlatformInfoWindow.fromList((ArrayList) readValue(buffer)); + return PlatformColor.fromList((ArrayList) readValue(buffer)); case (byte) 150: - return PlatformMarker.fromList((ArrayList) readValue(buffer)); + return PlatformInfoWindow.fromList((ArrayList) readValue(buffer)); case (byte) 151: - return PlatformPolygon.fromList((ArrayList) readValue(buffer)); + return PlatformMarker.fromList((ArrayList) readValue(buffer)); case (byte) 152: - return PlatformPolyline.fromList((ArrayList) readValue(buffer)); + return PlatformPolygon.fromList((ArrayList) readValue(buffer)); case (byte) 153: - return PlatformCap.fromList((ArrayList) readValue(buffer)); + return PlatformPolyline.fromList((ArrayList) readValue(buffer)); case (byte) 154: - return PlatformPatternItem.fromList((ArrayList) readValue(buffer)); + return PlatformCap.fromList((ArrayList) readValue(buffer)); case (byte) 155: - return PlatformTile.fromList((ArrayList) readValue(buffer)); + return PlatformPatternItem.fromList((ArrayList) readValue(buffer)); case (byte) 156: - return PlatformTileOverlay.fromList((ArrayList) readValue(buffer)); + return PlatformTile.fromList((ArrayList) readValue(buffer)); case (byte) 157: - return PlatformEdgeInsets.fromList((ArrayList) readValue(buffer)); + return PlatformTileOverlay.fromList((ArrayList) readValue(buffer)); case (byte) 158: - return PlatformLatLng.fromList((ArrayList) readValue(buffer)); + return PlatformEdgeInsets.fromList((ArrayList) readValue(buffer)); case (byte) 159: - return PlatformLatLngBounds.fromList((ArrayList) readValue(buffer)); + return PlatformLatLng.fromList((ArrayList) readValue(buffer)); case (byte) 160: - return PlatformCluster.fromList((ArrayList) readValue(buffer)); + return PlatformLatLngBounds.fromList((ArrayList) readValue(buffer)); case (byte) 161: - return PlatformGroundOverlay.fromList((ArrayList) readValue(buffer)); + return PlatformCluster.fromList((ArrayList) readValue(buffer)); case (byte) 162: - return PlatformCameraTargetBounds.fromList((ArrayList) readValue(buffer)); + return PlatformGroundOverlay.fromList((ArrayList) readValue(buffer)); case (byte) 163: - return PlatformMapViewCreationParams.fromList((ArrayList) readValue(buffer)); + return PlatformCameraTargetBounds.fromList((ArrayList) readValue(buffer)); case (byte) 164: - return PlatformMapConfiguration.fromList((ArrayList) readValue(buffer)); + return PlatformMapViewCreationParams.fromList((ArrayList) readValue(buffer)); case (byte) 165: - return PlatformPoint.fromList((ArrayList) readValue(buffer)); + return PlatformMapConfiguration.fromList((ArrayList) readValue(buffer)); case (byte) 166: - return PlatformTileLayer.fromList((ArrayList) readValue(buffer)); + return PlatformPoint.fromList((ArrayList) readValue(buffer)); case (byte) 167: - return PlatformZoomRange.fromList((ArrayList) readValue(buffer)); + return PlatformTileLayer.fromList((ArrayList) readValue(buffer)); case (byte) 168: - return PlatformBitmap.fromList((ArrayList) readValue(buffer)); + return PlatformZoomRange.fromList((ArrayList) readValue(buffer)); case (byte) 169: - return PlatformBitmapDefaultMarker.fromList((ArrayList) readValue(buffer)); + return PlatformBitmap.fromList((ArrayList) readValue(buffer)); case (byte) 170: - return PlatformBitmapBytes.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapDefaultMarker.fromList((ArrayList) readValue(buffer)); case (byte) 171: - return PlatformBitmapAsset.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapBytes.fromList((ArrayList) readValue(buffer)); case (byte) 172: - return PlatformBitmapAssetImage.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapAsset.fromList((ArrayList) readValue(buffer)); case (byte) 173: - return PlatformBitmapAssetMap.fromList((ArrayList) readValue(buffer)); + return PlatformBitmapAssetImage.fromList((ArrayList) readValue(buffer)); case (byte) 174: + return PlatformBitmapAssetMap.fromList((ArrayList) readValue(buffer)); + case (byte) 175: return PlatformBitmapBytesMap.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); @@ -6393,83 +6468,86 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformDoublePair) { stream.write(148); writeValue(stream, ((PlatformDoublePair) value).toList()); - } else if (value instanceof PlatformInfoWindow) { + } else if (value instanceof PlatformColor) { stream.write(149); + writeValue(stream, ((PlatformColor) value).toList()); + } else if (value instanceof PlatformInfoWindow) { + stream.write(150); writeValue(stream, ((PlatformInfoWindow) value).toList()); } else if (value instanceof PlatformMarker) { - stream.write(150); + stream.write(151); writeValue(stream, ((PlatformMarker) value).toList()); } else if (value instanceof PlatformPolygon) { - stream.write(151); + stream.write(152); writeValue(stream, ((PlatformPolygon) value).toList()); } else if (value instanceof PlatformPolyline) { - stream.write(152); + stream.write(153); writeValue(stream, ((PlatformPolyline) value).toList()); } else if (value instanceof PlatformCap) { - stream.write(153); + stream.write(154); writeValue(stream, ((PlatformCap) value).toList()); } else if (value instanceof PlatformPatternItem) { - stream.write(154); + stream.write(155); writeValue(stream, ((PlatformPatternItem) value).toList()); } else if (value instanceof PlatformTile) { - stream.write(155); + stream.write(156); writeValue(stream, ((PlatformTile) value).toList()); } else if (value instanceof PlatformTileOverlay) { - stream.write(156); + stream.write(157); writeValue(stream, ((PlatformTileOverlay) value).toList()); } else if (value instanceof PlatformEdgeInsets) { - stream.write(157); + stream.write(158); writeValue(stream, ((PlatformEdgeInsets) value).toList()); } else if (value instanceof PlatformLatLng) { - stream.write(158); + stream.write(159); writeValue(stream, ((PlatformLatLng) value).toList()); } else if (value instanceof PlatformLatLngBounds) { - stream.write(159); + stream.write(160); writeValue(stream, ((PlatformLatLngBounds) value).toList()); } else if (value instanceof PlatformCluster) { - stream.write(160); + stream.write(161); writeValue(stream, ((PlatformCluster) value).toList()); } else if (value instanceof PlatformGroundOverlay) { - stream.write(161); + stream.write(162); writeValue(stream, ((PlatformGroundOverlay) value).toList()); } else if (value instanceof PlatformCameraTargetBounds) { - stream.write(162); + stream.write(163); writeValue(stream, ((PlatformCameraTargetBounds) value).toList()); } else if (value instanceof PlatformMapViewCreationParams) { - stream.write(163); + stream.write(164); writeValue(stream, ((PlatformMapViewCreationParams) value).toList()); } else if (value instanceof PlatformMapConfiguration) { - stream.write(164); + stream.write(165); writeValue(stream, ((PlatformMapConfiguration) value).toList()); } else if (value instanceof PlatformPoint) { - stream.write(165); + stream.write(166); writeValue(stream, ((PlatformPoint) value).toList()); } else if (value instanceof PlatformTileLayer) { - stream.write(166); + stream.write(167); writeValue(stream, ((PlatformTileLayer) value).toList()); } else if (value instanceof PlatformZoomRange) { - stream.write(167); + stream.write(168); writeValue(stream, ((PlatformZoomRange) value).toList()); } else if (value instanceof PlatformBitmap) { - stream.write(168); + stream.write(169); writeValue(stream, ((PlatformBitmap) value).toList()); } else if (value instanceof PlatformBitmapDefaultMarker) { - stream.write(169); + stream.write(170); writeValue(stream, ((PlatformBitmapDefaultMarker) value).toList()); } else if (value instanceof PlatformBitmapBytes) { - stream.write(170); + stream.write(171); writeValue(stream, ((PlatformBitmapBytes) value).toList()); } else if (value instanceof PlatformBitmapAsset) { - stream.write(171); + stream.write(172); writeValue(stream, ((PlatformBitmapAsset) value).toList()); } else if (value instanceof PlatformBitmapAssetImage) { - stream.write(172); + stream.write(173); writeValue(stream, ((PlatformBitmapAssetImage) value).toList()); } else if (value instanceof PlatformBitmapAssetMap) { - stream.write(173); + stream.write(174); writeValue(stream, ((PlatformBitmapAssetMap) value).toList()); } else if (value instanceof PlatformBitmapBytesMap) { - stream.write(174); + stream.write(175); writeValue(stream, ((PlatformBitmapBytesMap) value).toList()); } else { super.writeValue(stream, value); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java index 8ca208c7ba1..dcd07ecd6c7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java @@ -52,10 +52,10 @@ public void controller_changeCircles_updatesExistingCircle() { builder .setCircleId(id) .setConsumeTapEvents(false) - .setFillColor(0L) + .setFillColor(new Messages.PlatformColor.Builder().setArgbValue(0L).build()) .setCenter(new Messages.PlatformLatLng.Builder().setLatitude(0.0).setLongitude(0.0).build()) .setRadius(1.0) - .setStrokeColor(0L) + .setStrokeColor(new Messages.PlatformColor.Builder().setArgbValue(0L).build()) .setStrokeWidth(1L) .setVisible(true) .setZIndex(0.0); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart index d421bcf9718..89dcced0918 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart @@ -65,6 +65,7 @@ void main() { // value. expect( initializedRenderer == AndroidMapRenderer.latest || + // ignore: deprecated_member_use initializedRenderer == AndroidMapRenderer.legacy, true, ); @@ -1468,7 +1469,7 @@ void main() { } }); - testWidgets('testCloudMapId', (WidgetTester tester) async { + testWidgets('testMapId', (WidgetTester tester) async { final Completer mapIdCompleter = Completer(); final Key key = GlobalKey(); @@ -1481,7 +1482,7 @@ void main() { onMapCreated: (ExampleGoogleMapController controller) { mapIdCompleter.complete(controller.mapId); }, - cloudMapId: _kCloudMapId, + mapId: _kCloudMapId, ), ), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart index bee30555b2e..518304c93fd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart @@ -316,7 +316,7 @@ class ExampleGoogleMap extends StatefulWidget { this.onCameraIdle, this.onTap, this.onLongPress, - this.cloudMapId, + this.mapId, this.style, }); @@ -430,7 +430,7 @@ class ExampleGoogleMap extends StatefulWidget { /// /// See https://developers.google.com/maps/documentation/get-map-id /// for more details. - final String? cloudMapId; + final String? mapId; /// The locally configured style for the map. final String? style; @@ -680,7 +680,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) { indoorViewEnabled: map.indoorViewEnabled, trafficEnabled: map.trafficEnabled, buildingsEnabled: map.buildingsEnabled, - cloudMapId: map.cloudMapId, + mapId: map.mapId, style: map.style, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart index 039966595ba..fb33ce4ab9b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart @@ -53,6 +53,7 @@ class MapIdBodyState extends State { switch (_initializedRenderer) { case AndroidMapRenderer.latest: return 'latest'; + // ignore: deprecated_member_use case AndroidMapRenderer.legacy: return 'legacy'; case AndroidMapRenderer.platformDefault: @@ -80,7 +81,7 @@ class MapIdBodyState extends State { zoom: 7.0, ), key: _key, - cloudMapId: _mapId, + mapId: _mapId, ); final List columnChildren = [ diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart index 34d05ca6f8f..7996c8c7967 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart @@ -16,9 +16,6 @@ import 'google_map_inspector_android.dart'; import 'messages.g.dart'; import 'serialization.dart'; -// TODO(stuartmorgan): Remove the dependency on platform interface toJson -// methods. Channel serialization details should all be package-internal. - /// The non-test implementation of `_apiProvider`. MapsApi _productionApiProvider(int mapId) { return MapsApi(messageChannelSuffix: mapId.toString()); @@ -774,8 +771,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { static PlatformCircle _platformCircleFromCircle(Circle circle) { return PlatformCircle( consumeTapEvents: circle.consumeTapEvents, - fillColor: circle.fillColor.value, - strokeColor: circle.strokeColor.value, + fillColor: PlatformColor(argbValue: circle.fillColor.toARGB32()), + strokeColor: PlatformColor(argbValue: circle.strokeColor.toARGB32()), visible: circle.visible, strokeWidth: circle.strokeWidth, zIndex: circle.zIndex.toDouble(), @@ -862,12 +859,12 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { }).toList(); return PlatformPolygon( polygonId: polygon.polygonId.value, - fillColor: polygon.fillColor.value, + fillColor: PlatformColor(argbValue: polygon.fillColor.toARGB32()), geodesic: polygon.geodesic, consumesTapEvents: polygon.consumeTapEvents, points: points, holes: holes, - strokeColor: polygon.strokeColor.value, + strokeColor: PlatformColor(argbValue: polygon.strokeColor.toARGB32()), strokeWidth: polygon.strokeWidth, zIndex: polygon.zIndex, visible: polygon.visible, @@ -884,7 +881,7 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { return PlatformPolyline( polylineId: polyline.polylineId.value, consumesTapEvents: polyline.consumeTapEvents, - color: polyline.color.value, + color: PlatformColor(argbValue: polyline.color.toARGB32()), startCap: platformCapFromCap(polyline.startCap), endCap: platformCapFromCap(polyline.endCap), geodesic: polyline.geodesic, @@ -1372,7 +1369,7 @@ PlatformMapConfiguration _platformMapConfigurationFromMapConfiguration( trafficEnabled: config.trafficEnabled, buildingsEnabled: config.buildingsEnabled, liteModeEnabled: config.liteModeEnabled, - cloudMapId: config.cloudMapId, + mapId: config.mapId, style: config.style, ); } @@ -1417,7 +1414,7 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( trafficEnabled: options['trafficEnabled'] as bool?, buildingsEnabled: options['buildingsEnabled'] as bool?, liteModeEnabled: options['liteModeEnabled'] as bool?, - cloudMapId: options['cloudMapId'] as String?, + mapId: options['cloudMapId'] as String?, style: options['style'] as String?, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart index 0b1342f448d..09f5bef55d6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart @@ -488,8 +488,8 @@ class PlatformCameraUpdateZoomTo { class PlatformCircle { PlatformCircle({ this.consumeTapEvents = false, - this.fillColor = 0x00000000, - this.strokeColor = 0xFF000000, + required this.fillColor, + required this.strokeColor, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -500,9 +500,9 @@ class PlatformCircle { bool consumeTapEvents; - int fillColor; + PlatformColor fillColor; - int strokeColor; + PlatformColor strokeColor; bool visible; @@ -538,8 +538,8 @@ class PlatformCircle { result as List; return PlatformCircle( consumeTapEvents: result[0]! as bool, - fillColor: result[1]! as int, - strokeColor: result[2]! as int, + fillColor: result[1]! as PlatformColor, + strokeColor: result[2]! as PlatformColor, visible: result[3]! as bool, strokeWidth: result[4]! as int, zIndex: result[5]! as double, @@ -681,6 +681,44 @@ class PlatformDoublePair { int get hashCode => Object.hashAll(_toList()); } +/// Pigeon equivalent of the Color class. +/// +/// See https://developer.android.com/reference/android/graphics/Color.html. +class PlatformColor { + PlatformColor({required this.argbValue}); + + int argbValue; + + List _toList() { + return [argbValue]; + } + + Object encode() { + return _toList(); + } + + static PlatformColor decode(Object result) { + result as List; + return PlatformColor(argbValue: result[0]! as int); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformColor || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + /// Pigeon equivalent of the InfoWindow class. class PlatformInfoWindow { PlatformInfoWindow({this.title, this.snippet, required this.anchor}); @@ -846,7 +884,7 @@ class PlatformPolygon { bool consumesTapEvents; - int fillColor; + PlatformColor fillColor; bool geodesic; @@ -856,7 +894,7 @@ class PlatformPolygon { bool visible; - int strokeColor; + PlatformColor strokeColor; int strokeWidth; @@ -886,12 +924,12 @@ class PlatformPolygon { return PlatformPolygon( polygonId: result[0]! as String, consumesTapEvents: result[1]! as bool, - fillColor: result[2]! as int, + fillColor: result[2]! as PlatformColor, geodesic: result[3]! as bool, points: (result[4] as List?)!.cast(), holes: (result[5] as List?)!.cast>(), visible: result[6]! as bool, - strokeColor: result[7]! as int, + strokeColor: result[7]! as PlatformColor, strokeWidth: result[8]! as int, zIndex: result[9]! as int, ); @@ -935,7 +973,7 @@ class PlatformPolyline { bool consumesTapEvents; - int color; + PlatformColor color; bool geodesic; @@ -985,7 +1023,7 @@ class PlatformPolyline { return PlatformPolyline( polylineId: result[0]! as String, consumesTapEvents: result[1]! as bool, - color: result[2]! as int, + color: result[2]! as PlatformColor, geodesic: result[3]! as bool, jointType: result[4]! as PlatformJointType, patterns: (result[5] as List?)!.cast(), @@ -1649,7 +1687,7 @@ class PlatformMapConfiguration { this.trafficEnabled, this.buildingsEnabled, this.liteModeEnabled, - this.cloudMapId, + this.mapId, this.style, }); @@ -1689,7 +1727,7 @@ class PlatformMapConfiguration { bool? liteModeEnabled; - String? cloudMapId; + String? mapId; String? style; @@ -1713,7 +1751,7 @@ class PlatformMapConfiguration { trafficEnabled, buildingsEnabled, liteModeEnabled, - cloudMapId, + mapId, style, ]; } @@ -1743,7 +1781,7 @@ class PlatformMapConfiguration { trafficEnabled: result[15] as bool?, buildingsEnabled: result[16] as bool?, liteModeEnabled: result[17] as bool?, - cloudMapId: result[18] as String?, + mapId: result[18] as String?, style: result[19] as String?, ); } @@ -2295,84 +2333,87 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformDoublePair) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformInfoWindow) { + } else if (value is PlatformColor) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PlatformMarker) { + } else if (value is PlatformInfoWindow) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PlatformPolygon) { + } else if (value is PlatformMarker) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is PlatformPolyline) { + } else if (value is PlatformPolygon) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is PlatformCap) { + } else if (value is PlatformPolyline) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is PlatformPatternItem) { + } else if (value is PlatformCap) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is PlatformTile) { + } else if (value is PlatformPatternItem) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is PlatformTileOverlay) { + } else if (value is PlatformTile) { buffer.putUint8(156); writeValue(buffer, value.encode()); - } else if (value is PlatformEdgeInsets) { + } else if (value is PlatformTileOverlay) { buffer.putUint8(157); writeValue(buffer, value.encode()); - } else if (value is PlatformLatLng) { + } else if (value is PlatformEdgeInsets) { buffer.putUint8(158); writeValue(buffer, value.encode()); - } else if (value is PlatformLatLngBounds) { + } else if (value is PlatformLatLng) { buffer.putUint8(159); writeValue(buffer, value.encode()); - } else if (value is PlatformCluster) { + } else if (value is PlatformLatLngBounds) { buffer.putUint8(160); writeValue(buffer, value.encode()); - } else if (value is PlatformGroundOverlay) { + } else if (value is PlatformCluster) { buffer.putUint8(161); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraTargetBounds) { + } else if (value is PlatformGroundOverlay) { buffer.putUint8(162); writeValue(buffer, value.encode()); - } else if (value is PlatformMapViewCreationParams) { + } else if (value is PlatformCameraTargetBounds) { buffer.putUint8(163); writeValue(buffer, value.encode()); - } else if (value is PlatformMapConfiguration) { + } else if (value is PlatformMapViewCreationParams) { buffer.putUint8(164); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformMapConfiguration) { buffer.putUint8(165); writeValue(buffer, value.encode()); - } else if (value is PlatformTileLayer) { + } else if (value is PlatformPoint) { buffer.putUint8(166); writeValue(buffer, value.encode()); - } else if (value is PlatformZoomRange) { + } else if (value is PlatformTileLayer) { buffer.putUint8(167); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmap) { + } else if (value is PlatformZoomRange) { buffer.putUint8(168); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapDefaultMarker) { + } else if (value is PlatformBitmap) { buffer.putUint8(169); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytes) { + } else if (value is PlatformBitmapDefaultMarker) { buffer.putUint8(170); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAsset) { + } else if (value is PlatformBitmapBytes) { buffer.putUint8(171); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetImage) { + } else if (value is PlatformBitmapAsset) { buffer.putUint8(172); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetMap) { + } else if (value is PlatformBitmapAssetImage) { buffer.putUint8(173); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytesMap) { + } else if (value is PlatformBitmapAssetMap) { buffer.putUint8(174); writeValue(buffer, value.encode()); + } else if (value is PlatformBitmapBytesMap) { + buffer.putUint8(175); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2428,56 +2469,58 @@ class _PigeonCodec extends StandardMessageCodec { case 148: return PlatformDoublePair.decode(readValue(buffer)!); case 149: - return PlatformInfoWindow.decode(readValue(buffer)!); + return PlatformColor.decode(readValue(buffer)!); case 150: - return PlatformMarker.decode(readValue(buffer)!); + return PlatformInfoWindow.decode(readValue(buffer)!); case 151: - return PlatformPolygon.decode(readValue(buffer)!); + return PlatformMarker.decode(readValue(buffer)!); case 152: - return PlatformPolyline.decode(readValue(buffer)!); + return PlatformPolygon.decode(readValue(buffer)!); case 153: - return PlatformCap.decode(readValue(buffer)!); + return PlatformPolyline.decode(readValue(buffer)!); case 154: - return PlatformPatternItem.decode(readValue(buffer)!); + return PlatformCap.decode(readValue(buffer)!); case 155: - return PlatformTile.decode(readValue(buffer)!); + return PlatformPatternItem.decode(readValue(buffer)!); case 156: - return PlatformTileOverlay.decode(readValue(buffer)!); + return PlatformTile.decode(readValue(buffer)!); case 157: - return PlatformEdgeInsets.decode(readValue(buffer)!); + return PlatformTileOverlay.decode(readValue(buffer)!); case 158: - return PlatformLatLng.decode(readValue(buffer)!); + return PlatformEdgeInsets.decode(readValue(buffer)!); case 159: - return PlatformLatLngBounds.decode(readValue(buffer)!); + return PlatformLatLng.decode(readValue(buffer)!); case 160: - return PlatformCluster.decode(readValue(buffer)!); + return PlatformLatLngBounds.decode(readValue(buffer)!); case 161: - return PlatformGroundOverlay.decode(readValue(buffer)!); + return PlatformCluster.decode(readValue(buffer)!); case 162: - return PlatformCameraTargetBounds.decode(readValue(buffer)!); + return PlatformGroundOverlay.decode(readValue(buffer)!); case 163: - return PlatformMapViewCreationParams.decode(readValue(buffer)!); + return PlatformCameraTargetBounds.decode(readValue(buffer)!); case 164: - return PlatformMapConfiguration.decode(readValue(buffer)!); + return PlatformMapViewCreationParams.decode(readValue(buffer)!); case 165: - return PlatformPoint.decode(readValue(buffer)!); + return PlatformMapConfiguration.decode(readValue(buffer)!); case 166: - return PlatformTileLayer.decode(readValue(buffer)!); + return PlatformPoint.decode(readValue(buffer)!); case 167: - return PlatformZoomRange.decode(readValue(buffer)!); + return PlatformTileLayer.decode(readValue(buffer)!); case 168: - return PlatformBitmap.decode(readValue(buffer)!); + return PlatformZoomRange.decode(readValue(buffer)!); case 169: - return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); + return PlatformBitmap.decode(readValue(buffer)!); case 170: - return PlatformBitmapBytes.decode(readValue(buffer)!); + return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); case 171: - return PlatformBitmapAsset.decode(readValue(buffer)!); + return PlatformBitmapBytes.decode(readValue(buffer)!); case 172: - return PlatformBitmapAssetImage.decode(readValue(buffer)!); + return PlatformBitmapAsset.decode(readValue(buffer)!); case 173: - return PlatformBitmapAssetMap.decode(readValue(buffer)!); + return PlatformBitmapAssetImage.decode(readValue(buffer)!); case 174: + return PlatformBitmapAssetMap.decode(readValue(buffer)!); + case 175: return PlatformBitmapBytesMap.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart index 7a9aca87b9a..4e744a9af53 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart @@ -86,7 +86,9 @@ Object serializeHeatmapGradient(HeatmapGradient gradient) { _addIfNonNull( json, _heatmapGradientColorsKey, - gradient.colors.map((HeatmapGradientColor e) => e.color.value).toList(), + gradient.colors + .map((HeatmapGradientColor e) => e.color.toARGB32()) + .toList(), ); _addIfNonNull( json, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart index bcb3e418c02..1a31450f188 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart @@ -104,9 +104,9 @@ class PlatformCircle { PlatformCircle({ required this.circleId, required this.center, + required this.fillColor, + required this.strokeColor, this.consumeTapEvents = false, - this.fillColor = 0x00000000, - this.strokeColor = 0xFF000000, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -114,8 +114,8 @@ class PlatformCircle { }); final bool consumeTapEvents; - final int fillColor; - final int strokeColor; + final PlatformColor fillColor; + final PlatformColor strokeColor; final bool visible; final int strokeWidth; final double zIndex; @@ -151,6 +151,15 @@ class PlatformDoublePair { final double y; } +/// Pigeon equivalent of the Color class. +/// +/// See https://developer.android.com/reference/android/graphics/Color.html. +class PlatformColor { + const PlatformColor(this.argbValue); + + final int argbValue; +} + /// Pigeon equivalent of the InfoWindow class. class PlatformInfoWindow { PlatformInfoWindow({required this.anchor, this.title, this.snippet}); @@ -211,12 +220,12 @@ class PlatformPolygon { final String polygonId; final bool consumesTapEvents; - final int fillColor; + final PlatformColor fillColor; final bool geodesic; final List points; final List> holes; final bool visible; - final int strokeColor; + final PlatformColor strokeColor; final int strokeWidth; final int zIndex; } @@ -243,7 +252,7 @@ class PlatformPolyline { final String polylineId; final bool consumesTapEvents; - final int color; + final PlatformColor color; final bool geodesic; /// The joint type. @@ -453,7 +462,7 @@ class PlatformMapConfiguration { required this.trafficEnabled, required this.buildingsEnabled, required this.liteModeEnabled, - required this.cloudMapId, + required this.mapId, required this.style, }); @@ -475,7 +484,7 @@ class PlatformMapConfiguration { final bool? trafficEnabled; final bool? buildingsEnabled; final bool? liteModeEnabled; - final String? cloudMapId; + final String? mapId; final String? style; } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index 4c272074a70..bb75e4469ea 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.18.5 +version: 2.18.6 environment: sdk: ^3.9.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart index 3569b0098c3..55d1ba2eec1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart @@ -457,8 +457,11 @@ void main() { expect(toChange.length, 1); final PlatformCircle firstChanged = toChange.first; expect(firstChanged.consumeTapEvents, object2new.consumeTapEvents); - expect(firstChanged.fillColor, object2new.fillColor.value); - expect(firstChanged.strokeColor, object2new.strokeColor.value); + expect(firstChanged.fillColor.argbValue, object2new.fillColor.toARGB32()); + expect( + firstChanged.strokeColor.argbValue, + object2new.strokeColor.toARGB32(), + ); expect(firstChanged.visible, object2new.visible); expect(firstChanged.strokeWidth, object2new.strokeWidth); expect(firstChanged.zIndex, object2new.zIndex.toDouble()); @@ -472,8 +475,8 @@ void main() { expect(toAdd.length, 1); final PlatformCircle firstAdded = toAdd.first; expect(firstAdded.consumeTapEvents, object3.consumeTapEvents); - expect(firstAdded.fillColor, object3.fillColor.value); - expect(firstAdded.strokeColor, object3.strokeColor.value); + expect(firstAdded.fillColor.argbValue, object3.fillColor.toARGB32()); + expect(firstAdded.strokeColor.argbValue, object3.strokeColor.toARGB32()); expect(firstAdded.visible, object3.visible); expect(firstAdded.strokeWidth, object3.strokeWidth); expect(firstAdded.zIndex, object3.zIndex.toDouble()); @@ -641,7 +644,7 @@ void main() { void expectPolygon(PlatformPolygon actual, Polygon expected) { expect(actual.polygonId, expected.polygonId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - expect(actual.fillColor, expected.fillColor.value); + expect(actual.fillColor.argbValue, expected.fillColor.toARGB32()); expect(actual.geodesic, expected.geodesic); expect(actual.points.length, expected.points.length); for (final (int i, PlatformLatLng? point) in actual.points.indexed) { @@ -657,7 +660,7 @@ void main() { } } expect(actual.visible, expected.visible); - expect(actual.strokeColor, expected.strokeColor.value); + expect(actual.strokeColor.argbValue, expected.strokeColor.toARGB32()); expect(actual.strokeWidth, expected.strokeWidth); expect(actual.zIndex, expected.zIndex); } @@ -711,7 +714,7 @@ void main() { void expectPolyline(PlatformPolyline actual, Polyline expected) { expect(actual.polylineId, expected.polylineId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - expect(actual.color, expected.color.value); + expect(actual.color.argbValue, expected.color.toARGB32()); expect(actual.geodesic, expected.geodesic); expect( actual.jointType, @@ -1497,9 +1500,9 @@ void main() { expect(widget, isA()); }); - testWidgets('cloudMapId is passed', (WidgetTester tester) async { + testWidgets('mapId is passed', (WidgetTester tester) async { const String cloudMapId = '000000000000000'; // Dummy map ID. - final Completer passedCloudMapIdCompleter = Completer(); + final Completer passedMapIdCompleter = Completer(); TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform_views, ( @@ -1517,9 +1520,9 @@ void main() { as PlatformMapViewCreationParams?; if (creationParams != null) { final String? passedMapId = - creationParams.mapConfiguration.cloudMapId; + creationParams.mapConfiguration.mapId; if (passedMapId != null) { - passedCloudMapIdCompleter.complete(passedMapId); + passedMapIdCompleter.complete(passedMapId); } } } @@ -1537,14 +1540,14 @@ void main() { initialCameraPosition: CameraPosition(target: LatLng(0, 0), zoom: 1), textDirection: TextDirection.ltr, ), - mapConfiguration: const MapConfiguration(cloudMapId: cloudMapId), + mapConfiguration: const MapConfiguration(mapId: cloudMapId), ), ); expect( - await passedCloudMapIdCompleter.future, + await passedMapIdCompleter.future, cloudMapId, - reason: 'Should pass cloudMapId on PlatformView creation message', + reason: 'Should pass mapId in PlatformView creation message', ); }); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md index 2cfb1ae67ba..b2b80b419e8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.15.8 + +* Replaces internal use of deprecated methods. + ## 2.15.7 * Updates to Pigeon 26. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart index 5eb14dbdd0e..46c0442b967 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart @@ -1397,7 +1397,7 @@ void main() { child: ExampleGoogleMap( key: key, initialCameraPosition: _kInitialCameraPosition, - cloudMapId: _kCloudMapId, + mapId: _kCloudMapId, ), ), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist index b3aaa733dfb..1f6b98f117b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist @@ -25,6 +25,6 @@ arm64 MinimumOSVersion - 12.0 + 13.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj index dd2afe77070..b394dabbb69 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 60; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -19,7 +19,7 @@ 478116522BEF8F47002F593E /* GoogleMapsPolylineControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 478116512BEF8F47002F593E /* GoogleMapsPolylineControllerTests.m */; }; 528F16832C62941000148160 /* FGMClusterManagersControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */; }; 528F16872C62952700148160 /* ExtractIconFromDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 528F16862C62952700148160 /* ExtractIconFromDataTests.m */; }; - 6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */; }; + 6851F3562835BC180032B7C8 /* FGMConversionsUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FGMConversionsUtilsTests.m */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -79,7 +79,7 @@ 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FGMClusterManagersControllerTests.m; sourceTree = ""; }; 528F16862C62952700148160 /* ExtractIconFromDataTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtractIconFromDataTests.m; sourceTree = ""; }; 61A9A8623F5CA9BBC813DC6B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLTGoogleMapJSONConversionsConversionTests.m; sourceTree = ""; }; + 6851F3552835BC180032B7C8 /* FGMConversionsUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FGMConversionsUtilsTests.m; sourceTree = ""; }; 733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -221,7 +221,7 @@ 528F16862C62952700148160 /* ExtractIconFromDataTests.m */, 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */, 339355BE2EB5359B00EBF864 /* FLTGoogleMapHeatmapControllerTests.m */, - 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */, + 6851F3552835BC180032B7C8 /* FGMConversionsUtilsTests.m */, 0DD7B6C22B744EEF00E857FD /* FLTTileProviderControllerTests.m */, F7151F12265D7ED70028CB91 /* GoogleMapsTests.m */, 339355B92EB3E4F900EBF864 /* GoogleMapsCircleControllerTests.m */, @@ -520,7 +520,7 @@ 339355BF2EB535A600EBF864 /* FLTGoogleMapHeatmapControllerTests.m in Sources */, 339355BD2EB3E56300EBF864 /* GoogleMapsTileOverlayControllerTests.m in Sources */, F7151F13265D7ED70028CB91 /* GoogleMapsTests.m in Sources */, - 6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */, + 6851F3562835BC180032B7C8 /* FGMConversionsUtilsTests.m in Sources */, 982F2A6C27BADE17003C81F4 /* PartiallyMockedMapView.m in Sources */, 330909FF2D99B7A60077A751 /* GoogleMapsMarkerControllerTests.m in Sources */, 478116522BEF8F47002F593E /* GoogleMapsPolylineControllerTests.m in Sources */, diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index cab978a8e3b..3ea203b77e3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -44,6 +44,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> #import "PartiallyMockedMapView.h" -@interface FLTGoogleMapJSONConversionsTests : XCTestCase +@interface FGMConversionUtilsTests : XCTestCase @end -@implementation FLTGoogleMapJSONConversionsTests +@implementation FGMConversionUtilsTests - (void)testGetValueOrNilWithValue { NSString *key = @"key"; @@ -39,28 +39,28 @@ - (void)testGetValueOrNilWithNSNull { - (void)testLocationFromLatLong { NSArray *latlong = @[ @1, @2 ]; - CLLocationCoordinate2D location = [FLTGoogleMapJSONConversions locationFromLatLong:latlong]; + CLLocationCoordinate2D location = [FGMHeatmapConversions locationFromLatLong:latlong]; XCTAssertEqual(location.latitude, 1); XCTAssertEqual(location.longitude, 2); } - (void)testPointFromArray { NSArray *array = @[ @1, @2 ]; - CGPoint point = [FLTGoogleMapJSONConversions pointFromArray:array]; + CGPoint point = [FGMHeatmapConversions pointFromArray:array]; XCTAssertEqual(point.x, 1); XCTAssertEqual(point.y, 2); } - (void)testArrayFromLocation { CLLocationCoordinate2D location = CLLocationCoordinate2DMake(1, 2); - NSArray *array = [FLTGoogleMapJSONConversions arrayFromLocation:location]; + NSArray *array = [FGMHeatmapConversions arrayFromLocation:location]; XCTAssertEqual([array[0] integerValue], 1); XCTAssertEqual([array[1] integerValue], 2); } - (void)testColorFromRGBA { NSNumber *rgba = @(0x01020304); - UIColor *color = [FLTGoogleMapJSONConversions colorFromRGBA:rgba]; + UIColor *color = [FGMHeatmapConversions colorFromRGBA:rgba]; CGFloat red, green, blue, alpha; BOOL success = [color getRed:&red green:&green blue:&blue alpha:&alpha]; XCTAssertTrue(success); @@ -390,7 +390,7 @@ - (void)testWeightedLatLngFromArray { NSArray *weightedLatLng = @[ @[ @1, @2 ], @3 ]; GMUWeightedLatLng *weightedLocation = - [FLTGoogleMapJSONConversions weightedLatLngFromArray:weightedLatLng]; + [FGMHeatmapConversions weightedLatLngFromArray:weightedLatLng]; // The location gets projected to different values XCTAssertEqual([weightedLocation intensity], 3); @@ -399,7 +399,7 @@ - (void)testWeightedLatLngFromArray { - (void)testWeightedLatLngFromArrayThrowsForInvalidInput { NSArray *weightedLatLng = @[]; - XCTAssertThrows([FLTGoogleMapJSONConversions weightedLatLngFromArray:weightedLatLng]); + XCTAssertThrows([FGMHeatmapConversions weightedLatLngFromArray:weightedLatLng]); } - (void)testWeightedDataFromArray { @@ -407,8 +407,7 @@ - (void)testWeightedDataFromArray { NSNumber *intensity2 = @6; NSArray *data = @[ @[ @[ @1, @2 ], intensity1 ], @[ @[ @4, @5 ], intensity2 ] ]; - NSArray *weightedData = - [FLTGoogleMapJSONConversions weightedDataFromArray:data]; + NSArray *weightedData = [FGMHeatmapConversions weightedDataFromArray:data]; XCTAssertEqual([weightedData[0] intensity], [intensity1 floatValue]); XCTAssertEqual([weightedData[1] intensity], [intensity2 floatValue]); } @@ -425,7 +424,7 @@ - (void)testGradientFromDictionary { @"colorMapSize" : colorMapSize, }; - GMUGradient *gradient = [FLTGoogleMapJSONConversions gradientFromDictionary:gradientData]; + GMUGradient *gradient = [FGMHeatmapConversions gradientFromDictionary:gradientData]; CGFloat red, green, blue, alpha; [[gradient colors][0] getRed:&red green:&green blue:&blue alpha:&alpha]; XCTAssertEqual(red, 0); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m index 44785692f28..b6da47435aa 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m @@ -26,8 +26,14 @@ - (void)testUpdateCircleSetsVisibilityLast { updateCircle:circle fromPlatformCircle:[FGMPlatformCircle makeWithConsumeTapEvents:NO - fillColor:0 - strokeColor:0 + fillColor:[FGMPlatformColor makeWithRed:0 + green:0 + blue:0 + alpha:0] + strokeColor:[FGMPlatformColor makeWithRed:0 + green:0 + blue:0 + alpha:0] visible:YES strokeWidth:0 zIndex:0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m index 778b1d44112..77c5a962967 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m @@ -22,16 +22,23 @@ - (void)testUpdatePolygonSetsVisibilityLast { PropertyOrderValidatingPolygon *polygon = [[PropertyOrderValidatingPolygon alloc] init]; [FLTGoogleMapPolygonController updatePolygon:polygon - fromPlatformPolygon:[FGMPlatformPolygon makeWithConsumeTapEvents:NO - fillColor:0 - geodesic:NO - holes:@[] - strokeColor:0 - strokeWidth:0 - visible:YES - zIndex:0 - points:@[] - polygonId:@"polygon"] + fromPlatformPolygon:[FGMPlatformPolygon + makeWithConsumeTapEvents:NO + fillColor:[FGMPlatformColor makeWithRed:0 + green:0 + blue:0 + alpha:0] + geodesic:NO + holes:@[] + strokeColor:[FGMPlatformColor makeWithRed:0 + green:0 + blue:0 + alpha:0] + strokeWidth:0 + visible:YES + zIndex:0 + points:@[] + polygonId:@"polygon"] withMapView:[GoogleMapsPolygonControllerTests mapView]]; XCTAssertTrue(polygon.hasSetMap); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m index 6dbe1b93a0e..848c9c71f41 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m @@ -27,17 +27,17 @@ @implementation GoogleMapsPolylineControllerTests /// /// @return An object of FLTGoogleMapPolylineController - (FLTGoogleMapPolylineController *)polylineControllerWithMockedMap { - FGMPlatformPolyline *polyline = - [FGMPlatformPolyline makeWithPolylineId:@"polyline_id_0" - consumesTapEvents:NO - color:0 - geodesic:NO - jointType:FGMPlatformJointTypeRound - patterns:@[] - points:[GoogleMapsPolylineControllerTests polylinePoints] - visible:NO - width:1 - zIndex:0]; + FGMPlatformPolyline *polyline = [FGMPlatformPolyline + makeWithPolylineId:@"polyline_id_0" + consumesTapEvents:NO + color:[FGMPlatformColor makeWithRed:0 green:0 blue:0 alpha:0] + geodesic:NO + jointType:FGMPlatformJointTypeRound + patterns:@[] + points:[GoogleMapsPolylineControllerTests polylinePoints] + visible:NO + width:1 + zIndex:0]; CGRect frame = CGRectMake(0, 0, 100, 100); GMSCameraPosition *camera = [[GMSCameraPosition alloc] initWithLatitude:0 longitude:0 zoom:0]; @@ -67,7 +67,10 @@ - (void)testPatternsSetSpans { updateFromPlatformPolyline:[FGMPlatformPolyline makeWithPolylineId:@"polyline_id_0" consumesTapEvents:NO - color:0 + color:[FGMPlatformColor makeWithRed:0 + green:0 + blue:0 + alpha:0] geodesic:NO jointType:FGMPlatformJointTypeRound patterns:@[ @@ -95,7 +98,10 @@ - (void)testUpdatePolylineSetsVisibilityLast { fromPlatformPolyline:[FGMPlatformPolyline makeWithPolylineId:@"polyline" consumesTapEvents:NO - color:0 + color:[FGMPlatformColor makeWithRed:0 + green:0 + blue:0 + alpha:0] geodesic:NO jointType:FGMPlatformJointTypeRound patterns:@[] diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart index 2fcd42602bf..152f83c16f3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart @@ -314,7 +314,7 @@ class ExampleGoogleMap extends StatefulWidget { this.onCameraIdle, this.onTap, this.onLongPress, - this.cloudMapId, + this.mapId, this.style, }); @@ -422,7 +422,7 @@ class ExampleGoogleMap extends StatefulWidget { /// /// See https://developers.google.com/maps/documentation/get-map-id /// for more details. - final String? cloudMapId; + final String? mapId; /// The locally configured style for the map. final String? style; @@ -670,7 +670,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) { indoorViewEnabled: map.indoorViewEnabled, trafficEnabled: map.trafficEnabled, buildingsEnabled: map.buildingsEnabled, - cloudMapId: map.cloudMapId, + mapId: map.mapId, style: map.style, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart index 79e983d8a21..cca097752fd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart @@ -54,7 +54,7 @@ class MapIdBodyState extends State { zoom: 7.0, ), key: _key, - cloudMapId: _mapId, + mapId: _mapId, ); final List columnChildren = [ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m index 76352bfb863..04c3f04c928 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m @@ -4,8 +4,8 @@ #import "FGMClusterManagersController.h" +#import "FGMConversionUtils.h" #import "FGMMarkerUserData.h" -#import "FLTGoogleMapJSONConversions.h" @interface FGMClusterManagersController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h similarity index 94% rename from packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.h rename to packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h index 61241fb6246..2cc43fc538f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h @@ -69,7 +69,7 @@ extern GMSCameraUpdate *_Nullable FGMGetCameraUpdateForPigeonCameraUpdate( FGMPlatformCameraUpdate *update); /// Creates a UIColor from its RGBA components, expressed as an integer. -extern UIColor *FGMGetColorForRGBA(NSInteger rgba); +extern UIColor *FGMGetColorForPigeonColor(FGMPlatformColor *color); /// Creates an array of GMSStrokeStyles using the given patterns and stroke color. extern NSArray *FGMGetStrokeStylesFromPatterns( @@ -79,7 +79,10 @@ extern NSArray *FGMGetStrokeStylesFromPatterns( extern NSArray *FGMGetSpanLengthsFromPatterns( NSArray *patterns); -@interface FLTGoogleMapJSONConversions : NSObject +/// Legacy conversion utils for heatmaps, which are still using a JSON +/// representation instead of structured Pigeon data. +// TODO(stuartmorgan): Remove this once heatmaps are migrated to Pigeon. +@interface FGMHeatmapConversions : NSObject extern NSString *const kHeatmapsToAddKey; extern NSString *const kHeatmapIdKey; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m similarity index 95% rename from packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.m rename to packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m index 479be710176..bce17ba10af 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FLTGoogleMapJSONConversions.h" +#import "FGMConversionUtils.h" + #import "FGMMarkerUserData.h" /// Returns dict[key], or nil if dict[key] is NSNull. @@ -212,11 +213,8 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { return nil; } -UIColor *FGMGetColorForRGBA(NSInteger rgba) { - return [UIColor colorWithRed:((CGFloat)((rgba & 0xFF0000) >> 16)) / 255.0 - green:((CGFloat)((rgba & 0xFF00) >> 8)) / 255.0 - blue:((CGFloat)(rgba & 0xFF)) / 255.0 - alpha:((CGFloat)((rgba & 0xFF000000) >> 24)) / 255.0]; +UIColor *FGMGetColorForPigeonColor(FGMPlatformColor *color) { + return [UIColor colorWithRed:color.red green:color.green blue:color.blue alpha:color.alpha]; } NSArray *FGMGetStrokeStylesFromPatterns( @@ -239,7 +237,7 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { return lengths; } -@implementation FLTGoogleMapJSONConversions +@implementation FGMHeatmapConversions // These constants must match the corresponding constants in serialization.dart NSString *const kHeatmapsToAddKey = @"heatmapsToAdd"; @@ -267,7 +265,11 @@ + (NSArray *)arrayFromLocation:(CLLocationCoordinate2D)location { } + (UIColor *)colorFromRGBA:(NSNumber *)numberColor { - return FGMGetColorForRGBA(numberColor.unsignedLongValue); + NSInteger rgba = numberColor.unsignedLongValue; + return [UIColor colorWithRed:((CGFloat)((rgba & 0xFF0000) >> 16)) / 255.0 + green:((CGFloat)((rgba & 0xFF00) >> 8)) / 255.0 + blue:((CGFloat)(rgba & 0xFF)) / 255.0 + alpha:((CGFloat)((rgba & 0xFF000000) >> 24)) / 255.0]; } + (NSNumber *)RGBAFromColor:(UIColor *)color { @@ -284,14 +286,14 @@ + (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { return nil; } return [[GMUWeightedLatLng alloc] - initWithCoordinate:[FLTGoogleMapJSONConversions locationFromLatLong:data[0]] + initWithCoordinate:[FGMHeatmapConversions locationFromLatLong:data[0]] intensity:[data[1] doubleValue]]; } + (NSArray *)arrayFromWeightedLatLng:(GMUWeightedLatLng *)weightedLatLng { GMSMapPoint point = {weightedLatLng.point.x, weightedLatLng.point.y}; return @[ - [FLTGoogleMapJSONConversions arrayFromLocation:GMSUnproject(point)], @(weightedLatLng.intensity) + [FGMHeatmapConversions arrayFromLocation:GMSUnproject(point)], @(weightedLatLng.intensity) ]; } @@ -299,7 +301,7 @@ + (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { NSMutableArray *weightedData = [[NSMutableArray alloc] initWithCapacity:data.count]; for (NSArray *item in data) { - GMUWeightedLatLng *weightedLatLng = [FLTGoogleMapJSONConversions weightedLatLngFromArray:item]; + GMUWeightedLatLng *weightedLatLng = [FGMHeatmapConversions weightedLatLngFromArray:item]; if (weightedLatLng == nil) continue; [weightedData addObject:weightedLatLng]; } @@ -310,7 +312,7 @@ + (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { + (NSArray *> *)arrayFromWeightedData:(NSArray *)weightedData { NSMutableArray *data = [[NSMutableArray alloc] initWithCapacity:weightedData.count]; for (GMUWeightedLatLng *weightedLatLng in weightedData) { - [data addObject:[FLTGoogleMapJSONConversions arrayFromWeightedLatLng:weightedLatLng]]; + [data addObject:[FGMHeatmapConversions arrayFromWeightedLatLng:weightedLatLng]]; } return data; @@ -320,7 +322,7 @@ + (GMUGradient *)gradientFromDictionary:(NSDictionary *)data { NSArray *colorData = data[kHeatmapGradientColorsKey]; NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:colorData.count]; for (NSNumber *colorCode in colorData) { - [colors addObject:[FLTGoogleMapJSONConversions colorFromRGBA:colorCode]]; + [colors addObject:[FGMHeatmapConversions colorFromRGBA:colorCode]]; } return [[GMUGradient alloc] initWithColors:colors @@ -332,7 +334,7 @@ + (GMUGradient *)gradientFromDictionary:(NSDictionary *)data { NSMutableArray *colorCodes = [[NSMutableArray alloc] initWithCapacity:gradient.colors.count]; for (UIColor *color in gradient.colors) { - [colorCodes addObject:[FLTGoogleMapJSONConversions RGBAFromColor:color]]; + [colorCodes addObject:[FGMHeatmapConversions RGBAFromColor:color]]; } return @{ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m index 2260dfb9e71..624f43032c5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m @@ -5,8 +5,8 @@ #import "FGMGroundOverlayController.h" #import "FGMGroundOverlayController_Test.h" +#import "FGMConversionUtils.h" #import "FGMImageUtils.h" -#import "FLTGoogleMapJSONConversions.h" @interface FGMGroundOverlayController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m index aa51fb93c63..808c5848768 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m @@ -7,7 +7,7 @@ @import GoogleMapsUtils; -#import "FLTGoogleMapJSONConversions.h" +#import "FGMConversionUtils.h" @interface FLTGoogleMapHeatmapController () @@ -56,13 +56,12 @@ + (void)updateHeatmap:(GMUHeatmapTileLayer *)heatmapTileLayer // https://github.com/flutter/flutter/issues/117907 id weightedData = options[kHeatmapDataKey]; if ([weightedData isKindOfClass:[NSArray class]]) { - heatmapTileLayer.weightedData = - [FLTGoogleMapJSONConversions weightedDataFromArray:weightedData]; + heatmapTileLayer.weightedData = [FGMHeatmapConversions weightedDataFromArray:weightedData]; } id gradient = options[kHeatmapGradientKey]; if ([gradient isKindOfClass:[NSDictionary class]]) { - heatmapTileLayer.gradient = [FLTGoogleMapJSONConversions gradientFromDictionary:gradient]; + heatmapTileLayer.gradient = [FGMHeatmapConversions gradientFromDictionary:gradient]; } id opacity = options[kHeatmapOpacityKey]; @@ -153,9 +152,9 @@ - (BOOL)hasHeatmapWithIdentifier:(NSString *)identifier { FLTGoogleMapHeatmapController *heatmapController = self.heatmapIdToController[identifier]; if (heatmapController) { return @{ - kHeatmapDataKey : [FLTGoogleMapJSONConversions + kHeatmapDataKey : [FGMHeatmapConversions arrayFromWeightedData:heatmapController.heatmapTileLayer.weightedData], - kHeatmapGradientKey : [FLTGoogleMapJSONConversions + kHeatmapGradientKey : [FGMHeatmapConversions dictionaryFromGradient:heatmapController.heatmapTileLayer.gradient], kHeatmapOpacityKey : @(heatmapController.heatmapTileLayer.opacity), kHeatmapRadiusKey : @(heatmapController.heatmapTileLayer.radius), diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m index 8132ffbdf28..c4cce14ed24 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m @@ -5,7 +5,7 @@ #import "FLTGoogleMapTileOverlayController.h" #import "FLTGoogleMapTileOverlayController_Test.h" -#import "FLTGoogleMapJSONConversions.h" +#import "FGMConversionUtils.h" @interface FLTGoogleMapTileOverlayController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m index 81c5549bd32..d2d0130dc64 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m @@ -5,7 +5,7 @@ #import "GoogleMapCircleController.h" #import "GoogleMapCircleController_Test.h" -#import "FLTGoogleMapJSONConversions.h" +#import "FGMConversionUtils.h" @interface FLTGoogleMapCircleController () @@ -48,9 +48,9 @@ + (void)updateCircle:(GMSCircle *)circle circle.zIndex = platformCircle.zIndex; circle.position = FGMGetCoordinateForPigeonLatLng(platformCircle.center); circle.radius = platformCircle.radius; - circle.strokeColor = FGMGetColorForRGBA(platformCircle.strokeColor); + circle.strokeColor = FGMGetColorForPigeonColor(platformCircle.strokeColor); circle.strokeWidth = platformCircle.strokeWidth; - circle.fillColor = FGMGetColorForRGBA(platformCircle.fillColor); + circle.fillColor = FGMGetColorForPigeonColor(platformCircle.fillColor); // This must be done last, to avoid visual flickers of default property values. circle.map = platformCircle.visible ? mapView : nil; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m index 2d62fe9dad6..dc8d6fa6db2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m @@ -7,10 +7,10 @@ #import "GoogleMapController.h" #import "GoogleMapController_Test.h" +#import "FGMConversionUtils.h" #import "FGMGroundOverlayController.h" #import "FGMMarkerUserData.h" #import "FLTGoogleMapHeatmapController.h" -#import "FLTGoogleMapJSONConversions.h" #import "FLTGoogleMapTileOverlayController.h" #import "messages.g.h" @@ -135,7 +135,7 @@ - (instancetype)initWithFrame:(CGRect)frame GMSMapViewOptions *options = [[GMSMapViewOptions alloc] init]; options.frame = frame; options.camera = camera; - NSString *cloudMapId = creationParameters.mapConfiguration.cloudMapId; + NSString *cloudMapId = creationParameters.mapConfiguration.mapId; if (cloudMapId) { options.mapID = [GMSMapID mapIDWithIdentifier:cloudMapId]; } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m index de9e0f99ac4..ed3aabd7fc1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m @@ -5,9 +5,9 @@ #import "GoogleMapMarkerController.h" #import "GoogleMapMarkerController_Test.h" +#import "FGMConversionUtils.h" #import "FGMImageUtils.h" #import "FGMMarkerUserData.h" -#import "FLTGoogleMapJSONConversions.h" @interface FLTGoogleMapMarkerController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m index aedbf1b90db..12cbfeefecd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m @@ -5,7 +5,7 @@ #import "GoogleMapPolygonController.h" #import "GoogleMapPolygonController_Test.h" -#import "FLTGoogleMapJSONConversions.h" +#import "FGMConversionUtils.h" /// Converts a list of holes represented as CLLocation lists to GMSMutablePath lists. static NSArray *FMGPathHolesFromLocationHoles( @@ -57,8 +57,8 @@ + (void)updatePolygon:(GMSPolygon *)polygon polygon.path = FGMGetPathFromPoints(FGMGetPointsForPigeonLatLngs(platformPolygon.points)); polygon.holes = FMGPathHolesFromLocationHoles(FGMGetHolesForPigeonLatLngArrays(platformPolygon.holes)); - polygon.fillColor = FGMGetColorForRGBA(platformPolygon.fillColor); - polygon.strokeColor = FGMGetColorForRGBA(platformPolygon.strokeColor); + polygon.fillColor = FGMGetColorForPigeonColor(platformPolygon.fillColor); + polygon.strokeColor = FGMGetColorForPigeonColor(platformPolygon.strokeColor); polygon.strokeWidth = platformPolygon.strokeWidth; // This must be done last, to avoid visual flickers of default property values. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m index cf527779058..63a7f7b7b0f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m @@ -5,7 +5,7 @@ #import "GoogleMapPolylineController.h" #import "GoogleMapPolylineController_Test.h" -#import "FLTGoogleMapJSONConversions.h" +#import "FGMConversionUtils.h" @interface FLTGoogleMapPolylineController () @@ -46,7 +46,7 @@ + (void)updatePolyline:(GMSPolyline *)polyline GMSMutablePath *path = FGMGetPathFromPoints(FGMGetPointsForPigeonLatLngs(platformPolyline.points)); polyline.path = path; - UIColor *strokeColor = FGMGetColorForRGBA(platformPolyline.color); + UIColor *strokeColor = FGMGetColorForPigeonColor(platformPolyline.color); polyline.strokeColor = strokeColor; polyline.strokeWidth = platformPolyline.width; polyline.geodesic = platformPolyline.geodesic; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h index 29ef04589aa..e35e8c3aa70 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h @@ -3,12 +3,12 @@ // found in the LICENSE file. #import +#import #import #import #import #import #import -#import #import #import #import diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h index a814fb02f24..fc8146dd0b4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h @@ -96,6 +96,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @class FGMPlatformMapConfiguration; @class FGMPlatformPoint; @class FGMPlatformSize; +@class FGMPlatformColor; @class FGMPlatformTileLayer; @class FGMPlatformZoomRange; @class FGMPlatformBitmap; @@ -205,8 +206,8 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithConsumeTapEvents:(BOOL)consumeTapEvents - fillColor:(NSInteger)fillColor - strokeColor:(NSInteger)strokeColor + fillColor:(FGMPlatformColor *)fillColor + strokeColor:(FGMPlatformColor *)strokeColor visible:(BOOL)visible strokeWidth:(NSInteger)strokeWidth zIndex:(double)zIndex @@ -214,8 +215,8 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { radius:(double)radius circleId:(NSString *)circleId; @property(nonatomic, assign) BOOL consumeTapEvents; -@property(nonatomic, assign) NSInteger fillColor; -@property(nonatomic, assign) NSInteger strokeColor; +@property(nonatomic, strong) FGMPlatformColor *fillColor; +@property(nonatomic, strong) FGMPlatformColor *strokeColor; @property(nonatomic, assign) BOOL visible; @property(nonatomic, assign) NSInteger strokeWidth; @property(nonatomic, assign) double zIndex; @@ -307,22 +308,22 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPolygonId:(NSString *)polygonId consumesTapEvents:(BOOL)consumesTapEvents - fillColor:(NSInteger)fillColor + fillColor:(FGMPlatformColor *)fillColor geodesic:(BOOL)geodesic points:(NSArray *)points holes:(NSArray *> *)holes visible:(BOOL)visible - strokeColor:(NSInteger)strokeColor + strokeColor:(FGMPlatformColor *)strokeColor strokeWidth:(NSInteger)strokeWidth zIndex:(NSInteger)zIndex; @property(nonatomic, copy) NSString *polygonId; @property(nonatomic, assign) BOOL consumesTapEvents; -@property(nonatomic, assign) NSInteger fillColor; +@property(nonatomic, strong) FGMPlatformColor *fillColor; @property(nonatomic, assign) BOOL geodesic; @property(nonatomic, copy) NSArray *points; @property(nonatomic, copy) NSArray *> *holes; @property(nonatomic, assign) BOOL visible; -@property(nonatomic, assign) NSInteger strokeColor; +@property(nonatomic, strong) FGMPlatformColor *strokeColor; @property(nonatomic, assign) NSInteger strokeWidth; @property(nonatomic, assign) NSInteger zIndex; @end @@ -333,7 +334,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPolylineId:(NSString *)polylineId consumesTapEvents:(BOOL)consumesTapEvents - color:(NSInteger)color + color:(FGMPlatformColor *)color geodesic:(BOOL)geodesic jointType:(FGMPlatformJointType)jointType patterns:(NSArray *)patterns @@ -343,7 +344,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { zIndex:(NSInteger)zIndex; @property(nonatomic, copy) NSString *polylineId; @property(nonatomic, assign) BOOL consumesTapEvents; -@property(nonatomic, assign) NSInteger color; +@property(nonatomic, strong) FGMPlatformColor *color; @property(nonatomic, assign) BOOL geodesic; /// The joint type. @property(nonatomic, assign) FGMPlatformJointType jointType; @@ -505,7 +506,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { indoorViewEnabled:(nullable NSNumber *)indoorViewEnabled trafficEnabled:(nullable NSNumber *)trafficEnabled buildingsEnabled:(nullable NSNumber *)buildingsEnabled - cloudMapId:(nullable NSString *)cloudMapId + mapId:(nullable NSString *)mapId style:(nullable NSString *)style; @property(nonatomic, strong, nullable) NSNumber *compassEnabled; @property(nonatomic, strong, nullable) FGMPlatformCameraTargetBounds *cameraTargetBounds; @@ -522,7 +523,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @property(nonatomic, strong, nullable) NSNumber *indoorViewEnabled; @property(nonatomic, strong, nullable) NSNumber *trafficEnabled; @property(nonatomic, strong, nullable) NSNumber *buildingsEnabled; -@property(nonatomic, copy, nullable) NSString *cloudMapId; +@property(nonatomic, copy, nullable) NSString *mapId; @property(nonatomic, copy, nullable) NSString *style; @end @@ -544,6 +545,17 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @property(nonatomic, assign) double height; @end +/// Pigeon representation of a color. +@interface FGMPlatformColor : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)makeWithRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha; +@property(nonatomic, assign) double red; +@property(nonatomic, assign) double green; +@property(nonatomic, assign) double blue; +@property(nonatomic, assign) double alpha; +@end + /// Pigeon equivalent of GMSTileLayer properties. @interface FGMPlatformTileLayer : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m index dc44ed382b5..86a485af865 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m @@ -263,6 +263,12 @@ + (nullable FGMPlatformSize *)nullableFromList:(NSArray *)list; - (NSArray *)toList; @end +@interface FGMPlatformColor () ++ (FGMPlatformColor *)fromList:(NSArray *)list; ++ (nullable FGMPlatformColor *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; +@end + @interface FGMPlatformTileLayer () + (FGMPlatformTileLayer *)fromList:(NSArray *)list; + (nullable FGMPlatformTileLayer *)nullableFromList:(NSArray *)list; @@ -559,8 +565,8 @@ + (nullable FGMPlatformCameraUpdateZoomTo *)nullableFromList:(NSArray *)list @implementation FGMPlatformCircle + (instancetype)makeWithConsumeTapEvents:(BOOL)consumeTapEvents - fillColor:(NSInteger)fillColor - strokeColor:(NSInteger)strokeColor + fillColor:(FGMPlatformColor *)fillColor + strokeColor:(FGMPlatformColor *)strokeColor visible:(BOOL)visible strokeWidth:(NSInteger)strokeWidth zIndex:(double)zIndex @@ -582,8 +588,8 @@ + (instancetype)makeWithConsumeTapEvents:(BOOL)consumeTapEvents + (FGMPlatformCircle *)fromList:(NSArray *)list { FGMPlatformCircle *pigeonResult = [[FGMPlatformCircle alloc] init]; pigeonResult.consumeTapEvents = [GetNullableObjectAtIndex(list, 0) boolValue]; - pigeonResult.fillColor = [GetNullableObjectAtIndex(list, 1) integerValue]; - pigeonResult.strokeColor = [GetNullableObjectAtIndex(list, 2) integerValue]; + pigeonResult.fillColor = GetNullableObjectAtIndex(list, 1); + pigeonResult.strokeColor = GetNullableObjectAtIndex(list, 2); pigeonResult.visible = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.strokeWidth = [GetNullableObjectAtIndex(list, 4) integerValue]; pigeonResult.zIndex = [GetNullableObjectAtIndex(list, 5) doubleValue]; @@ -598,8 +604,8 @@ + (nullable FGMPlatformCircle *)nullableFromList:(NSArray *)list { - (NSArray *)toList { return @[ @(self.consumeTapEvents), - @(self.fillColor), - @(self.strokeColor), + self.fillColor ?: [NSNull null], + self.strokeColor ?: [NSNull null], @(self.visible), @(self.strokeWidth), @(self.zIndex), @@ -786,12 +792,12 @@ + (nullable FGMPlatformMarker *)nullableFromList:(NSArray *)list { @implementation FGMPlatformPolygon + (instancetype)makeWithPolygonId:(NSString *)polygonId consumesTapEvents:(BOOL)consumesTapEvents - fillColor:(NSInteger)fillColor + fillColor:(FGMPlatformColor *)fillColor geodesic:(BOOL)geodesic points:(NSArray *)points holes:(NSArray *> *)holes visible:(BOOL)visible - strokeColor:(NSInteger)strokeColor + strokeColor:(FGMPlatformColor *)strokeColor strokeWidth:(NSInteger)strokeWidth zIndex:(NSInteger)zIndex { FGMPlatformPolygon *pigeonResult = [[FGMPlatformPolygon alloc] init]; @@ -811,12 +817,12 @@ + (FGMPlatformPolygon *)fromList:(NSArray *)list { FGMPlatformPolygon *pigeonResult = [[FGMPlatformPolygon alloc] init]; pigeonResult.polygonId = GetNullableObjectAtIndex(list, 0); pigeonResult.consumesTapEvents = [GetNullableObjectAtIndex(list, 1) boolValue]; - pigeonResult.fillColor = [GetNullableObjectAtIndex(list, 2) integerValue]; + pigeonResult.fillColor = GetNullableObjectAtIndex(list, 2); pigeonResult.geodesic = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.points = GetNullableObjectAtIndex(list, 4); pigeonResult.holes = GetNullableObjectAtIndex(list, 5); pigeonResult.visible = [GetNullableObjectAtIndex(list, 6) boolValue]; - pigeonResult.strokeColor = [GetNullableObjectAtIndex(list, 7) integerValue]; + pigeonResult.strokeColor = GetNullableObjectAtIndex(list, 7); pigeonResult.strokeWidth = [GetNullableObjectAtIndex(list, 8) integerValue]; pigeonResult.zIndex = [GetNullableObjectAtIndex(list, 9) integerValue]; return pigeonResult; @@ -828,12 +834,12 @@ + (nullable FGMPlatformPolygon *)nullableFromList:(NSArray *)list { return @[ self.polygonId ?: [NSNull null], @(self.consumesTapEvents), - @(self.fillColor), + self.fillColor ?: [NSNull null], @(self.geodesic), self.points ?: [NSNull null], self.holes ?: [NSNull null], @(self.visible), - @(self.strokeColor), + self.strokeColor ?: [NSNull null], @(self.strokeWidth), @(self.zIndex), ]; @@ -843,7 +849,7 @@ + (nullable FGMPlatformPolygon *)nullableFromList:(NSArray *)list { @implementation FGMPlatformPolyline + (instancetype)makeWithPolylineId:(NSString *)polylineId consumesTapEvents:(BOOL)consumesTapEvents - color:(NSInteger)color + color:(FGMPlatformColor *)color geodesic:(BOOL)geodesic jointType:(FGMPlatformJointType)jointType patterns:(NSArray *)patterns @@ -868,7 +874,7 @@ + (FGMPlatformPolyline *)fromList:(NSArray *)list { FGMPlatformPolyline *pigeonResult = [[FGMPlatformPolyline alloc] init]; pigeonResult.polylineId = GetNullableObjectAtIndex(list, 0); pigeonResult.consumesTapEvents = [GetNullableObjectAtIndex(list, 1) boolValue]; - pigeonResult.color = [GetNullableObjectAtIndex(list, 2) integerValue]; + pigeonResult.color = GetNullableObjectAtIndex(list, 2); pigeonResult.geodesic = [GetNullableObjectAtIndex(list, 3) boolValue]; FGMPlatformJointTypeBox *boxedFGMPlatformJointType = GetNullableObjectAtIndex(list, 4); pigeonResult.jointType = boxedFGMPlatformJointType.value; @@ -886,7 +892,7 @@ + (nullable FGMPlatformPolyline *)nullableFromList:(NSArray *)list { return @[ self.polylineId ?: [NSNull null], @(self.consumesTapEvents), - @(self.color), + self.color ?: [NSNull null], @(self.geodesic), [[FGMPlatformJointTypeBox alloc] initWithValue:self.jointType], self.patterns ?: [NSNull null], @@ -1232,7 +1238,7 @@ + (instancetype)makeWithCompassEnabled:(nullable NSNumber *)compassEnabled indoorViewEnabled:(nullable NSNumber *)indoorViewEnabled trafficEnabled:(nullable NSNumber *)trafficEnabled buildingsEnabled:(nullable NSNumber *)buildingsEnabled - cloudMapId:(nullable NSString *)cloudMapId + mapId:(nullable NSString *)mapId style:(nullable NSString *)style { FGMPlatformMapConfiguration *pigeonResult = [[FGMPlatformMapConfiguration alloc] init]; pigeonResult.compassEnabled = compassEnabled; @@ -1250,7 +1256,7 @@ + (instancetype)makeWithCompassEnabled:(nullable NSNumber *)compassEnabled pigeonResult.indoorViewEnabled = indoorViewEnabled; pigeonResult.trafficEnabled = trafficEnabled; pigeonResult.buildingsEnabled = buildingsEnabled; - pigeonResult.cloudMapId = cloudMapId; + pigeonResult.mapId = mapId; pigeonResult.style = style; return pigeonResult; } @@ -1271,7 +1277,7 @@ + (FGMPlatformMapConfiguration *)fromList:(NSArray *)list { pigeonResult.indoorViewEnabled = GetNullableObjectAtIndex(list, 12); pigeonResult.trafficEnabled = GetNullableObjectAtIndex(list, 13); pigeonResult.buildingsEnabled = GetNullableObjectAtIndex(list, 14); - pigeonResult.cloudMapId = GetNullableObjectAtIndex(list, 15); + pigeonResult.mapId = GetNullableObjectAtIndex(list, 15); pigeonResult.style = GetNullableObjectAtIndex(list, 16); return pigeonResult; } @@ -1295,7 +1301,7 @@ + (nullable FGMPlatformMapConfiguration *)nullableFromList:(NSArray *)list { self.indoorViewEnabled ?: [NSNull null], self.trafficEnabled ?: [NSNull null], self.buildingsEnabled ?: [NSNull null], - self.cloudMapId ?: [NSNull null], + self.mapId ?: [NSNull null], self.style ?: [NSNull null], ]; } @@ -1349,6 +1355,36 @@ + (nullable FGMPlatformSize *)nullableFromList:(NSArray *)list { } @end +@implementation FGMPlatformColor ++ (instancetype)makeWithRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha { + FGMPlatformColor *pigeonResult = [[FGMPlatformColor alloc] init]; + pigeonResult.red = red; + pigeonResult.green = green; + pigeonResult.blue = blue; + pigeonResult.alpha = alpha; + return pigeonResult; +} ++ (FGMPlatformColor *)fromList:(NSArray *)list { + FGMPlatformColor *pigeonResult = [[FGMPlatformColor alloc] init]; + pigeonResult.red = [GetNullableObjectAtIndex(list, 0) doubleValue]; + pigeonResult.green = [GetNullableObjectAtIndex(list, 1) doubleValue]; + pigeonResult.blue = [GetNullableObjectAtIndex(list, 2) doubleValue]; + pigeonResult.alpha = [GetNullableObjectAtIndex(list, 3) doubleValue]; + return pigeonResult; +} ++ (nullable FGMPlatformColor *)nullableFromList:(NSArray *)list { + return (list) ? [FGMPlatformColor fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + @(self.red), + @(self.green), + @(self.blue), + @(self.alpha), + ]; +} +@end + @implementation FGMPlatformTileLayer + (instancetype)makeWithVisible:(BOOL)visible fadeIn:(BOOL)fadeIn @@ -1694,22 +1730,24 @@ - (nullable id)readValueOfType:(UInt8)type { case 162: return [FGMPlatformSize fromList:[self readValue]]; case 163: - return [FGMPlatformTileLayer fromList:[self readValue]]; + return [FGMPlatformColor fromList:[self readValue]]; case 164: - return [FGMPlatformZoomRange fromList:[self readValue]]; + return [FGMPlatformTileLayer fromList:[self readValue]]; case 165: - return [FGMPlatformBitmap fromList:[self readValue]]; + return [FGMPlatformZoomRange fromList:[self readValue]]; case 166: - return [FGMPlatformBitmapDefaultMarker fromList:[self readValue]]; + return [FGMPlatformBitmap fromList:[self readValue]]; case 167: - return [FGMPlatformBitmapBytes fromList:[self readValue]]; + return [FGMPlatformBitmapDefaultMarker fromList:[self readValue]]; case 168: - return [FGMPlatformBitmapAsset fromList:[self readValue]]; + return [FGMPlatformBitmapBytes fromList:[self readValue]]; case 169: - return [FGMPlatformBitmapAssetImage fromList:[self readValue]]; + return [FGMPlatformBitmapAsset fromList:[self readValue]]; case 170: - return [FGMPlatformBitmapAssetMap fromList:[self readValue]]; + return [FGMPlatformBitmapAssetImage fromList:[self readValue]]; case 171: + return [FGMPlatformBitmapAssetMap fromList:[self readValue]]; + case 172: return [FGMPlatformBitmapBytesMap fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1827,33 +1865,36 @@ - (void)writeValue:(id)value { } else if ([value isKindOfClass:[FGMPlatformSize class]]) { [self writeByte:162]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) { + } else if ([value isKindOfClass:[FGMPlatformColor class]]) { [self writeByte:163]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) { + } else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) { [self writeByte:164]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmap class]]) { + } else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) { [self writeByte:165]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapDefaultMarker class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmap class]]) { [self writeByte:166]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapBytes class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapDefaultMarker class]]) { [self writeByte:167]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapAsset class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapBytes class]]) { [self writeByte:168]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapAssetImage class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapAsset class]]) { [self writeByte:169]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapAssetMap class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapAssetImage class]]) { [self writeByte:170]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapBytesMap class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapAssetMap class]]) { [self writeByte:171]; [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[FGMPlatformBitmapBytesMap class]]) { + [self writeByte:172]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart index 1794c914855..51a7d1afd47 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart @@ -15,9 +15,6 @@ import 'google_map_inspector_ios.dart'; import 'messages.g.dart'; import 'serialization.dart'; -// TODO(stuartmorgan): Remove the dependency on platform interface toJson -// methods. Channel serialization details should all be package-internal. - /// The non-test implementation of `_apiProvider`. MapsApi _productionApiProvider(int mapId) { return MapsApi(messageChannelSuffix: mapId.toString()); @@ -658,8 +655,18 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { static PlatformCircle _platformCircleFromCircle(Circle circle) { return PlatformCircle( consumeTapEvents: circle.consumeTapEvents, - fillColor: circle.fillColor.value, - strokeColor: circle.strokeColor.value, + fillColor: PlatformColor( + red: circle.fillColor.r, + green: circle.fillColor.g, + blue: circle.fillColor.b, + alpha: circle.fillColor.a, + ), + strokeColor: PlatformColor( + red: circle.strokeColor.r, + green: circle.strokeColor.g, + blue: circle.strokeColor.b, + alpha: circle.strokeColor.a, + ), visible: circle.visible, strokeWidth: circle.strokeWidth, zIndex: circle.zIndex.toDouble(), @@ -734,12 +741,22 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { }).toList(); return PlatformPolygon( polygonId: polygon.polygonId.value, - fillColor: polygon.fillColor.value, + fillColor: PlatformColor( + red: polygon.fillColor.r, + green: polygon.fillColor.g, + blue: polygon.fillColor.b, + alpha: polygon.fillColor.a, + ), geodesic: polygon.geodesic, consumesTapEvents: polygon.consumeTapEvents, points: points, holes: holes, - strokeColor: polygon.strokeColor.value, + strokeColor: PlatformColor( + red: polygon.strokeColor.r, + green: polygon.strokeColor.g, + blue: polygon.strokeColor.b, + alpha: polygon.strokeColor.a, + ), strokeWidth: polygon.strokeWidth, zIndex: polygon.zIndex, visible: polygon.visible, @@ -756,7 +773,12 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { return PlatformPolyline( polylineId: polyline.polylineId.value, consumesTapEvents: polyline.consumeTapEvents, - color: polyline.color.value, + color: PlatformColor( + red: polyline.color.r, + green: polyline.color.g, + blue: polyline.color.b, + alpha: polyline.color.a, + ), geodesic: polyline.geodesic, visible: polyline.visible, width: polyline.width, @@ -1220,7 +1242,7 @@ PlatformMapConfiguration _platformMapConfigurationFromMapConfiguration( indoorViewEnabled: config.indoorViewEnabled, trafficEnabled: config.trafficEnabled, buildingsEnabled: config.buildingsEnabled, - cloudMapId: config.cloudMapId, + mapId: config.mapId, style: config.style, ); } @@ -1262,7 +1284,7 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( indoorViewEnabled: options['indoorEnabled'] as bool?, trafficEnabled: options['trafficEnabled'] as bool?, buildingsEnabled: options['buildingsEnabled'] as bool?, - cloudMapId: options['cloudMapId'] as String?, + mapId: options['cloudMapId'] as String?, style: options['style'] as String?, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart index 09197a6bf21..2bb8b3fb42d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart @@ -479,8 +479,8 @@ class PlatformCameraUpdateZoomTo { class PlatformCircle { PlatformCircle({ this.consumeTapEvents = false, - this.fillColor = 0x00000000, - this.strokeColor = 0xFF000000, + required this.fillColor, + required this.strokeColor, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -491,9 +491,9 @@ class PlatformCircle { bool consumeTapEvents; - int fillColor; + PlatformColor fillColor; - int strokeColor; + PlatformColor strokeColor; bool visible; @@ -529,8 +529,8 @@ class PlatformCircle { result as List; return PlatformCircle( consumeTapEvents: result[0]! as bool, - fillColor: result[1]! as int, - strokeColor: result[2]! as int, + fillColor: result[1]! as PlatformColor, + strokeColor: result[2]! as PlatformColor, visible: result[3]! as bool, strokeWidth: result[4]! as int, zIndex: result[5]! as double, @@ -849,7 +849,7 @@ class PlatformPolygon { bool consumesTapEvents; - int fillColor; + PlatformColor fillColor; bool geodesic; @@ -859,7 +859,7 @@ class PlatformPolygon { bool visible; - int strokeColor; + PlatformColor strokeColor; int strokeWidth; @@ -889,12 +889,12 @@ class PlatformPolygon { return PlatformPolygon( polygonId: result[0]! as String, consumesTapEvents: result[1]! as bool, - fillColor: result[2]! as int, + fillColor: result[2]! as PlatformColor, geodesic: result[3]! as bool, points: (result[4] as List?)!.cast(), holes: (result[5] as List?)!.cast>(), visible: result[6]! as bool, - strokeColor: result[7]! as int, + strokeColor: result[7]! as PlatformColor, strokeWidth: result[8]! as int, zIndex: result[9]! as int, ); @@ -936,7 +936,7 @@ class PlatformPolyline { bool consumesTapEvents; - int color; + PlatformColor color; bool geodesic; @@ -978,7 +978,7 @@ class PlatformPolyline { return PlatformPolyline( polylineId: result[0]! as String, consumesTapEvents: result[1]! as bool, - color: result[2]! as int, + color: result[2]! as PlatformColor, geodesic: result[3]! as bool, jointType: result[4]! as PlatformJointType, patterns: (result[5] as List?)!.cast(), @@ -1535,7 +1535,7 @@ class PlatformMapConfiguration { this.indoorViewEnabled, this.trafficEnabled, this.buildingsEnabled, - this.cloudMapId, + this.mapId, this.style, }); @@ -1569,7 +1569,7 @@ class PlatformMapConfiguration { bool? buildingsEnabled; - String? cloudMapId; + String? mapId; String? style; @@ -1590,7 +1590,7 @@ class PlatformMapConfiguration { indoorViewEnabled, trafficEnabled, buildingsEnabled, - cloudMapId, + mapId, style, ]; } @@ -1617,7 +1617,7 @@ class PlatformMapConfiguration { indoorViewEnabled: result[12] as bool?, trafficEnabled: result[13] as bool?, buildingsEnabled: result[14] as bool?, - cloudMapId: result[15] as String?, + mapId: result[15] as String?, style: result[16] as String?, ); } @@ -1719,6 +1719,58 @@ class PlatformSize { int get hashCode => Object.hashAll(_toList()); } +/// Pigeon representation of a color. +class PlatformColor { + PlatformColor({ + required this.red, + required this.green, + required this.blue, + required this.alpha, + }); + + double red; + + double green; + + double blue; + + double alpha; + + List _toList() { + return [red, green, blue, alpha]; + } + + Object encode() { + return _toList(); + } + + static PlatformColor decode(Object result) { + result as List; + return PlatformColor( + red: result[0]! as double, + green: result[1]! as double, + blue: result[2]! as double, + alpha: result[3]! as double, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformColor || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + /// Pigeon equivalent of GMSTileLayer properties. class PlatformTileLayer { PlatformTileLayer({ @@ -2246,33 +2298,36 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformSize) { buffer.putUint8(162); writeValue(buffer, value.encode()); - } else if (value is PlatformTileLayer) { + } else if (value is PlatformColor) { buffer.putUint8(163); writeValue(buffer, value.encode()); - } else if (value is PlatformZoomRange) { + } else if (value is PlatformTileLayer) { buffer.putUint8(164); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmap) { + } else if (value is PlatformZoomRange) { buffer.putUint8(165); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapDefaultMarker) { + } else if (value is PlatformBitmap) { buffer.putUint8(166); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytes) { + } else if (value is PlatformBitmapDefaultMarker) { buffer.putUint8(167); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAsset) { + } else if (value is PlatformBitmapBytes) { buffer.putUint8(168); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetImage) { + } else if (value is PlatformBitmapAsset) { buffer.putUint8(169); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetMap) { + } else if (value is PlatformBitmapAssetImage) { buffer.putUint8(170); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytesMap) { + } else if (value is PlatformBitmapAssetMap) { buffer.putUint8(171); writeValue(buffer, value.encode()); + } else if (value is PlatformBitmapBytesMap) { + buffer.putUint8(172); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2354,22 +2409,24 @@ class _PigeonCodec extends StandardMessageCodec { case 162: return PlatformSize.decode(readValue(buffer)!); case 163: - return PlatformTileLayer.decode(readValue(buffer)!); + return PlatformColor.decode(readValue(buffer)!); case 164: - return PlatformZoomRange.decode(readValue(buffer)!); + return PlatformTileLayer.decode(readValue(buffer)!); case 165: - return PlatformBitmap.decode(readValue(buffer)!); + return PlatformZoomRange.decode(readValue(buffer)!); case 166: - return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); + return PlatformBitmap.decode(readValue(buffer)!); case 167: - return PlatformBitmapBytes.decode(readValue(buffer)!); + return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); case 168: - return PlatformBitmapAsset.decode(readValue(buffer)!); + return PlatformBitmapBytes.decode(readValue(buffer)!); case 169: - return PlatformBitmapAssetImage.decode(readValue(buffer)!); + return PlatformBitmapAsset.decode(readValue(buffer)!); case 170: - return PlatformBitmapAssetMap.decode(readValue(buffer)!); + return PlatformBitmapAssetImage.decode(readValue(buffer)!); case 171: + return PlatformBitmapAssetMap.decode(readValue(buffer)!); + case 172: return PlatformBitmapBytesMap.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart index aa94f6c12b2..f31f9f760cd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; -// These constants must match the corresponding constants in FLTGoogleMapJSONConversions.m +// These constants must match the corresponding constants in FGMConversionUtils.m const String _heatmapIdKey = 'heatmapId'; const String _heatmapDataKey = 'data'; const String _heatmapGradientKey = 'gradient'; @@ -96,7 +96,9 @@ Object serializeHeatmapGradient(HeatmapGradient gradient) { _addIfNonNull( json, _heatmapGradientColorsKey, - gradient.colors.map((HeatmapGradientColor e) => e.color.value).toList(), + gradient.colors + .map((HeatmapGradientColor e) => e.color.toARGB32()) + .toList(), ); _addIfNonNull( json, diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart index 14f27007671..98af369be23 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart @@ -101,9 +101,9 @@ class PlatformCircle { PlatformCircle({ required this.circleId, required this.center, + required this.fillColor, + required this.strokeColor, this.consumeTapEvents = false, - this.fillColor = 0x00000000, - this.strokeColor = 0xFF000000, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -111,8 +111,8 @@ class PlatformCircle { }); final bool consumeTapEvents; - final int fillColor; - final int strokeColor; + final PlatformColor fillColor; + final PlatformColor strokeColor; final bool visible; final int strokeWidth; final double zIndex; @@ -215,12 +215,12 @@ class PlatformPolygon { final String polygonId; final bool consumesTapEvents; - final int fillColor; + final PlatformColor fillColor; final bool geodesic; final List points; final List> holes; final bool visible; - final int strokeColor; + final PlatformColor strokeColor; final int strokeWidth; final int zIndex; } @@ -245,7 +245,7 @@ class PlatformPolyline { final String polylineId; final bool consumesTapEvents; - final int color; + final PlatformColor color; final bool geodesic; /// The joint type. @@ -414,7 +414,7 @@ class PlatformMapConfiguration { required this.indoorViewEnabled, required this.trafficEnabled, required this.buildingsEnabled, - required this.cloudMapId, + required this.mapId, required this.style, }); @@ -433,7 +433,7 @@ class PlatformMapConfiguration { final bool? indoorViewEnabled; final bool? trafficEnabled; final bool? buildingsEnabled; - final String? cloudMapId; + final String? mapId; final String? style; } @@ -453,6 +453,21 @@ class PlatformSize { final double height; } +/// Pigeon representation of a color. +class PlatformColor { + PlatformColor({ + required this.red, + required this.green, + required this.blue, + required this.alpha, + }); + + final double red; + final double green; + final double blue; + final double alpha; +} + /// Pigeon equivalent of GMSTileLayer properties. class PlatformTileLayer { PlatformTileLayer({ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml index 2dfd81cc2c1..3dd84d3a71d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_ios description: iOS implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.15.7 +version: 2.15.8 environment: sdk: ^3.8.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart index 84890f6f883..1b91f2a4a89 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart @@ -411,8 +411,8 @@ void main() { expect(toChange.length, 1); final PlatformCircle firstChanged = toChange.first; expect(firstChanged.consumeTapEvents, object2new.consumeTapEvents); - expect(firstChanged.fillColor, object2new.fillColor.value); - expect(firstChanged.strokeColor, object2new.strokeColor.value); + _expectColorsEqual(firstChanged.fillColor, object2new.fillColor); + _expectColorsEqual(firstChanged.strokeColor, object2new.strokeColor); expect(firstChanged.visible, object2new.visible); expect(firstChanged.strokeWidth, object2new.strokeWidth); expect(firstChanged.zIndex, object2new.zIndex.toDouble()); @@ -426,8 +426,8 @@ void main() { expect(toAdd.length, 1); final PlatformCircle firstAdded = toAdd.first; expect(firstAdded.consumeTapEvents, object3.consumeTapEvents); - expect(firstAdded.fillColor, object3.fillColor.value); - expect(firstAdded.strokeColor, object3.strokeColor.value); + _expectColorsEqual(firstAdded.fillColor, object3.fillColor); + _expectColorsEqual(firstAdded.strokeColor, object3.strokeColor); expect(firstAdded.visible, object3.visible); expect(firstAdded.strokeWidth, object3.strokeWidth); expect(firstAdded.zIndex, object3.zIndex.toDouble()); @@ -593,7 +593,7 @@ void main() { void expectPolygon(PlatformPolygon actual, Polygon expected) { expect(actual.polygonId, expected.polygonId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - expect(actual.fillColor, expected.fillColor.value); + _expectColorsEqual(actual.fillColor, expected.fillColor); expect(actual.geodesic, expected.geodesic); expect(actual.points.length, expected.points.length); for (final (int i, PlatformLatLng? point) in actual.points.indexed) { @@ -609,7 +609,7 @@ void main() { } } expect(actual.visible, expected.visible); - expect(actual.strokeColor, expected.strokeColor.value); + _expectColorsEqual(actual.strokeColor, expected.strokeColor); expect(actual.strokeWidth, expected.strokeWidth); expect(actual.zIndex, expected.zIndex); } @@ -663,7 +663,7 @@ void main() { void expectPolyline(PlatformPolyline actual, Polyline expected) { expect(actual.polylineId, expected.polylineId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - expect(actual.color, expected.color.value); + _expectColorsEqual(actual.color, expected.color); expect(actual.geodesic, expected.geodesic); expect( actual.jointType, @@ -1346,7 +1346,7 @@ void main() { expect(typedBitmap.height, 200.0); }); - testWidgets('cloudMapId is passed', (WidgetTester tester) async { + testWidgets('mapId is passed', (WidgetTester tester) async { const String cloudMapId = '000000000000000'; // Dummy map ID. final Completer passedCloudMapIdCompleter = Completer(); @@ -1366,7 +1366,7 @@ void main() { as PlatformMapViewCreationParams?; if (creationParams != null) { final String? passedMapId = - creationParams.mapConfiguration.cloudMapId; + creationParams.mapConfiguration.mapId; if (passedMapId != null) { passedCloudMapIdCompleter.complete(passedMapId); } @@ -1391,7 +1391,7 @@ void main() { ), textDirection: TextDirection.ltr, ), - mapConfiguration: const MapConfiguration(cloudMapId: cloudMapId), + mapConfiguration: const MapConfiguration(mapId: cloudMapId), ), ), ); @@ -1399,7 +1399,14 @@ void main() { expect( await passedCloudMapIdCompleter.future, cloudMapId, - reason: 'Should pass cloudMapId on PlatformView creation message', + reason: 'Should pass mapId on PlatformView creation message', ); }); } + +void _expectColorsEqual(PlatformColor actual, Color expected) { + expect(actual.red, expected.r); + expect(actual.green, expected.g); + expect(actual.blue, expected.b); + expect(actual.alpha, expected.a); +} diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart index 66d5d24c6e4..5c3cf395141 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/method_channel/serialization.dart @@ -130,7 +130,9 @@ Object serializeHeatmapGradient(HeatmapGradient gradient) { _addIfNonNull( json, _heatmapGradientColorsKey, - gradient.colors.map((HeatmapGradientColor e) => e.color.value).toList(), + gradient.colors + .map((HeatmapGradientColor e) => e.color.toARGB32()) + .toList(), ); _addIfNonNull( json, diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart index ef40f0ef751..8ad4752685f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/bitmap.dart @@ -1107,8 +1107,9 @@ class PinConfig extends BitmapDescriptor { Object toJson() => [ type, { - if (backgroundColor != null) 'backgroundColor': backgroundColor?.value, - if (borderColor != null) 'borderColor': borderColor?.value, + if (backgroundColor != null) + 'backgroundColor': backgroundColor?.toARGB32(), + if (borderColor != null) 'borderColor': borderColor?.toARGB32(), if (glyph != null) 'glyph': glyph?.toJson(), }, ]; @@ -1131,7 +1132,7 @@ class CircleGlyph extends AdvancedMarkerGlyph { @override Object toJson() => [ 'circleGlyph', - {'color': color.value}, + {'color': color.toARGB32()}, ]; } @@ -1175,7 +1176,7 @@ class TextGlyph extends AdvancedMarkerGlyph { 'textGlyph', { 'text': text, - if (textColor != null) 'textColor': textColor!.value, + if (textColor != null) 'textColor': textColor!.toARGB32(), }, ]; } diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart index c81e2184cbf..3dc0161d953 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/circle.dart @@ -121,10 +121,10 @@ class Circle implements MapsObject { addIfPresent('circleId', circleId.value); addIfPresent('consumeTapEvents', consumeTapEvents); - addIfPresent('fillColor', fillColor.value); + addIfPresent('fillColor', fillColor.toARGB32()); addIfPresent('center', center.toJson()); addIfPresent('radius', radius); - addIfPresent('strokeColor', strokeColor.value); + addIfPresent('strokeColor', strokeColor.toARGB32()); addIfPresent('strokeWidth', strokeWidth); addIfPresent('visible', visible); addIfPresent('zIndex', zIndex); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart index 950711868ea..1eb10292aa8 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/heatmap.dart @@ -293,7 +293,7 @@ class HeatmapGradient { addIfPresent( 'colors', - colors.map((HeatmapGradientColor e) => e.color.value).toList(), + colors.map((HeatmapGradientColor e) => e.color.toARGB32()).toList(), ); addIfPresent( 'startPoints', diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart index 1cf820f0849..fed4a2c9e48 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polygon.dart @@ -141,9 +141,9 @@ class Polygon implements MapsObject { addIfPresent('polygonId', polygonId.value); addIfPresent('consumeTapEvents', consumeTapEvents); - addIfPresent('fillColor', fillColor.value); + addIfPresent('fillColor', fillColor.toARGB32()); addIfPresent('geodesic', geodesic); - addIfPresent('strokeColor', strokeColor.value); + addIfPresent('strokeColor', strokeColor.toARGB32()); addIfPresent('strokeWidth', strokeWidth); addIfPresent('visible', visible); addIfPresent('zIndex', zIndex); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart index 6dcee15fd63..085ed9e34be 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/polyline.dart @@ -171,7 +171,7 @@ class Polyline implements MapsObject { addIfPresent('polylineId', polylineId.value); addIfPresent('consumeTapEvents', consumeTapEvents); - addIfPresent('color', color.value); + addIfPresent('color', color.toARGB32()); addIfPresent('endCap', endCap.toJson()); addIfPresent('geodesic', geodesic); addIfPresent('jointType', jointType.value); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart index 13ccb726840..16aa10d28ee 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/bitmap_test.dart @@ -784,8 +784,8 @@ void main() { expect(pinConfig.toJson(), [ PinConfig.type, { - 'backgroundColor': Colors.green.value, - 'borderColor': Colors.blue.value, + 'backgroundColor': Colors.green.toARGB32(), + 'borderColor': Colors.blue.toARGB32(), }, ]); }); @@ -802,11 +802,14 @@ void main() { expect(pinConfig.toJson(), [ PinConfig.type, { - 'backgroundColor': Colors.green.value, - 'borderColor': Colors.blue.value, + 'backgroundColor': Colors.green.toARGB32(), + 'borderColor': Colors.blue.toARGB32(), 'glyph': [ 'textGlyph', - {'text': 'Hello', 'textColor': Colors.red.value}, + { + 'text': 'Hello', + 'textColor': Colors.red.toARGB32(), + }, ], }, ]); @@ -831,8 +834,8 @@ void main() { 'bitmap': ['fromAsset', 'red_square.png'], }, ], - 'backgroundColor': Colors.black.value, - 'borderColor': Colors.red.value, + 'backgroundColor': Colors.black.toARGB32(), + 'borderColor': Colors.red.toARGB32(), }, ]); }); diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart index 44f3a135b4f..93329adbdf3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/test/types/heatmap_test.dart @@ -303,7 +303,7 @@ void main() { expect(gradient.toJson(), { 'colors': colors - .map((HeatmapGradientColor e) => e.color.value) + .map((HeatmapGradientColor e) => e.color.toARGB32()) .toList(), 'startPoints': colors .map((HeatmapGradientColor e) => e.startPoint) From 575320e3622f0c60b28bd68f00df4f855ad67f05 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 19 Nov 2025 16:45:49 -0500 Subject: [PATCH 2/4] Fix min platform interface versions --- .../google_maps_flutter_android/example/pubspec.yaml | 2 +- .../google_maps_flutter_android/pubspec.yaml | 2 +- .../google_maps_flutter_ios/example/ios14/pubspec.yaml | 2 +- .../google_maps_flutter_ios/example/ios15/pubspec.yaml | 2 +- .../example/shared/maps_example_dart/pubspec.yaml | 2 +- .../google_maps_flutter/google_maps_flutter_ios/pubspec.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml index e556fa6acf9..58cec3dcf1a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - google_maps_flutter_platform_interface: ^2.11.0 + google_maps_flutter_platform_interface: ^2.13.0 dev_dependencies: build_runner: ^2.1.10 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index bb75e4469ea..af4932a0ad2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: flutter: sdk: flutter flutter_plugin_android_lifecycle: ^2.0.1 - google_maps_flutter_platform_interface: ^2.11.0 + google_maps_flutter_platform_interface: ^2.13.0 stream_transform: ^2.0.0 dev_dependencies: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml index d4192ad9642..125a5a2ac4d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../../ - google_maps_flutter_platform_interface: ^2.12.1 + google_maps_flutter_platform_interface: ^2.13.0 maps_example_dart: path: ../shared/maps_example_dart/ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml index d4192ad9642..125a5a2ac4d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../../ - google_maps_flutter_platform_interface: ^2.12.1 + google_maps_flutter_platform_interface: ^2.13.0 maps_example_dart: path: ../shared/maps_example_dart/ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml index a0c48d88f36..c29432c7f7a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../../../ - google_maps_flutter_platform_interface: ^2.12.1 + google_maps_flutter_platform_interface: ^2.13.0 dev_dependencies: flutter_test: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml index 3dd84d3a71d..eb4fe6d3a4e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml @@ -19,7 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - google_maps_flutter_platform_interface: ^2.12.1 + google_maps_flutter_platform_interface: ^2.13.0 stream_transform: ^2.0.0 dev_dependencies: From b5443636e7fc476c49e6a4cfbc943c17995cae9a Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Wed, 19 Nov 2025 16:47:27 -0500 Subject: [PATCH 3/4] Missing version/changelog --- .../google_maps_flutter_platform_interface/CHANGELOG.md | 3 ++- .../google_maps_flutter_platform_interface/pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md index 7183bed62b7..163cb160043 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 2.14.1 +* Replaces internal use of deprecated methods. * Updates minimum supported SDK version to Flutter 3.32/Dart 3.8. ## 2.14.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml index 9f98762bd09..9aa5ed82840 100644 --- a/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/google_maps_f issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 2.14.0 +version: 2.14.1 environment: sdk: ^3.8.0 From b2b7d56d8fc3a068e57fabf8b2416b6db30a6358 Mon Sep 17 00:00:00 2001 From: Stuart Morgan Date: Thu, 20 Nov 2025 09:26:27 -0500 Subject: [PATCH 4/4] Revert all but platform interface --- .../google_maps_flutter/CHANGELOG.md | 3 +- .../example/lib/map_map_id.dart | 1 - .../lib/src/google_map.dart | 2 +- .../google_maps_flutter/pubspec.yaml | 2 +- .../google_maps_flutter_android/CHANGELOG.md | 4 - .../flutter/plugins/googlemaps/Convert.java | 10 +- .../plugins/googlemaps/GoogleMapFactory.java | 2 +- .../flutter/plugins/googlemaps/Messages.java | 268 +++++++----------- .../googlemaps/CirclesControllerTest.java | 4 +- .../integration_test/google_maps_test.dart | 5 +- .../example/lib/example_google_map.dart | 6 +- .../example/lib/map_map_id.dart | 3 +- .../example/pubspec.yaml | 2 +- .../lib/src/google_maps_flutter_android.dart | 17 +- .../lib/src/messages.g.dart | 177 +++++------- .../lib/src/serialization.dart | 4 +- .../pigeons/messages.dart | 27 +- .../google_maps_flutter_android/pubspec.yaml | 4 +- .../google_maps_flutter_android_test.dart | 31 +- .../google_maps_flutter_ios/CHANGELOG.md | 4 - .../integration_test/google_maps_test.dart | 2 +- .../ios14/ios/Flutter/AppFrameworkInfo.plist | 2 +- .../ios/Runner.xcodeproj/project.pbxproj | 10 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 - ...GoogleMapJSONConversionsConversionTests.m} | 21 +- .../GoogleMapsCircleControllerTests.m | 10 +- .../GoogleMapsPolygonControllerTests.m | 27 +- .../GoogleMapsPolylineControllerTests.m | 32 +-- .../example/ios14/pubspec.yaml | 2 +- .../example/ios15/pubspec.yaml | 2 +- .../lib/example_google_map.dart | 6 +- .../maps_example_dart/lib/map_map_id.dart | 2 +- .../shared/maps_example_dart/pubspec.yaml | 2 +- .../Classes/FGMClusterManagersController.m | 2 +- .../ios/Classes/FGMGroundOverlayController.m | 2 +- .../Classes/FLTGoogleMapHeatmapController.m | 11 +- ...nUtils.h => FLTGoogleMapJSONConversions.h} | 7 +- ...nUtils.m => FLTGoogleMapJSONConversions.m} | 30 +- .../FLTGoogleMapTileOverlayController.m | 2 +- .../ios/Classes/GoogleMapCircleController.m | 6 +- .../ios/Classes/GoogleMapController.m | 4 +- .../ios/Classes/GoogleMapMarkerController.m | 2 +- .../ios/Classes/GoogleMapPolygonController.m | 6 +- .../ios/Classes/GoogleMapPolylineController.m | 4 +- .../google_maps_flutter_ios-umbrella.h | 2 +- .../ios/Classes/messages.g.h | 36 +-- .../ios/Classes/messages.g.m | 113 +++----- .../lib/src/google_maps_flutter_ios.dart | 42 +-- .../lib/src/messages.g.dart | 123 +++----- .../lib/src/serialization.dart | 6 +- .../pigeons/messages.dart | 33 +-- .../google_maps_flutter_ios/pubspec.yaml | 4 +- .../test/google_maps_flutter_ios_test.dart | 29 +- 53 files changed, 418 insertions(+), 742 deletions(-) rename packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/{FGMConversionsUtilsTests.m => FLTGoogleMapJSONConversionsConversionTests.m} (95%) rename packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/{FGMConversionUtils.h => FLTGoogleMapJSONConversions.h} (94%) rename packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/{FGMConversionUtils.m => FLTGoogleMapJSONConversions.m} (95%) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 2386feeee9d..64bc5dc7a8b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,6 +1,5 @@ -## 2.14.1 +## NEXT -* Replaces internal use of deprecated methods. * Updates minimum supported SDK version to Flutter 3.32/Dart 3.8. ## 2.14.0 diff --git a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart index 362cbea31de..d9befb15a88 100644 --- a/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter/example/lib/map_map_id.dart @@ -54,7 +54,6 @@ class MapIdBodyState extends State { switch (_initializedRenderer) { case AndroidMapRenderer.latest: return 'latest'; - // ignore: deprecated_member_use case AndroidMapRenderer.legacy: return 'legacy'; case AndroidMapRenderer.platformDefault: diff --git a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart index 627efae290d..44f6dd5d812 100644 --- a/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter/lib/src/google_map.dart @@ -723,7 +723,7 @@ MapConfiguration _configurationFromMapWidget(GoogleMap map) { indoorViewEnabled: map.indoorViewEnabled, trafficEnabled: map.trafficEnabled, buildingsEnabled: map.buildingsEnabled, - mapId: map.cloudMapId, + cloudMapId: map.cloudMapId, // A null style in the widget means no style, which is expressed as '' in // the configuration to distinguish from no change (null). style: map.style ?? '', diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index d928fb3b21f..7f16bf9fb63 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.14.1 +version: 2.14.0 environment: sdk: ^3.8.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md index 6c42bdb8a51..d7d88983c3e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_android/CHANGELOG.md @@ -1,7 +1,3 @@ -## 2.18.6 - -* Replaces internal use of deprecated methods. - ## 2.18.5 * Updates to Pigeon 26. diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java index 44765122a1f..871f1eb24d7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Convert.java @@ -627,8 +627,8 @@ static String interpretPolygonOptions(Messages.PlatformPolygon polygon, PolygonO sink.setConsumeTapEvents(polygon.getConsumesTapEvents()); sink.setGeodesic(polygon.getGeodesic()); sink.setVisible(polygon.getVisible()); - sink.setFillColor(polygon.getFillColor().getArgbValue().intValue()); - sink.setStrokeColor(polygon.getStrokeColor().getArgbValue().intValue()); + sink.setFillColor(polygon.getFillColor().intValue()); + sink.setStrokeColor(polygon.getStrokeColor().intValue()); sink.setStrokeWidth(polygon.getStrokeWidth()); sink.setZIndex(polygon.getZIndex()); sink.setPoints(pointsFromPigeon(polygon.getPoints())); @@ -654,7 +654,7 @@ static String interpretPolylineOptions( AssetManager assetManager, float density) { sink.setConsumeTapEvents(polyline.getConsumesTapEvents()); - sink.setColor(polyline.getColor().getArgbValue().intValue()); + sink.setColor(polyline.getColor().intValue()); sink.setEndCap(capFromPigeon(polyline.getEndCap(), assetManager, density)); sink.setStartCap(capFromPigeon(polyline.getStartCap(), assetManager, density)); sink.setGeodesic(polyline.getGeodesic()); @@ -669,8 +669,8 @@ static String interpretPolylineOptions( static String interpretCircleOptions(Messages.PlatformCircle circle, CircleOptionsSink sink) { sink.setConsumeTapEvents(circle.getConsumeTapEvents()); - sink.setFillColor(circle.getFillColor().getArgbValue().intValue()); - sink.setStrokeColor(circle.getStrokeColor().getArgbValue().intValue()); + sink.setFillColor(circle.getFillColor().intValue()); + sink.setStrokeColor(circle.getStrokeColor().intValue()); sink.setStrokeWidth(circle.getStrokeWidth()); sink.setZIndex(circle.getZIndex().floatValue()); sink.setCenter(toLatLng(circle.getCenter().toList())); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java index 0cd2c6920f2..a0a25948efd 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/GoogleMapFactory.java @@ -48,7 +48,7 @@ public PlatformView create(@NonNull Context context, int id, @Nullable Object ar builder.setInitialTileOverlays(params.getInitialTileOverlays()); builder.setInitialGroundOverlays(params.getInitialGroundOverlays()); - final String cloudMapId = mapConfig.getMapId(); + final String cloudMapId = mapConfig.getCloudMapId(); if (cloudMapId != null) { builder.setMapId(cloudMapId); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java index d37e4854fba..8507c6de157 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/main/java/io/flutter/plugins/googlemaps/Messages.java @@ -1074,26 +1074,26 @@ public void setConsumeTapEvents(@NonNull Boolean setterArg) { this.consumeTapEvents = setterArg; } - private @NonNull PlatformColor fillColor; + private @NonNull Long fillColor; - public @NonNull PlatformColor getFillColor() { + public @NonNull Long getFillColor() { return fillColor; } - public void setFillColor(@NonNull PlatformColor setterArg) { + public void setFillColor(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"fillColor\" is null."); } this.fillColor = setterArg; } - private @NonNull PlatformColor strokeColor; + private @NonNull Long strokeColor; - public @NonNull PlatformColor getStrokeColor() { + public @NonNull Long getStrokeColor() { return strokeColor; } - public void setStrokeColor(@NonNull PlatformColor setterArg) { + public void setStrokeColor(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"strokeColor\" is null."); } @@ -1225,18 +1225,18 @@ public static final class Builder { return this; } - private @Nullable PlatformColor fillColor; + private @Nullable Long fillColor; @CanIgnoreReturnValue - public @NonNull Builder setFillColor(@NonNull PlatformColor setterArg) { + public @NonNull Builder setFillColor(@NonNull Long setterArg) { this.fillColor = setterArg; return this; } - private @Nullable PlatformColor strokeColor; + private @Nullable Long strokeColor; @CanIgnoreReturnValue - public @NonNull Builder setStrokeColor(@NonNull PlatformColor setterArg) { + public @NonNull Builder setStrokeColor(@NonNull Long setterArg) { this.strokeColor = setterArg; return this; } @@ -1324,9 +1324,9 @@ ArrayList toList() { Object consumeTapEvents = pigeonVar_list.get(0); pigeonResult.setConsumeTapEvents((Boolean) consumeTapEvents); Object fillColor = pigeonVar_list.get(1); - pigeonResult.setFillColor((PlatformColor) fillColor); + pigeonResult.setFillColor((Long) fillColor); Object strokeColor = pigeonVar_list.get(2); - pigeonResult.setStrokeColor((PlatformColor) strokeColor); + pigeonResult.setStrokeColor((Long) strokeColor); Object visible = pigeonVar_list.get(3); pigeonResult.setVisible((Boolean) visible); Object strokeWidth = pigeonVar_list.get(4); @@ -1585,79 +1585,6 @@ ArrayList toList() { } } - /** - * Pigeon equivalent of the Color class. - * - *

See https://developer.android.com/reference/android/graphics/Color.html. - * - *

Generated class from Pigeon that represents data sent in messages. - */ - public static final class PlatformColor { - private @NonNull Long argbValue; - - public @NonNull Long getArgbValue() { - return argbValue; - } - - public void setArgbValue(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"argbValue\" is null."); - } - this.argbValue = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - PlatformColor() {} - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PlatformColor that = (PlatformColor) o; - return argbValue.equals(that.argbValue); - } - - @Override - public int hashCode() { - return Objects.hash(argbValue); - } - - public static final class Builder { - - private @Nullable Long argbValue; - - @CanIgnoreReturnValue - public @NonNull Builder setArgbValue(@NonNull Long setterArg) { - this.argbValue = setterArg; - return this; - } - - public @NonNull PlatformColor build() { - PlatformColor pigeonReturn = new PlatformColor(); - pigeonReturn.setArgbValue(argbValue); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList<>(1); - toListResult.add(argbValue); - return toListResult; - } - - static @NonNull PlatformColor fromList(@NonNull ArrayList pigeonVar_list) { - PlatformColor pigeonResult = new PlatformColor(); - Object argbValue = pigeonVar_list.get(0); - pigeonResult.setArgbValue((Long) argbValue); - return pigeonResult; - } - } - /** * Pigeon equivalent of the InfoWindow class. * @@ -2200,13 +2127,13 @@ public void setConsumesTapEvents(@NonNull Boolean setterArg) { this.consumesTapEvents = setterArg; } - private @NonNull PlatformColor fillColor; + private @NonNull Long fillColor; - public @NonNull PlatformColor getFillColor() { + public @NonNull Long getFillColor() { return fillColor; } - public void setFillColor(@NonNull PlatformColor setterArg) { + public void setFillColor(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"fillColor\" is null."); } @@ -2265,13 +2192,13 @@ public void setVisible(@NonNull Boolean setterArg) { this.visible = setterArg; } - private @NonNull PlatformColor strokeColor; + private @NonNull Long strokeColor; - public @NonNull PlatformColor getStrokeColor() { + public @NonNull Long getStrokeColor() { return strokeColor; } - public void setStrokeColor(@NonNull PlatformColor setterArg) { + public void setStrokeColor(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"strokeColor\" is null."); } @@ -2361,10 +2288,10 @@ public static final class Builder { return this; } - private @Nullable PlatformColor fillColor; + private @Nullable Long fillColor; @CanIgnoreReturnValue - public @NonNull Builder setFillColor(@NonNull PlatformColor setterArg) { + public @NonNull Builder setFillColor(@NonNull Long setterArg) { this.fillColor = setterArg; return this; } @@ -2401,10 +2328,10 @@ public static final class Builder { return this; } - private @Nullable PlatformColor strokeColor; + private @Nullable Long strokeColor; @CanIgnoreReturnValue - public @NonNull Builder setStrokeColor(@NonNull PlatformColor setterArg) { + public @NonNull Builder setStrokeColor(@NonNull Long setterArg) { this.strokeColor = setterArg; return this; } @@ -2464,7 +2391,7 @@ ArrayList toList() { Object consumesTapEvents = pigeonVar_list.get(1); pigeonResult.setConsumesTapEvents((Boolean) consumesTapEvents); Object fillColor = pigeonVar_list.get(2); - pigeonResult.setFillColor((PlatformColor) fillColor); + pigeonResult.setFillColor((Long) fillColor); Object geodesic = pigeonVar_list.get(3); pigeonResult.setGeodesic((Boolean) geodesic); Object points = pigeonVar_list.get(4); @@ -2474,7 +2401,7 @@ ArrayList toList() { Object visible = pigeonVar_list.get(6); pigeonResult.setVisible((Boolean) visible); Object strokeColor = pigeonVar_list.get(7); - pigeonResult.setStrokeColor((PlatformColor) strokeColor); + pigeonResult.setStrokeColor((Long) strokeColor); Object strokeWidth = pigeonVar_list.get(8); pigeonResult.setStrokeWidth((Long) strokeWidth); Object zIndex = pigeonVar_list.get(9); @@ -2515,13 +2442,13 @@ public void setConsumesTapEvents(@NonNull Boolean setterArg) { this.consumesTapEvents = setterArg; } - private @NonNull PlatformColor color; + private @NonNull Long color; - public @NonNull PlatformColor getColor() { + public @NonNull Long getColor() { return color; } - public void setColor(@NonNull PlatformColor setterArg) { + public void setColor(@NonNull Long setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"color\" is null."); } @@ -2712,10 +2639,10 @@ public static final class Builder { return this; } - private @Nullable PlatformColor color; + private @Nullable Long color; @CanIgnoreReturnValue - public @NonNull Builder setColor(@NonNull PlatformColor setterArg) { + public @NonNull Builder setColor(@NonNull Long setterArg) { this.color = setterArg; return this; } @@ -2835,7 +2762,7 @@ ArrayList toList() { Object consumesTapEvents = pigeonVar_list.get(1); pigeonResult.setConsumesTapEvents((Boolean) consumesTapEvents); Object color = pigeonVar_list.get(2); - pigeonResult.setColor((PlatformColor) color); + pigeonResult.setColor((Long) color); Object geodesic = pigeonVar_list.get(3); pigeonResult.setGeodesic((Boolean) geodesic); Object jointType = pigeonVar_list.get(4); @@ -4808,14 +4735,14 @@ public void setLiteModeEnabled(@Nullable Boolean setterArg) { this.liteModeEnabled = setterArg; } - private @Nullable String mapId; + private @Nullable String cloudMapId; - public @Nullable String getMapId() { - return mapId; + public @Nullable String getCloudMapId() { + return cloudMapId; } - public void setMapId(@Nullable String setterArg) { - this.mapId = setterArg; + public void setCloudMapId(@Nullable String setterArg) { + this.cloudMapId = setterArg; } private @Nullable String style; @@ -4855,7 +4782,7 @@ public boolean equals(Object o) { && Objects.equals(trafficEnabled, that.trafficEnabled) && Objects.equals(buildingsEnabled, that.buildingsEnabled) && Objects.equals(liteModeEnabled, that.liteModeEnabled) - && Objects.equals(mapId, that.mapId) + && Objects.equals(cloudMapId, that.cloudMapId) && Objects.equals(style, that.style); } @@ -4880,7 +4807,7 @@ public int hashCode() { trafficEnabled, buildingsEnabled, liteModeEnabled, - mapId, + cloudMapId, style); } @@ -5031,11 +4958,11 @@ public static final class Builder { return this; } - private @Nullable String mapId; + private @Nullable String cloudMapId; @CanIgnoreReturnValue - public @NonNull Builder setMapId(@Nullable String setterArg) { - this.mapId = setterArg; + public @NonNull Builder setCloudMapId(@Nullable String setterArg) { + this.cloudMapId = setterArg; return this; } @@ -5067,7 +4994,7 @@ public static final class Builder { pigeonReturn.setTrafficEnabled(trafficEnabled); pigeonReturn.setBuildingsEnabled(buildingsEnabled); pigeonReturn.setLiteModeEnabled(liteModeEnabled); - pigeonReturn.setMapId(mapId); + pigeonReturn.setCloudMapId(cloudMapId); pigeonReturn.setStyle(style); return pigeonReturn; } @@ -5094,7 +5021,7 @@ ArrayList toList() { toListResult.add(trafficEnabled); toListResult.add(buildingsEnabled); toListResult.add(liteModeEnabled); - toListResult.add(mapId); + toListResult.add(cloudMapId); toListResult.add(style); return toListResult; } @@ -5137,8 +5064,8 @@ ArrayList toList() { pigeonResult.setBuildingsEnabled((Boolean) buildingsEnabled); Object liteModeEnabled = pigeonVar_list.get(17); pigeonResult.setLiteModeEnabled((Boolean) liteModeEnabled); - Object mapId = pigeonVar_list.get(18); - pigeonResult.setMapId((String) mapId); + Object cloudMapId = pigeonVar_list.get(18); + pigeonResult.setCloudMapId((String) cloudMapId); Object style = pigeonVar_list.get(19); pigeonResult.setStyle((String) style); return pigeonResult; @@ -6348,58 +6275,56 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { case (byte) 148: return PlatformDoublePair.fromList((ArrayList) readValue(buffer)); case (byte) 149: - return PlatformColor.fromList((ArrayList) readValue(buffer)); - case (byte) 150: return PlatformInfoWindow.fromList((ArrayList) readValue(buffer)); - case (byte) 151: + case (byte) 150: return PlatformMarker.fromList((ArrayList) readValue(buffer)); - case (byte) 152: + case (byte) 151: return PlatformPolygon.fromList((ArrayList) readValue(buffer)); - case (byte) 153: + case (byte) 152: return PlatformPolyline.fromList((ArrayList) readValue(buffer)); - case (byte) 154: + case (byte) 153: return PlatformCap.fromList((ArrayList) readValue(buffer)); - case (byte) 155: + case (byte) 154: return PlatformPatternItem.fromList((ArrayList) readValue(buffer)); - case (byte) 156: + case (byte) 155: return PlatformTile.fromList((ArrayList) readValue(buffer)); - case (byte) 157: + case (byte) 156: return PlatformTileOverlay.fromList((ArrayList) readValue(buffer)); - case (byte) 158: + case (byte) 157: return PlatformEdgeInsets.fromList((ArrayList) readValue(buffer)); - case (byte) 159: + case (byte) 158: return PlatformLatLng.fromList((ArrayList) readValue(buffer)); - case (byte) 160: + case (byte) 159: return PlatformLatLngBounds.fromList((ArrayList) readValue(buffer)); - case (byte) 161: + case (byte) 160: return PlatformCluster.fromList((ArrayList) readValue(buffer)); - case (byte) 162: + case (byte) 161: return PlatformGroundOverlay.fromList((ArrayList) readValue(buffer)); - case (byte) 163: + case (byte) 162: return PlatformCameraTargetBounds.fromList((ArrayList) readValue(buffer)); - case (byte) 164: + case (byte) 163: return PlatformMapViewCreationParams.fromList((ArrayList) readValue(buffer)); - case (byte) 165: + case (byte) 164: return PlatformMapConfiguration.fromList((ArrayList) readValue(buffer)); - case (byte) 166: + case (byte) 165: return PlatformPoint.fromList((ArrayList) readValue(buffer)); - case (byte) 167: + case (byte) 166: return PlatformTileLayer.fromList((ArrayList) readValue(buffer)); - case (byte) 168: + case (byte) 167: return PlatformZoomRange.fromList((ArrayList) readValue(buffer)); - case (byte) 169: + case (byte) 168: return PlatformBitmap.fromList((ArrayList) readValue(buffer)); - case (byte) 170: + case (byte) 169: return PlatformBitmapDefaultMarker.fromList((ArrayList) readValue(buffer)); - case (byte) 171: + case (byte) 170: return PlatformBitmapBytes.fromList((ArrayList) readValue(buffer)); - case (byte) 172: + case (byte) 171: return PlatformBitmapAsset.fromList((ArrayList) readValue(buffer)); - case (byte) 173: + case (byte) 172: return PlatformBitmapAssetImage.fromList((ArrayList) readValue(buffer)); - case (byte) 174: + case (byte) 173: return PlatformBitmapAssetMap.fromList((ArrayList) readValue(buffer)); - case (byte) 175: + case (byte) 174: return PlatformBitmapBytesMap.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); @@ -6468,86 +6393,83 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { } else if (value instanceof PlatformDoublePair) { stream.write(148); writeValue(stream, ((PlatformDoublePair) value).toList()); - } else if (value instanceof PlatformColor) { - stream.write(149); - writeValue(stream, ((PlatformColor) value).toList()); } else if (value instanceof PlatformInfoWindow) { - stream.write(150); + stream.write(149); writeValue(stream, ((PlatformInfoWindow) value).toList()); } else if (value instanceof PlatformMarker) { - stream.write(151); + stream.write(150); writeValue(stream, ((PlatformMarker) value).toList()); } else if (value instanceof PlatformPolygon) { - stream.write(152); + stream.write(151); writeValue(stream, ((PlatformPolygon) value).toList()); } else if (value instanceof PlatformPolyline) { - stream.write(153); + stream.write(152); writeValue(stream, ((PlatformPolyline) value).toList()); } else if (value instanceof PlatformCap) { - stream.write(154); + stream.write(153); writeValue(stream, ((PlatformCap) value).toList()); } else if (value instanceof PlatformPatternItem) { - stream.write(155); + stream.write(154); writeValue(stream, ((PlatformPatternItem) value).toList()); } else if (value instanceof PlatformTile) { - stream.write(156); + stream.write(155); writeValue(stream, ((PlatformTile) value).toList()); } else if (value instanceof PlatformTileOverlay) { - stream.write(157); + stream.write(156); writeValue(stream, ((PlatformTileOverlay) value).toList()); } else if (value instanceof PlatformEdgeInsets) { - stream.write(158); + stream.write(157); writeValue(stream, ((PlatformEdgeInsets) value).toList()); } else if (value instanceof PlatformLatLng) { - stream.write(159); + stream.write(158); writeValue(stream, ((PlatformLatLng) value).toList()); } else if (value instanceof PlatformLatLngBounds) { - stream.write(160); + stream.write(159); writeValue(stream, ((PlatformLatLngBounds) value).toList()); } else if (value instanceof PlatformCluster) { - stream.write(161); + stream.write(160); writeValue(stream, ((PlatformCluster) value).toList()); } else if (value instanceof PlatformGroundOverlay) { - stream.write(162); + stream.write(161); writeValue(stream, ((PlatformGroundOverlay) value).toList()); } else if (value instanceof PlatformCameraTargetBounds) { - stream.write(163); + stream.write(162); writeValue(stream, ((PlatformCameraTargetBounds) value).toList()); } else if (value instanceof PlatformMapViewCreationParams) { - stream.write(164); + stream.write(163); writeValue(stream, ((PlatformMapViewCreationParams) value).toList()); } else if (value instanceof PlatformMapConfiguration) { - stream.write(165); + stream.write(164); writeValue(stream, ((PlatformMapConfiguration) value).toList()); } else if (value instanceof PlatformPoint) { - stream.write(166); + stream.write(165); writeValue(stream, ((PlatformPoint) value).toList()); } else if (value instanceof PlatformTileLayer) { - stream.write(167); + stream.write(166); writeValue(stream, ((PlatformTileLayer) value).toList()); } else if (value instanceof PlatformZoomRange) { - stream.write(168); + stream.write(167); writeValue(stream, ((PlatformZoomRange) value).toList()); } else if (value instanceof PlatformBitmap) { - stream.write(169); + stream.write(168); writeValue(stream, ((PlatformBitmap) value).toList()); } else if (value instanceof PlatformBitmapDefaultMarker) { - stream.write(170); + stream.write(169); writeValue(stream, ((PlatformBitmapDefaultMarker) value).toList()); } else if (value instanceof PlatformBitmapBytes) { - stream.write(171); + stream.write(170); writeValue(stream, ((PlatformBitmapBytes) value).toList()); } else if (value instanceof PlatformBitmapAsset) { - stream.write(172); + stream.write(171); writeValue(stream, ((PlatformBitmapAsset) value).toList()); } else if (value instanceof PlatformBitmapAssetImage) { - stream.write(173); + stream.write(172); writeValue(stream, ((PlatformBitmapAssetImage) value).toList()); } else if (value instanceof PlatformBitmapAssetMap) { - stream.write(174); + stream.write(173); writeValue(stream, ((PlatformBitmapAssetMap) value).toList()); } else if (value instanceof PlatformBitmapBytesMap) { - stream.write(175); + stream.write(174); writeValue(stream, ((PlatformBitmapBytesMap) value).toList()); } else { super.writeValue(stream, value); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java index dcd07ecd6c7..8ca208c7ba1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java +++ b/packages/google_maps_flutter/google_maps_flutter_android/android/src/test/java/io/flutter/plugins/googlemaps/CirclesControllerTest.java @@ -52,10 +52,10 @@ public void controller_changeCircles_updatesExistingCircle() { builder .setCircleId(id) .setConsumeTapEvents(false) - .setFillColor(new Messages.PlatformColor.Builder().setArgbValue(0L).build()) + .setFillColor(0L) .setCenter(new Messages.PlatformLatLng.Builder().setLatitude(0.0).setLongitude(0.0).build()) .setRadius(1.0) - .setStrokeColor(new Messages.PlatformColor.Builder().setArgbValue(0L).build()) + .setStrokeColor(0L) .setStrokeWidth(1L) .setVisible(true) .setZIndex(0.0); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart index 89dcced0918..d421bcf9718 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/integration_test/google_maps_test.dart @@ -65,7 +65,6 @@ void main() { // value. expect( initializedRenderer == AndroidMapRenderer.latest || - // ignore: deprecated_member_use initializedRenderer == AndroidMapRenderer.legacy, true, ); @@ -1469,7 +1468,7 @@ void main() { } }); - testWidgets('testMapId', (WidgetTester tester) async { + testWidgets('testCloudMapId', (WidgetTester tester) async { final Completer mapIdCompleter = Completer(); final Key key = GlobalKey(); @@ -1482,7 +1481,7 @@ void main() { onMapCreated: (ExampleGoogleMapController controller) { mapIdCompleter.complete(controller.mapId); }, - mapId: _kCloudMapId, + cloudMapId: _kCloudMapId, ), ), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart index 518304c93fd..bee30555b2e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/example_google_map.dart @@ -316,7 +316,7 @@ class ExampleGoogleMap extends StatefulWidget { this.onCameraIdle, this.onTap, this.onLongPress, - this.mapId, + this.cloudMapId, this.style, }); @@ -430,7 +430,7 @@ class ExampleGoogleMap extends StatefulWidget { /// /// See https://developers.google.com/maps/documentation/get-map-id /// for more details. - final String? mapId; + final String? cloudMapId; /// The locally configured style for the map. final String? style; @@ -680,7 +680,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) { indoorViewEnabled: map.indoorViewEnabled, trafficEnabled: map.trafficEnabled, buildingsEnabled: map.buildingsEnabled, - mapId: map.mapId, + cloudMapId: map.cloudMapId, style: map.style, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart index fb33ce4ab9b..039966595ba 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/lib/map_map_id.dart @@ -53,7 +53,6 @@ class MapIdBodyState extends State { switch (_initializedRenderer) { case AndroidMapRenderer.latest: return 'latest'; - // ignore: deprecated_member_use case AndroidMapRenderer.legacy: return 'legacy'; case AndroidMapRenderer.platformDefault: @@ -81,7 +80,7 @@ class MapIdBodyState extends State { zoom: 7.0, ), key: _key, - mapId: _mapId, + cloudMapId: _mapId, ); final List columnChildren = [ diff --git a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml index 58cec3dcf1a..e556fa6acf9 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/example/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - google_maps_flutter_platform_interface: ^2.13.0 + google_maps_flutter_platform_interface: ^2.11.0 dev_dependencies: build_runner: ^2.1.10 diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart index 7996c8c7967..34d05ca6f8f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/google_maps_flutter_android.dart @@ -16,6 +16,9 @@ import 'google_map_inspector_android.dart'; import 'messages.g.dart'; import 'serialization.dart'; +// TODO(stuartmorgan): Remove the dependency on platform interface toJson +// methods. Channel serialization details should all be package-internal. + /// The non-test implementation of `_apiProvider`. MapsApi _productionApiProvider(int mapId) { return MapsApi(messageChannelSuffix: mapId.toString()); @@ -771,8 +774,8 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { static PlatformCircle _platformCircleFromCircle(Circle circle) { return PlatformCircle( consumeTapEvents: circle.consumeTapEvents, - fillColor: PlatformColor(argbValue: circle.fillColor.toARGB32()), - strokeColor: PlatformColor(argbValue: circle.strokeColor.toARGB32()), + fillColor: circle.fillColor.value, + strokeColor: circle.strokeColor.value, visible: circle.visible, strokeWidth: circle.strokeWidth, zIndex: circle.zIndex.toDouble(), @@ -859,12 +862,12 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { }).toList(); return PlatformPolygon( polygonId: polygon.polygonId.value, - fillColor: PlatformColor(argbValue: polygon.fillColor.toARGB32()), + fillColor: polygon.fillColor.value, geodesic: polygon.geodesic, consumesTapEvents: polygon.consumeTapEvents, points: points, holes: holes, - strokeColor: PlatformColor(argbValue: polygon.strokeColor.toARGB32()), + strokeColor: polygon.strokeColor.value, strokeWidth: polygon.strokeWidth, zIndex: polygon.zIndex, visible: polygon.visible, @@ -881,7 +884,7 @@ class GoogleMapsFlutterAndroid extends GoogleMapsFlutterPlatform { return PlatformPolyline( polylineId: polyline.polylineId.value, consumesTapEvents: polyline.consumeTapEvents, - color: PlatformColor(argbValue: polyline.color.toARGB32()), + color: polyline.color.value, startCap: platformCapFromCap(polyline.startCap), endCap: platformCapFromCap(polyline.endCap), geodesic: polyline.geodesic, @@ -1369,7 +1372,7 @@ PlatformMapConfiguration _platformMapConfigurationFromMapConfiguration( trafficEnabled: config.trafficEnabled, buildingsEnabled: config.buildingsEnabled, liteModeEnabled: config.liteModeEnabled, - mapId: config.mapId, + cloudMapId: config.cloudMapId, style: config.style, ); } @@ -1414,7 +1417,7 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( trafficEnabled: options['trafficEnabled'] as bool?, buildingsEnabled: options['buildingsEnabled'] as bool?, liteModeEnabled: options['liteModeEnabled'] as bool?, - mapId: options['cloudMapId'] as String?, + cloudMapId: options['cloudMapId'] as String?, style: options['style'] as String?, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart index 09f5bef55d6..0b1342f448d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/messages.g.dart @@ -488,8 +488,8 @@ class PlatformCameraUpdateZoomTo { class PlatformCircle { PlatformCircle({ this.consumeTapEvents = false, - required this.fillColor, - required this.strokeColor, + this.fillColor = 0x00000000, + this.strokeColor = 0xFF000000, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -500,9 +500,9 @@ class PlatformCircle { bool consumeTapEvents; - PlatformColor fillColor; + int fillColor; - PlatformColor strokeColor; + int strokeColor; bool visible; @@ -538,8 +538,8 @@ class PlatformCircle { result as List; return PlatformCircle( consumeTapEvents: result[0]! as bool, - fillColor: result[1]! as PlatformColor, - strokeColor: result[2]! as PlatformColor, + fillColor: result[1]! as int, + strokeColor: result[2]! as int, visible: result[3]! as bool, strokeWidth: result[4]! as int, zIndex: result[5]! as double, @@ -681,44 +681,6 @@ class PlatformDoublePair { int get hashCode => Object.hashAll(_toList()); } -/// Pigeon equivalent of the Color class. -/// -/// See https://developer.android.com/reference/android/graphics/Color.html. -class PlatformColor { - PlatformColor({required this.argbValue}); - - int argbValue; - - List _toList() { - return [argbValue]; - } - - Object encode() { - return _toList(); - } - - static PlatformColor decode(Object result) { - result as List; - return PlatformColor(argbValue: result[0]! as int); - } - - @override - // ignore: avoid_equals_and_hash_code_on_mutable_classes - bool operator ==(Object other) { - if (other is! PlatformColor || other.runtimeType != runtimeType) { - return false; - } - if (identical(this, other)) { - return true; - } - return _deepEquals(encode(), other.encode()); - } - - @override - // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); -} - /// Pigeon equivalent of the InfoWindow class. class PlatformInfoWindow { PlatformInfoWindow({this.title, this.snippet, required this.anchor}); @@ -884,7 +846,7 @@ class PlatformPolygon { bool consumesTapEvents; - PlatformColor fillColor; + int fillColor; bool geodesic; @@ -894,7 +856,7 @@ class PlatformPolygon { bool visible; - PlatformColor strokeColor; + int strokeColor; int strokeWidth; @@ -924,12 +886,12 @@ class PlatformPolygon { return PlatformPolygon( polygonId: result[0]! as String, consumesTapEvents: result[1]! as bool, - fillColor: result[2]! as PlatformColor, + fillColor: result[2]! as int, geodesic: result[3]! as bool, points: (result[4] as List?)!.cast(), holes: (result[5] as List?)!.cast>(), visible: result[6]! as bool, - strokeColor: result[7]! as PlatformColor, + strokeColor: result[7]! as int, strokeWidth: result[8]! as int, zIndex: result[9]! as int, ); @@ -973,7 +935,7 @@ class PlatformPolyline { bool consumesTapEvents; - PlatformColor color; + int color; bool geodesic; @@ -1023,7 +985,7 @@ class PlatformPolyline { return PlatformPolyline( polylineId: result[0]! as String, consumesTapEvents: result[1]! as bool, - color: result[2]! as PlatformColor, + color: result[2]! as int, geodesic: result[3]! as bool, jointType: result[4]! as PlatformJointType, patterns: (result[5] as List?)!.cast(), @@ -1687,7 +1649,7 @@ class PlatformMapConfiguration { this.trafficEnabled, this.buildingsEnabled, this.liteModeEnabled, - this.mapId, + this.cloudMapId, this.style, }); @@ -1727,7 +1689,7 @@ class PlatformMapConfiguration { bool? liteModeEnabled; - String? mapId; + String? cloudMapId; String? style; @@ -1751,7 +1713,7 @@ class PlatformMapConfiguration { trafficEnabled, buildingsEnabled, liteModeEnabled, - mapId, + cloudMapId, style, ]; } @@ -1781,7 +1743,7 @@ class PlatformMapConfiguration { trafficEnabled: result[15] as bool?, buildingsEnabled: result[16] as bool?, liteModeEnabled: result[17] as bool?, - mapId: result[18] as String?, + cloudMapId: result[18] as String?, style: result[19] as String?, ); } @@ -2333,86 +2295,83 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformDoublePair) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformColor) { - buffer.putUint8(149); - writeValue(buffer, value.encode()); } else if (value is PlatformInfoWindow) { - buffer.putUint8(150); + buffer.putUint8(149); writeValue(buffer, value.encode()); } else if (value is PlatformMarker) { - buffer.putUint8(151); + buffer.putUint8(150); writeValue(buffer, value.encode()); } else if (value is PlatformPolygon) { - buffer.putUint8(152); + buffer.putUint8(151); writeValue(buffer, value.encode()); } else if (value is PlatformPolyline) { - buffer.putUint8(153); + buffer.putUint8(152); writeValue(buffer, value.encode()); } else if (value is PlatformCap) { - buffer.putUint8(154); + buffer.putUint8(153); writeValue(buffer, value.encode()); } else if (value is PlatformPatternItem) { - buffer.putUint8(155); + buffer.putUint8(154); writeValue(buffer, value.encode()); } else if (value is PlatformTile) { - buffer.putUint8(156); + buffer.putUint8(155); writeValue(buffer, value.encode()); } else if (value is PlatformTileOverlay) { - buffer.putUint8(157); + buffer.putUint8(156); writeValue(buffer, value.encode()); } else if (value is PlatformEdgeInsets) { - buffer.putUint8(158); + buffer.putUint8(157); writeValue(buffer, value.encode()); } else if (value is PlatformLatLng) { - buffer.putUint8(159); + buffer.putUint8(158); writeValue(buffer, value.encode()); } else if (value is PlatformLatLngBounds) { - buffer.putUint8(160); + buffer.putUint8(159); writeValue(buffer, value.encode()); } else if (value is PlatformCluster) { - buffer.putUint8(161); + buffer.putUint8(160); writeValue(buffer, value.encode()); } else if (value is PlatformGroundOverlay) { - buffer.putUint8(162); + buffer.putUint8(161); writeValue(buffer, value.encode()); } else if (value is PlatformCameraTargetBounds) { - buffer.putUint8(163); + buffer.putUint8(162); writeValue(buffer, value.encode()); } else if (value is PlatformMapViewCreationParams) { - buffer.putUint8(164); + buffer.putUint8(163); writeValue(buffer, value.encode()); } else if (value is PlatformMapConfiguration) { - buffer.putUint8(165); + buffer.putUint8(164); writeValue(buffer, value.encode()); } else if (value is PlatformPoint) { - buffer.putUint8(166); + buffer.putUint8(165); writeValue(buffer, value.encode()); } else if (value is PlatformTileLayer) { - buffer.putUint8(167); + buffer.putUint8(166); writeValue(buffer, value.encode()); } else if (value is PlatformZoomRange) { - buffer.putUint8(168); + buffer.putUint8(167); writeValue(buffer, value.encode()); } else if (value is PlatformBitmap) { - buffer.putUint8(169); + buffer.putUint8(168); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapDefaultMarker) { - buffer.putUint8(170); + buffer.putUint8(169); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapBytes) { - buffer.putUint8(171); + buffer.putUint8(170); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapAsset) { - buffer.putUint8(172); + buffer.putUint8(171); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapAssetImage) { - buffer.putUint8(173); + buffer.putUint8(172); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapAssetMap) { - buffer.putUint8(174); + buffer.putUint8(173); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapBytesMap) { - buffer.putUint8(175); + buffer.putUint8(174); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -2469,58 +2428,56 @@ class _PigeonCodec extends StandardMessageCodec { case 148: return PlatformDoublePair.decode(readValue(buffer)!); case 149: - return PlatformColor.decode(readValue(buffer)!); - case 150: return PlatformInfoWindow.decode(readValue(buffer)!); - case 151: + case 150: return PlatformMarker.decode(readValue(buffer)!); - case 152: + case 151: return PlatformPolygon.decode(readValue(buffer)!); - case 153: + case 152: return PlatformPolyline.decode(readValue(buffer)!); - case 154: + case 153: return PlatformCap.decode(readValue(buffer)!); - case 155: + case 154: return PlatformPatternItem.decode(readValue(buffer)!); - case 156: + case 155: return PlatformTile.decode(readValue(buffer)!); - case 157: + case 156: return PlatformTileOverlay.decode(readValue(buffer)!); - case 158: + case 157: return PlatformEdgeInsets.decode(readValue(buffer)!); - case 159: + case 158: return PlatformLatLng.decode(readValue(buffer)!); - case 160: + case 159: return PlatformLatLngBounds.decode(readValue(buffer)!); - case 161: + case 160: return PlatformCluster.decode(readValue(buffer)!); - case 162: + case 161: return PlatformGroundOverlay.decode(readValue(buffer)!); - case 163: + case 162: return PlatformCameraTargetBounds.decode(readValue(buffer)!); - case 164: + case 163: return PlatformMapViewCreationParams.decode(readValue(buffer)!); - case 165: + case 164: return PlatformMapConfiguration.decode(readValue(buffer)!); - case 166: + case 165: return PlatformPoint.decode(readValue(buffer)!); - case 167: + case 166: return PlatformTileLayer.decode(readValue(buffer)!); - case 168: + case 167: return PlatformZoomRange.decode(readValue(buffer)!); - case 169: + case 168: return PlatformBitmap.decode(readValue(buffer)!); - case 170: + case 169: return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); - case 171: + case 170: return PlatformBitmapBytes.decode(readValue(buffer)!); - case 172: + case 171: return PlatformBitmapAsset.decode(readValue(buffer)!); - case 173: + case 172: return PlatformBitmapAssetImage.decode(readValue(buffer)!); - case 174: + case 173: return PlatformBitmapAssetMap.decode(readValue(buffer)!); - case 175: + case 174: return PlatformBitmapBytesMap.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); diff --git a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart index 4e744a9af53..7a9aca87b9a 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/lib/src/serialization.dart @@ -86,9 +86,7 @@ Object serializeHeatmapGradient(HeatmapGradient gradient) { _addIfNonNull( json, _heatmapGradientColorsKey, - gradient.colors - .map((HeatmapGradientColor e) => e.color.toARGB32()) - .toList(), + gradient.colors.map((HeatmapGradientColor e) => e.color.value).toList(), ); _addIfNonNull( json, diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart index 1a31450f188..bcb3e418c02 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/pigeons/messages.dart @@ -104,9 +104,9 @@ class PlatformCircle { PlatformCircle({ required this.circleId, required this.center, - required this.fillColor, - required this.strokeColor, this.consumeTapEvents = false, + this.fillColor = 0x00000000, + this.strokeColor = 0xFF000000, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -114,8 +114,8 @@ class PlatformCircle { }); final bool consumeTapEvents; - final PlatformColor fillColor; - final PlatformColor strokeColor; + final int fillColor; + final int strokeColor; final bool visible; final int strokeWidth; final double zIndex; @@ -151,15 +151,6 @@ class PlatformDoublePair { final double y; } -/// Pigeon equivalent of the Color class. -/// -/// See https://developer.android.com/reference/android/graphics/Color.html. -class PlatformColor { - const PlatformColor(this.argbValue); - - final int argbValue; -} - /// Pigeon equivalent of the InfoWindow class. class PlatformInfoWindow { PlatformInfoWindow({required this.anchor, this.title, this.snippet}); @@ -220,12 +211,12 @@ class PlatformPolygon { final String polygonId; final bool consumesTapEvents; - final PlatformColor fillColor; + final int fillColor; final bool geodesic; final List points; final List> holes; final bool visible; - final PlatformColor strokeColor; + final int strokeColor; final int strokeWidth; final int zIndex; } @@ -252,7 +243,7 @@ class PlatformPolyline { final String polylineId; final bool consumesTapEvents; - final PlatformColor color; + final int color; final bool geodesic; /// The joint type. @@ -462,7 +453,7 @@ class PlatformMapConfiguration { required this.trafficEnabled, required this.buildingsEnabled, required this.liteModeEnabled, - required this.mapId, + required this.cloudMapId, required this.style, }); @@ -484,7 +475,7 @@ class PlatformMapConfiguration { final bool? trafficEnabled; final bool? buildingsEnabled; final bool? liteModeEnabled; - final String? mapId; + final String? cloudMapId; final String? style; } diff --git a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml index af4932a0ad2..4c272074a70 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_android description: Android implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.18.6 +version: 2.18.5 environment: sdk: ^3.9.0 @@ -21,7 +21,7 @@ dependencies: flutter: sdk: flutter flutter_plugin_android_lifecycle: ^2.0.1 - google_maps_flutter_platform_interface: ^2.13.0 + google_maps_flutter_platform_interface: ^2.11.0 stream_transform: ^2.0.0 dev_dependencies: diff --git a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart index 55d1ba2eec1..3569b0098c3 100644 --- a/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_android/test/google_maps_flutter_android_test.dart @@ -457,11 +457,8 @@ void main() { expect(toChange.length, 1); final PlatformCircle firstChanged = toChange.first; expect(firstChanged.consumeTapEvents, object2new.consumeTapEvents); - expect(firstChanged.fillColor.argbValue, object2new.fillColor.toARGB32()); - expect( - firstChanged.strokeColor.argbValue, - object2new.strokeColor.toARGB32(), - ); + expect(firstChanged.fillColor, object2new.fillColor.value); + expect(firstChanged.strokeColor, object2new.strokeColor.value); expect(firstChanged.visible, object2new.visible); expect(firstChanged.strokeWidth, object2new.strokeWidth); expect(firstChanged.zIndex, object2new.zIndex.toDouble()); @@ -475,8 +472,8 @@ void main() { expect(toAdd.length, 1); final PlatformCircle firstAdded = toAdd.first; expect(firstAdded.consumeTapEvents, object3.consumeTapEvents); - expect(firstAdded.fillColor.argbValue, object3.fillColor.toARGB32()); - expect(firstAdded.strokeColor.argbValue, object3.strokeColor.toARGB32()); + expect(firstAdded.fillColor, object3.fillColor.value); + expect(firstAdded.strokeColor, object3.strokeColor.value); expect(firstAdded.visible, object3.visible); expect(firstAdded.strokeWidth, object3.strokeWidth); expect(firstAdded.zIndex, object3.zIndex.toDouble()); @@ -644,7 +641,7 @@ void main() { void expectPolygon(PlatformPolygon actual, Polygon expected) { expect(actual.polygonId, expected.polygonId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - expect(actual.fillColor.argbValue, expected.fillColor.toARGB32()); + expect(actual.fillColor, expected.fillColor.value); expect(actual.geodesic, expected.geodesic); expect(actual.points.length, expected.points.length); for (final (int i, PlatformLatLng? point) in actual.points.indexed) { @@ -660,7 +657,7 @@ void main() { } } expect(actual.visible, expected.visible); - expect(actual.strokeColor.argbValue, expected.strokeColor.toARGB32()); + expect(actual.strokeColor, expected.strokeColor.value); expect(actual.strokeWidth, expected.strokeWidth); expect(actual.zIndex, expected.zIndex); } @@ -714,7 +711,7 @@ void main() { void expectPolyline(PlatformPolyline actual, Polyline expected) { expect(actual.polylineId, expected.polylineId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - expect(actual.color.argbValue, expected.color.toARGB32()); + expect(actual.color, expected.color.value); expect(actual.geodesic, expected.geodesic); expect( actual.jointType, @@ -1500,9 +1497,9 @@ void main() { expect(widget, isA()); }); - testWidgets('mapId is passed', (WidgetTester tester) async { + testWidgets('cloudMapId is passed', (WidgetTester tester) async { const String cloudMapId = '000000000000000'; // Dummy map ID. - final Completer passedMapIdCompleter = Completer(); + final Completer passedCloudMapIdCompleter = Completer(); TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler(SystemChannels.platform_views, ( @@ -1520,9 +1517,9 @@ void main() { as PlatformMapViewCreationParams?; if (creationParams != null) { final String? passedMapId = - creationParams.mapConfiguration.mapId; + creationParams.mapConfiguration.cloudMapId; if (passedMapId != null) { - passedMapIdCompleter.complete(passedMapId); + passedCloudMapIdCompleter.complete(passedMapId); } } } @@ -1540,14 +1537,14 @@ void main() { initialCameraPosition: CameraPosition(target: LatLng(0, 0), zoom: 1), textDirection: TextDirection.ltr, ), - mapConfiguration: const MapConfiguration(mapId: cloudMapId), + mapConfiguration: const MapConfiguration(cloudMapId: cloudMapId), ), ); expect( - await passedMapIdCompleter.future, + await passedCloudMapIdCompleter.future, cloudMapId, - reason: 'Should pass mapId in PlatformView creation message', + reason: 'Should pass cloudMapId on PlatformView creation message', ); }); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md index b2b80b419e8..2cfb1ae67ba 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md @@ -1,7 +1,3 @@ -## 2.15.8 - -* Replaces internal use of deprecated methods. - ## 2.15.7 * Updates to Pigeon 26. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart index 46c0442b967..5eb14dbdd0e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/integration_test/google_maps_test.dart @@ -1397,7 +1397,7 @@ void main() { child: ExampleGoogleMap( key: key, initialCameraPosition: _kInitialCameraPosition, - mapId: _kCloudMapId, + cloudMapId: _kCloudMapId, ), ), ); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist index 1f6b98f117b..b3aaa733dfb 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Flutter/AppFrameworkInfo.plist @@ -25,6 +25,6 @@ arm64 MinimumOSVersion - 13.0 + 12.0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj index b394dabbb69..dd2afe77070 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ @@ -19,7 +19,7 @@ 478116522BEF8F47002F593E /* GoogleMapsPolylineControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 478116512BEF8F47002F593E /* GoogleMapsPolylineControllerTests.m */; }; 528F16832C62941000148160 /* FGMClusterManagersControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */; }; 528F16872C62952700148160 /* ExtractIconFromDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 528F16862C62952700148160 /* ExtractIconFromDataTests.m */; }; - 6851F3562835BC180032B7C8 /* FGMConversionsUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FGMConversionsUtilsTests.m */; }; + 6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -79,7 +79,7 @@ 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FGMClusterManagersControllerTests.m; sourceTree = ""; }; 528F16862C62952700148160 /* ExtractIconFromDataTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExtractIconFromDataTests.m; sourceTree = ""; }; 61A9A8623F5CA9BBC813DC6B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6851F3552835BC180032B7C8 /* FGMConversionsUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FGMConversionsUtilsTests.m; sourceTree = ""; }; + 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLTGoogleMapJSONConversionsConversionTests.m; sourceTree = ""; }; 733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -221,7 +221,7 @@ 528F16862C62952700148160 /* ExtractIconFromDataTests.m */, 528F16822C62941000148160 /* FGMClusterManagersControllerTests.m */, 339355BE2EB5359B00EBF864 /* FLTGoogleMapHeatmapControllerTests.m */, - 6851F3552835BC180032B7C8 /* FGMConversionsUtilsTests.m */, + 6851F3552835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m */, 0DD7B6C22B744EEF00E857FD /* FLTTileProviderControllerTests.m */, F7151F12265D7ED70028CB91 /* GoogleMapsTests.m */, 339355B92EB3E4F900EBF864 /* GoogleMapsCircleControllerTests.m */, @@ -520,7 +520,7 @@ 339355BF2EB535A600EBF864 /* FLTGoogleMapHeatmapControllerTests.m in Sources */, 339355BD2EB3E56300EBF864 /* GoogleMapsTileOverlayControllerTests.m in Sources */, F7151F13265D7ED70028CB91 /* GoogleMapsTests.m in Sources */, - 6851F3562835BC180032B7C8 /* FGMConversionsUtilsTests.m in Sources */, + 6851F3562835BC180032B7C8 /* FLTGoogleMapJSONConversionsConversionTests.m in Sources */, 982F2A6C27BADE17003C81F4 /* PartiallyMockedMapView.m in Sources */, 330909FF2D99B7A60077A751 /* GoogleMapsMarkerControllerTests.m in Sources */, 478116522BEF8F47002F593E /* GoogleMapsPolylineControllerTests.m in Sources */, diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 3ea203b77e3..cab978a8e3b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -44,7 +44,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> #import "PartiallyMockedMapView.h" -@interface FGMConversionUtilsTests : XCTestCase +@interface FLTGoogleMapJSONConversionsTests : XCTestCase @end -@implementation FGMConversionUtilsTests +@implementation FLTGoogleMapJSONConversionsTests - (void)testGetValueOrNilWithValue { NSString *key = @"key"; @@ -39,28 +39,28 @@ - (void)testGetValueOrNilWithNSNull { - (void)testLocationFromLatLong { NSArray *latlong = @[ @1, @2 ]; - CLLocationCoordinate2D location = [FGMHeatmapConversions locationFromLatLong:latlong]; + CLLocationCoordinate2D location = [FLTGoogleMapJSONConversions locationFromLatLong:latlong]; XCTAssertEqual(location.latitude, 1); XCTAssertEqual(location.longitude, 2); } - (void)testPointFromArray { NSArray *array = @[ @1, @2 ]; - CGPoint point = [FGMHeatmapConversions pointFromArray:array]; + CGPoint point = [FLTGoogleMapJSONConversions pointFromArray:array]; XCTAssertEqual(point.x, 1); XCTAssertEqual(point.y, 2); } - (void)testArrayFromLocation { CLLocationCoordinate2D location = CLLocationCoordinate2DMake(1, 2); - NSArray *array = [FGMHeatmapConversions arrayFromLocation:location]; + NSArray *array = [FLTGoogleMapJSONConversions arrayFromLocation:location]; XCTAssertEqual([array[0] integerValue], 1); XCTAssertEqual([array[1] integerValue], 2); } - (void)testColorFromRGBA { NSNumber *rgba = @(0x01020304); - UIColor *color = [FGMHeatmapConversions colorFromRGBA:rgba]; + UIColor *color = [FLTGoogleMapJSONConversions colorFromRGBA:rgba]; CGFloat red, green, blue, alpha; BOOL success = [color getRed:&red green:&green blue:&blue alpha:&alpha]; XCTAssertTrue(success); @@ -390,7 +390,7 @@ - (void)testWeightedLatLngFromArray { NSArray *weightedLatLng = @[ @[ @1, @2 ], @3 ]; GMUWeightedLatLng *weightedLocation = - [FGMHeatmapConversions weightedLatLngFromArray:weightedLatLng]; + [FLTGoogleMapJSONConversions weightedLatLngFromArray:weightedLatLng]; // The location gets projected to different values XCTAssertEqual([weightedLocation intensity], 3); @@ -399,7 +399,7 @@ - (void)testWeightedLatLngFromArray { - (void)testWeightedLatLngFromArrayThrowsForInvalidInput { NSArray *weightedLatLng = @[]; - XCTAssertThrows([FGMHeatmapConversions weightedLatLngFromArray:weightedLatLng]); + XCTAssertThrows([FLTGoogleMapJSONConversions weightedLatLngFromArray:weightedLatLng]); } - (void)testWeightedDataFromArray { @@ -407,7 +407,8 @@ - (void)testWeightedDataFromArray { NSNumber *intensity2 = @6; NSArray *data = @[ @[ @[ @1, @2 ], intensity1 ], @[ @[ @4, @5 ], intensity2 ] ]; - NSArray *weightedData = [FGMHeatmapConversions weightedDataFromArray:data]; + NSArray *weightedData = + [FLTGoogleMapJSONConversions weightedDataFromArray:data]; XCTAssertEqual([weightedData[0] intensity], [intensity1 floatValue]); XCTAssertEqual([weightedData[1] intensity], [intensity2 floatValue]); } @@ -424,7 +425,7 @@ - (void)testGradientFromDictionary { @"colorMapSize" : colorMapSize, }; - GMUGradient *gradient = [FGMHeatmapConversions gradientFromDictionary:gradientData]; + GMUGradient *gradient = [FLTGoogleMapJSONConversions gradientFromDictionary:gradientData]; CGFloat red, green, blue, alpha; [[gradient colors][0] getRed:&red green:&green blue:&blue alpha:&alpha]; XCTAssertEqual(red, 0); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m index b6da47435aa..44785692f28 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsCircleControllerTests.m @@ -26,14 +26,8 @@ - (void)testUpdateCircleSetsVisibilityLast { updateCircle:circle fromPlatformCircle:[FGMPlatformCircle makeWithConsumeTapEvents:NO - fillColor:[FGMPlatformColor makeWithRed:0 - green:0 - blue:0 - alpha:0] - strokeColor:[FGMPlatformColor makeWithRed:0 - green:0 - blue:0 - alpha:0] + fillColor:0 + strokeColor:0 visible:YES strokeWidth:0 zIndex:0 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m index 77c5a962967..778b1d44112 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolygonControllerTests.m @@ -22,23 +22,16 @@ - (void)testUpdatePolygonSetsVisibilityLast { PropertyOrderValidatingPolygon *polygon = [[PropertyOrderValidatingPolygon alloc] init]; [FLTGoogleMapPolygonController updatePolygon:polygon - fromPlatformPolygon:[FGMPlatformPolygon - makeWithConsumeTapEvents:NO - fillColor:[FGMPlatformColor makeWithRed:0 - green:0 - blue:0 - alpha:0] - geodesic:NO - holes:@[] - strokeColor:[FGMPlatformColor makeWithRed:0 - green:0 - blue:0 - alpha:0] - strokeWidth:0 - visible:YES - zIndex:0 - points:@[] - polygonId:@"polygon"] + fromPlatformPolygon:[FGMPlatformPolygon makeWithConsumeTapEvents:NO + fillColor:0 + geodesic:NO + holes:@[] + strokeColor:0 + strokeWidth:0 + visible:YES + zIndex:0 + points:@[] + polygonId:@"polygon"] withMapView:[GoogleMapsPolygonControllerTests mapView]]; XCTAssertTrue(polygon.hasSetMap); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m index 848c9c71f41..6dbe1b93a0e 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/GoogleMapsPolylineControllerTests.m @@ -27,17 +27,17 @@ @implementation GoogleMapsPolylineControllerTests /// /// @return An object of FLTGoogleMapPolylineController - (FLTGoogleMapPolylineController *)polylineControllerWithMockedMap { - FGMPlatformPolyline *polyline = [FGMPlatformPolyline - makeWithPolylineId:@"polyline_id_0" - consumesTapEvents:NO - color:[FGMPlatformColor makeWithRed:0 green:0 blue:0 alpha:0] - geodesic:NO - jointType:FGMPlatformJointTypeRound - patterns:@[] - points:[GoogleMapsPolylineControllerTests polylinePoints] - visible:NO - width:1 - zIndex:0]; + FGMPlatformPolyline *polyline = + [FGMPlatformPolyline makeWithPolylineId:@"polyline_id_0" + consumesTapEvents:NO + color:0 + geodesic:NO + jointType:FGMPlatformJointTypeRound + patterns:@[] + points:[GoogleMapsPolylineControllerTests polylinePoints] + visible:NO + width:1 + zIndex:0]; CGRect frame = CGRectMake(0, 0, 100, 100); GMSCameraPosition *camera = [[GMSCameraPosition alloc] initWithLatitude:0 longitude:0 zoom:0]; @@ -67,10 +67,7 @@ - (void)testPatternsSetSpans { updateFromPlatformPolyline:[FGMPlatformPolyline makeWithPolylineId:@"polyline_id_0" consumesTapEvents:NO - color:[FGMPlatformColor makeWithRed:0 - green:0 - blue:0 - alpha:0] + color:0 geodesic:NO jointType:FGMPlatformJointTypeRound patterns:@[ @@ -98,10 +95,7 @@ - (void)testUpdatePolylineSetsVisibilityLast { fromPlatformPolyline:[FGMPlatformPolyline makeWithPolylineId:@"polyline" consumesTapEvents:NO - color:[FGMPlatformColor makeWithRed:0 - green:0 - blue:0 - alpha:0] + color:0 geodesic:NO jointType:FGMPlatformJointTypeRound patterns:@[] diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml index 125a5a2ac4d..d4192ad9642 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../../ - google_maps_flutter_platform_interface: ^2.13.0 + google_maps_flutter_platform_interface: ^2.12.1 maps_example_dart: path: ../shared/maps_example_dart/ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml index 125a5a2ac4d..d4192ad9642 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../../ - google_maps_flutter_platform_interface: ^2.13.0 + google_maps_flutter_platform_interface: ^2.12.1 maps_example_dart: path: ../shared/maps_example_dart/ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart index 152f83c16f3..2fcd42602bf 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/example_google_map.dart @@ -314,7 +314,7 @@ class ExampleGoogleMap extends StatefulWidget { this.onCameraIdle, this.onTap, this.onLongPress, - this.mapId, + this.cloudMapId, this.style, }); @@ -422,7 +422,7 @@ class ExampleGoogleMap extends StatefulWidget { /// /// See https://developers.google.com/maps/documentation/get-map-id /// for more details. - final String? mapId; + final String? cloudMapId; /// The locally configured style for the map. final String? style; @@ -670,7 +670,7 @@ MapConfiguration _configurationFromMapWidget(ExampleGoogleMap map) { indoorViewEnabled: map.indoorViewEnabled, trafficEnabled: map.trafficEnabled, buildingsEnabled: map.buildingsEnabled, - mapId: map.mapId, + cloudMapId: map.cloudMapId, style: map.style, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart index cca097752fd..79e983d8a21 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/lib/map_map_id.dart @@ -54,7 +54,7 @@ class MapIdBodyState extends State { zoom: 7.0, ), key: _key, - mapId: _mapId, + cloudMapId: _mapId, ); final List columnChildren = [ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml index c29432c7f7a..a0c48d88f36 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../../../ - google_maps_flutter_platform_interface: ^2.13.0 + google_maps_flutter_platform_interface: ^2.12.1 dev_dependencies: flutter_test: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m index 04c3f04c928..76352bfb863 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMClusterManagersController.m @@ -4,8 +4,8 @@ #import "FGMClusterManagersController.h" -#import "FGMConversionUtils.h" #import "FGMMarkerUserData.h" +#import "FLTGoogleMapJSONConversions.h" @interface FGMClusterManagersController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m index 624f43032c5..2260dfb9e71 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMGroundOverlayController.m @@ -5,8 +5,8 @@ #import "FGMGroundOverlayController.h" #import "FGMGroundOverlayController_Test.h" -#import "FGMConversionUtils.h" #import "FGMImageUtils.h" +#import "FLTGoogleMapJSONConversions.h" @interface FGMGroundOverlayController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m index 808c5848768..aa51fb93c63 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m @@ -7,7 +7,7 @@ @import GoogleMapsUtils; -#import "FGMConversionUtils.h" +#import "FLTGoogleMapJSONConversions.h" @interface FLTGoogleMapHeatmapController () @@ -56,12 +56,13 @@ + (void)updateHeatmap:(GMUHeatmapTileLayer *)heatmapTileLayer // https://github.com/flutter/flutter/issues/117907 id weightedData = options[kHeatmapDataKey]; if ([weightedData isKindOfClass:[NSArray class]]) { - heatmapTileLayer.weightedData = [FGMHeatmapConversions weightedDataFromArray:weightedData]; + heatmapTileLayer.weightedData = + [FLTGoogleMapJSONConversions weightedDataFromArray:weightedData]; } id gradient = options[kHeatmapGradientKey]; if ([gradient isKindOfClass:[NSDictionary class]]) { - heatmapTileLayer.gradient = [FGMHeatmapConversions gradientFromDictionary:gradient]; + heatmapTileLayer.gradient = [FLTGoogleMapJSONConversions gradientFromDictionary:gradient]; } id opacity = options[kHeatmapOpacityKey]; @@ -152,9 +153,9 @@ - (BOOL)hasHeatmapWithIdentifier:(NSString *)identifier { FLTGoogleMapHeatmapController *heatmapController = self.heatmapIdToController[identifier]; if (heatmapController) { return @{ - kHeatmapDataKey : [FGMHeatmapConversions + kHeatmapDataKey : [FLTGoogleMapJSONConversions arrayFromWeightedData:heatmapController.heatmapTileLayer.weightedData], - kHeatmapGradientKey : [FGMHeatmapConversions + kHeatmapGradientKey : [FLTGoogleMapJSONConversions dictionaryFromGradient:heatmapController.heatmapTileLayer.gradient], kHeatmapOpacityKey : @(heatmapController.heatmapTileLayer.opacity), kHeatmapRadiusKey : @(heatmapController.heatmapTileLayer.radius), diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.h similarity index 94% rename from packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h rename to packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.h index 2cc43fc538f..61241fb6246 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.h @@ -69,7 +69,7 @@ extern GMSCameraUpdate *_Nullable FGMGetCameraUpdateForPigeonCameraUpdate( FGMPlatformCameraUpdate *update); /// Creates a UIColor from its RGBA components, expressed as an integer. -extern UIColor *FGMGetColorForPigeonColor(FGMPlatformColor *color); +extern UIColor *FGMGetColorForRGBA(NSInteger rgba); /// Creates an array of GMSStrokeStyles using the given patterns and stroke color. extern NSArray *FGMGetStrokeStylesFromPatterns( @@ -79,10 +79,7 @@ extern NSArray *FGMGetStrokeStylesFromPatterns( extern NSArray *FGMGetSpanLengthsFromPatterns( NSArray *patterns); -/// Legacy conversion utils for heatmaps, which are still using a JSON -/// representation instead of structured Pigeon data. -// TODO(stuartmorgan): Remove this once heatmaps are migrated to Pigeon. -@interface FGMHeatmapConversions : NSObject +@interface FLTGoogleMapJSONConversions : NSObject extern NSString *const kHeatmapsToAddKey; extern NSString *const kHeatmapIdKey; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.m similarity index 95% rename from packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m rename to packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.m index bce17ba10af..479be710176 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapJSONConversions.m @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#import "FGMConversionUtils.h" - +#import "FLTGoogleMapJSONConversions.h" #import "FGMMarkerUserData.h" /// Returns dict[key], or nil if dict[key] is NSNull. @@ -213,8 +212,11 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { return nil; } -UIColor *FGMGetColorForPigeonColor(FGMPlatformColor *color) { - return [UIColor colorWithRed:color.red green:color.green blue:color.blue alpha:color.alpha]; +UIColor *FGMGetColorForRGBA(NSInteger rgba) { + return [UIColor colorWithRed:((CGFloat)((rgba & 0xFF0000) >> 16)) / 255.0 + green:((CGFloat)((rgba & 0xFF00) >> 8)) / 255.0 + blue:((CGFloat)(rgba & 0xFF)) / 255.0 + alpha:((CGFloat)((rgba & 0xFF000000) >> 24)) / 255.0]; } NSArray *FGMGetStrokeStylesFromPatterns( @@ -237,7 +239,7 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { return lengths; } -@implementation FGMHeatmapConversions +@implementation FLTGoogleMapJSONConversions // These constants must match the corresponding constants in serialization.dart NSString *const kHeatmapsToAddKey = @"heatmapsToAdd"; @@ -265,11 +267,7 @@ + (NSArray *)arrayFromLocation:(CLLocationCoordinate2D)location { } + (UIColor *)colorFromRGBA:(NSNumber *)numberColor { - NSInteger rgba = numberColor.unsignedLongValue; - return [UIColor colorWithRed:((CGFloat)((rgba & 0xFF0000) >> 16)) / 255.0 - green:((CGFloat)((rgba & 0xFF00) >> 8)) / 255.0 - blue:((CGFloat)(rgba & 0xFF)) / 255.0 - alpha:((CGFloat)((rgba & 0xFF000000) >> 24)) / 255.0]; + return FGMGetColorForRGBA(numberColor.unsignedLongValue); } + (NSNumber *)RGBAFromColor:(UIColor *)color { @@ -286,14 +284,14 @@ + (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { return nil; } return [[GMUWeightedLatLng alloc] - initWithCoordinate:[FGMHeatmapConversions locationFromLatLong:data[0]] + initWithCoordinate:[FLTGoogleMapJSONConversions locationFromLatLong:data[0]] intensity:[data[1] doubleValue]]; } + (NSArray *)arrayFromWeightedLatLng:(GMUWeightedLatLng *)weightedLatLng { GMSMapPoint point = {weightedLatLng.point.x, weightedLatLng.point.y}; return @[ - [FGMHeatmapConversions arrayFromLocation:GMSUnproject(point)], @(weightedLatLng.intensity) + [FLTGoogleMapJSONConversions arrayFromLocation:GMSUnproject(point)], @(weightedLatLng.intensity) ]; } @@ -301,7 +299,7 @@ + (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { NSMutableArray *weightedData = [[NSMutableArray alloc] initWithCapacity:data.count]; for (NSArray *item in data) { - GMUWeightedLatLng *weightedLatLng = [FGMHeatmapConversions weightedLatLngFromArray:item]; + GMUWeightedLatLng *weightedLatLng = [FLTGoogleMapJSONConversions weightedLatLngFromArray:item]; if (weightedLatLng == nil) continue; [weightedData addObject:weightedLatLng]; } @@ -312,7 +310,7 @@ + (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { + (NSArray *> *)arrayFromWeightedData:(NSArray *)weightedData { NSMutableArray *data = [[NSMutableArray alloc] initWithCapacity:weightedData.count]; for (GMUWeightedLatLng *weightedLatLng in weightedData) { - [data addObject:[FGMHeatmapConversions arrayFromWeightedLatLng:weightedLatLng]]; + [data addObject:[FLTGoogleMapJSONConversions arrayFromWeightedLatLng:weightedLatLng]]; } return data; @@ -322,7 +320,7 @@ + (GMUGradient *)gradientFromDictionary:(NSDictionary *)data { NSArray *colorData = data[kHeatmapGradientColorsKey]; NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:colorData.count]; for (NSNumber *colorCode in colorData) { - [colors addObject:[FGMHeatmapConversions colorFromRGBA:colorCode]]; + [colors addObject:[FLTGoogleMapJSONConversions colorFromRGBA:colorCode]]; } return [[GMUGradient alloc] initWithColors:colors @@ -334,7 +332,7 @@ + (GMUGradient *)gradientFromDictionary:(NSDictionary *)data { NSMutableArray *colorCodes = [[NSMutableArray alloc] initWithCapacity:gradient.colors.count]; for (UIColor *color in gradient.colors) { - [colorCodes addObject:[FGMHeatmapConversions RGBAFromColor:color]]; + [colorCodes addObject:[FLTGoogleMapJSONConversions RGBAFromColor:color]]; } return @{ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m index c4cce14ed24..8132ffbdf28 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapTileOverlayController.m @@ -5,7 +5,7 @@ #import "FLTGoogleMapTileOverlayController.h" #import "FLTGoogleMapTileOverlayController_Test.h" -#import "FGMConversionUtils.h" +#import "FLTGoogleMapJSONConversions.h" @interface FLTGoogleMapTileOverlayController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m index d2d0130dc64..81c5549bd32 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapCircleController.m @@ -5,7 +5,7 @@ #import "GoogleMapCircleController.h" #import "GoogleMapCircleController_Test.h" -#import "FGMConversionUtils.h" +#import "FLTGoogleMapJSONConversions.h" @interface FLTGoogleMapCircleController () @@ -48,9 +48,9 @@ + (void)updateCircle:(GMSCircle *)circle circle.zIndex = platformCircle.zIndex; circle.position = FGMGetCoordinateForPigeonLatLng(platformCircle.center); circle.radius = platformCircle.radius; - circle.strokeColor = FGMGetColorForPigeonColor(platformCircle.strokeColor); + circle.strokeColor = FGMGetColorForRGBA(platformCircle.strokeColor); circle.strokeWidth = platformCircle.strokeWidth; - circle.fillColor = FGMGetColorForPigeonColor(platformCircle.fillColor); + circle.fillColor = FGMGetColorForRGBA(platformCircle.fillColor); // This must be done last, to avoid visual flickers of default property values. circle.map = platformCircle.visible ? mapView : nil; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m index dc8d6fa6db2..2d62fe9dad6 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m @@ -7,10 +7,10 @@ #import "GoogleMapController.h" #import "GoogleMapController_Test.h" -#import "FGMConversionUtils.h" #import "FGMGroundOverlayController.h" #import "FGMMarkerUserData.h" #import "FLTGoogleMapHeatmapController.h" +#import "FLTGoogleMapJSONConversions.h" #import "FLTGoogleMapTileOverlayController.h" #import "messages.g.h" @@ -135,7 +135,7 @@ - (instancetype)initWithFrame:(CGRect)frame GMSMapViewOptions *options = [[GMSMapViewOptions alloc] init]; options.frame = frame; options.camera = camera; - NSString *cloudMapId = creationParameters.mapConfiguration.mapId; + NSString *cloudMapId = creationParameters.mapConfiguration.cloudMapId; if (cloudMapId) { options.mapID = [GMSMapID mapIDWithIdentifier:cloudMapId]; } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m index ed3aabd7fc1..de9e0f99ac4 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapMarkerController.m @@ -5,9 +5,9 @@ #import "GoogleMapMarkerController.h" #import "GoogleMapMarkerController_Test.h" -#import "FGMConversionUtils.h" #import "FGMImageUtils.h" #import "FGMMarkerUserData.h" +#import "FLTGoogleMapJSONConversions.h" @interface FLTGoogleMapMarkerController () diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m index 12cbfeefecd..aedbf1b90db 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolygonController.m @@ -5,7 +5,7 @@ #import "GoogleMapPolygonController.h" #import "GoogleMapPolygonController_Test.h" -#import "FGMConversionUtils.h" +#import "FLTGoogleMapJSONConversions.h" /// Converts a list of holes represented as CLLocation lists to GMSMutablePath lists. static NSArray *FMGPathHolesFromLocationHoles( @@ -57,8 +57,8 @@ + (void)updatePolygon:(GMSPolygon *)polygon polygon.path = FGMGetPathFromPoints(FGMGetPointsForPigeonLatLngs(platformPolygon.points)); polygon.holes = FMGPathHolesFromLocationHoles(FGMGetHolesForPigeonLatLngArrays(platformPolygon.holes)); - polygon.fillColor = FGMGetColorForPigeonColor(platformPolygon.fillColor); - polygon.strokeColor = FGMGetColorForPigeonColor(platformPolygon.strokeColor); + polygon.fillColor = FGMGetColorForRGBA(platformPolygon.fillColor); + polygon.strokeColor = FGMGetColorForRGBA(platformPolygon.strokeColor); polygon.strokeWidth = platformPolygon.strokeWidth; // This must be done last, to avoid visual flickers of default property values. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m index 63a7f7b7b0f..cf527779058 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapPolylineController.m @@ -5,7 +5,7 @@ #import "GoogleMapPolylineController.h" #import "GoogleMapPolylineController_Test.h" -#import "FGMConversionUtils.h" +#import "FLTGoogleMapJSONConversions.h" @interface FLTGoogleMapPolylineController () @@ -46,7 +46,7 @@ + (void)updatePolyline:(GMSPolyline *)polyline GMSMutablePath *path = FGMGetPathFromPoints(FGMGetPointsForPigeonLatLngs(platformPolyline.points)); polyline.path = path; - UIColor *strokeColor = FGMGetColorForPigeonColor(platformPolyline.color); + UIColor *strokeColor = FGMGetColorForRGBA(platformPolyline.color); polyline.strokeColor = strokeColor; polyline.strokeWidth = platformPolyline.width; polyline.geodesic = platformPolyline.geodesic; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h index e35e8c3aa70..29ef04589aa 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/google_maps_flutter_ios-umbrella.h @@ -3,12 +3,12 @@ // found in the LICENSE file. #import -#import #import #import #import #import #import +#import #import #import #import diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h index fc8146dd0b4..a814fb02f24 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h @@ -96,7 +96,6 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @class FGMPlatformMapConfiguration; @class FGMPlatformPoint; @class FGMPlatformSize; -@class FGMPlatformColor; @class FGMPlatformTileLayer; @class FGMPlatformZoomRange; @class FGMPlatformBitmap; @@ -206,8 +205,8 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithConsumeTapEvents:(BOOL)consumeTapEvents - fillColor:(FGMPlatformColor *)fillColor - strokeColor:(FGMPlatformColor *)strokeColor + fillColor:(NSInteger)fillColor + strokeColor:(NSInteger)strokeColor visible:(BOOL)visible strokeWidth:(NSInteger)strokeWidth zIndex:(double)zIndex @@ -215,8 +214,8 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { radius:(double)radius circleId:(NSString *)circleId; @property(nonatomic, assign) BOOL consumeTapEvents; -@property(nonatomic, strong) FGMPlatformColor *fillColor; -@property(nonatomic, strong) FGMPlatformColor *strokeColor; +@property(nonatomic, assign) NSInteger fillColor; +@property(nonatomic, assign) NSInteger strokeColor; @property(nonatomic, assign) BOOL visible; @property(nonatomic, assign) NSInteger strokeWidth; @property(nonatomic, assign) double zIndex; @@ -308,22 +307,22 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPolygonId:(NSString *)polygonId consumesTapEvents:(BOOL)consumesTapEvents - fillColor:(FGMPlatformColor *)fillColor + fillColor:(NSInteger)fillColor geodesic:(BOOL)geodesic points:(NSArray *)points holes:(NSArray *> *)holes visible:(BOOL)visible - strokeColor:(FGMPlatformColor *)strokeColor + strokeColor:(NSInteger)strokeColor strokeWidth:(NSInteger)strokeWidth zIndex:(NSInteger)zIndex; @property(nonatomic, copy) NSString *polygonId; @property(nonatomic, assign) BOOL consumesTapEvents; -@property(nonatomic, strong) FGMPlatformColor *fillColor; +@property(nonatomic, assign) NSInteger fillColor; @property(nonatomic, assign) BOOL geodesic; @property(nonatomic, copy) NSArray *points; @property(nonatomic, copy) NSArray *> *holes; @property(nonatomic, assign) BOOL visible; -@property(nonatomic, strong) FGMPlatformColor *strokeColor; +@property(nonatomic, assign) NSInteger strokeColor; @property(nonatomic, assign) NSInteger strokeWidth; @property(nonatomic, assign) NSInteger zIndex; @end @@ -334,7 +333,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { - (instancetype)init NS_UNAVAILABLE; + (instancetype)makeWithPolylineId:(NSString *)polylineId consumesTapEvents:(BOOL)consumesTapEvents - color:(FGMPlatformColor *)color + color:(NSInteger)color geodesic:(BOOL)geodesic jointType:(FGMPlatformJointType)jointType patterns:(NSArray *)patterns @@ -344,7 +343,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { zIndex:(NSInteger)zIndex; @property(nonatomic, copy) NSString *polylineId; @property(nonatomic, assign) BOOL consumesTapEvents; -@property(nonatomic, strong) FGMPlatformColor *color; +@property(nonatomic, assign) NSInteger color; @property(nonatomic, assign) BOOL geodesic; /// The joint type. @property(nonatomic, assign) FGMPlatformJointType jointType; @@ -506,7 +505,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { indoorViewEnabled:(nullable NSNumber *)indoorViewEnabled trafficEnabled:(nullable NSNumber *)trafficEnabled buildingsEnabled:(nullable NSNumber *)buildingsEnabled - mapId:(nullable NSString *)mapId + cloudMapId:(nullable NSString *)cloudMapId style:(nullable NSString *)style; @property(nonatomic, strong, nullable) NSNumber *compassEnabled; @property(nonatomic, strong, nullable) FGMPlatformCameraTargetBounds *cameraTargetBounds; @@ -523,7 +522,7 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @property(nonatomic, strong, nullable) NSNumber *indoorViewEnabled; @property(nonatomic, strong, nullable) NSNumber *trafficEnabled; @property(nonatomic, strong, nullable) NSNumber *buildingsEnabled; -@property(nonatomic, copy, nullable) NSString *mapId; +@property(nonatomic, copy, nullable) NSString *cloudMapId; @property(nonatomic, copy, nullable) NSString *style; @end @@ -545,17 +544,6 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @property(nonatomic, assign) double height; @end -/// Pigeon representation of a color. -@interface FGMPlatformColor : NSObject -/// `init` unavailable to enforce nonnull fields, see the `make` class method. -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha; -@property(nonatomic, assign) double red; -@property(nonatomic, assign) double green; -@property(nonatomic, assign) double blue; -@property(nonatomic, assign) double alpha; -@end - /// Pigeon equivalent of GMSTileLayer properties. @interface FGMPlatformTileLayer : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m index 86a485af865..dc44ed382b5 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m @@ -263,12 +263,6 @@ + (nullable FGMPlatformSize *)nullableFromList:(NSArray *)list; - (NSArray *)toList; @end -@interface FGMPlatformColor () -+ (FGMPlatformColor *)fromList:(NSArray *)list; -+ (nullable FGMPlatformColor *)nullableFromList:(NSArray *)list; -- (NSArray *)toList; -@end - @interface FGMPlatformTileLayer () + (FGMPlatformTileLayer *)fromList:(NSArray *)list; + (nullable FGMPlatformTileLayer *)nullableFromList:(NSArray *)list; @@ -565,8 +559,8 @@ + (nullable FGMPlatformCameraUpdateZoomTo *)nullableFromList:(NSArray *)list @implementation FGMPlatformCircle + (instancetype)makeWithConsumeTapEvents:(BOOL)consumeTapEvents - fillColor:(FGMPlatformColor *)fillColor - strokeColor:(FGMPlatformColor *)strokeColor + fillColor:(NSInteger)fillColor + strokeColor:(NSInteger)strokeColor visible:(BOOL)visible strokeWidth:(NSInteger)strokeWidth zIndex:(double)zIndex @@ -588,8 +582,8 @@ + (instancetype)makeWithConsumeTapEvents:(BOOL)consumeTapEvents + (FGMPlatformCircle *)fromList:(NSArray *)list { FGMPlatformCircle *pigeonResult = [[FGMPlatformCircle alloc] init]; pigeonResult.consumeTapEvents = [GetNullableObjectAtIndex(list, 0) boolValue]; - pigeonResult.fillColor = GetNullableObjectAtIndex(list, 1); - pigeonResult.strokeColor = GetNullableObjectAtIndex(list, 2); + pigeonResult.fillColor = [GetNullableObjectAtIndex(list, 1) integerValue]; + pigeonResult.strokeColor = [GetNullableObjectAtIndex(list, 2) integerValue]; pigeonResult.visible = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.strokeWidth = [GetNullableObjectAtIndex(list, 4) integerValue]; pigeonResult.zIndex = [GetNullableObjectAtIndex(list, 5) doubleValue]; @@ -604,8 +598,8 @@ + (nullable FGMPlatformCircle *)nullableFromList:(NSArray *)list { - (NSArray *)toList { return @[ @(self.consumeTapEvents), - self.fillColor ?: [NSNull null], - self.strokeColor ?: [NSNull null], + @(self.fillColor), + @(self.strokeColor), @(self.visible), @(self.strokeWidth), @(self.zIndex), @@ -792,12 +786,12 @@ + (nullable FGMPlatformMarker *)nullableFromList:(NSArray *)list { @implementation FGMPlatformPolygon + (instancetype)makeWithPolygonId:(NSString *)polygonId consumesTapEvents:(BOOL)consumesTapEvents - fillColor:(FGMPlatformColor *)fillColor + fillColor:(NSInteger)fillColor geodesic:(BOOL)geodesic points:(NSArray *)points holes:(NSArray *> *)holes visible:(BOOL)visible - strokeColor:(FGMPlatformColor *)strokeColor + strokeColor:(NSInteger)strokeColor strokeWidth:(NSInteger)strokeWidth zIndex:(NSInteger)zIndex { FGMPlatformPolygon *pigeonResult = [[FGMPlatformPolygon alloc] init]; @@ -817,12 +811,12 @@ + (FGMPlatformPolygon *)fromList:(NSArray *)list { FGMPlatformPolygon *pigeonResult = [[FGMPlatformPolygon alloc] init]; pigeonResult.polygonId = GetNullableObjectAtIndex(list, 0); pigeonResult.consumesTapEvents = [GetNullableObjectAtIndex(list, 1) boolValue]; - pigeonResult.fillColor = GetNullableObjectAtIndex(list, 2); + pigeonResult.fillColor = [GetNullableObjectAtIndex(list, 2) integerValue]; pigeonResult.geodesic = [GetNullableObjectAtIndex(list, 3) boolValue]; pigeonResult.points = GetNullableObjectAtIndex(list, 4); pigeonResult.holes = GetNullableObjectAtIndex(list, 5); pigeonResult.visible = [GetNullableObjectAtIndex(list, 6) boolValue]; - pigeonResult.strokeColor = GetNullableObjectAtIndex(list, 7); + pigeonResult.strokeColor = [GetNullableObjectAtIndex(list, 7) integerValue]; pigeonResult.strokeWidth = [GetNullableObjectAtIndex(list, 8) integerValue]; pigeonResult.zIndex = [GetNullableObjectAtIndex(list, 9) integerValue]; return pigeonResult; @@ -834,12 +828,12 @@ + (nullable FGMPlatformPolygon *)nullableFromList:(NSArray *)list { return @[ self.polygonId ?: [NSNull null], @(self.consumesTapEvents), - self.fillColor ?: [NSNull null], + @(self.fillColor), @(self.geodesic), self.points ?: [NSNull null], self.holes ?: [NSNull null], @(self.visible), - self.strokeColor ?: [NSNull null], + @(self.strokeColor), @(self.strokeWidth), @(self.zIndex), ]; @@ -849,7 +843,7 @@ + (nullable FGMPlatformPolygon *)nullableFromList:(NSArray *)list { @implementation FGMPlatformPolyline + (instancetype)makeWithPolylineId:(NSString *)polylineId consumesTapEvents:(BOOL)consumesTapEvents - color:(FGMPlatformColor *)color + color:(NSInteger)color geodesic:(BOOL)geodesic jointType:(FGMPlatformJointType)jointType patterns:(NSArray *)patterns @@ -874,7 +868,7 @@ + (FGMPlatformPolyline *)fromList:(NSArray *)list { FGMPlatformPolyline *pigeonResult = [[FGMPlatformPolyline alloc] init]; pigeonResult.polylineId = GetNullableObjectAtIndex(list, 0); pigeonResult.consumesTapEvents = [GetNullableObjectAtIndex(list, 1) boolValue]; - pigeonResult.color = GetNullableObjectAtIndex(list, 2); + pigeonResult.color = [GetNullableObjectAtIndex(list, 2) integerValue]; pigeonResult.geodesic = [GetNullableObjectAtIndex(list, 3) boolValue]; FGMPlatformJointTypeBox *boxedFGMPlatformJointType = GetNullableObjectAtIndex(list, 4); pigeonResult.jointType = boxedFGMPlatformJointType.value; @@ -892,7 +886,7 @@ + (nullable FGMPlatformPolyline *)nullableFromList:(NSArray *)list { return @[ self.polylineId ?: [NSNull null], @(self.consumesTapEvents), - self.color ?: [NSNull null], + @(self.color), @(self.geodesic), [[FGMPlatformJointTypeBox alloc] initWithValue:self.jointType], self.patterns ?: [NSNull null], @@ -1238,7 +1232,7 @@ + (instancetype)makeWithCompassEnabled:(nullable NSNumber *)compassEnabled indoorViewEnabled:(nullable NSNumber *)indoorViewEnabled trafficEnabled:(nullable NSNumber *)trafficEnabled buildingsEnabled:(nullable NSNumber *)buildingsEnabled - mapId:(nullable NSString *)mapId + cloudMapId:(nullable NSString *)cloudMapId style:(nullable NSString *)style { FGMPlatformMapConfiguration *pigeonResult = [[FGMPlatformMapConfiguration alloc] init]; pigeonResult.compassEnabled = compassEnabled; @@ -1256,7 +1250,7 @@ + (instancetype)makeWithCompassEnabled:(nullable NSNumber *)compassEnabled pigeonResult.indoorViewEnabled = indoorViewEnabled; pigeonResult.trafficEnabled = trafficEnabled; pigeonResult.buildingsEnabled = buildingsEnabled; - pigeonResult.mapId = mapId; + pigeonResult.cloudMapId = cloudMapId; pigeonResult.style = style; return pigeonResult; } @@ -1277,7 +1271,7 @@ + (FGMPlatformMapConfiguration *)fromList:(NSArray *)list { pigeonResult.indoorViewEnabled = GetNullableObjectAtIndex(list, 12); pigeonResult.trafficEnabled = GetNullableObjectAtIndex(list, 13); pigeonResult.buildingsEnabled = GetNullableObjectAtIndex(list, 14); - pigeonResult.mapId = GetNullableObjectAtIndex(list, 15); + pigeonResult.cloudMapId = GetNullableObjectAtIndex(list, 15); pigeonResult.style = GetNullableObjectAtIndex(list, 16); return pigeonResult; } @@ -1301,7 +1295,7 @@ + (nullable FGMPlatformMapConfiguration *)nullableFromList:(NSArray *)list { self.indoorViewEnabled ?: [NSNull null], self.trafficEnabled ?: [NSNull null], self.buildingsEnabled ?: [NSNull null], - self.mapId ?: [NSNull null], + self.cloudMapId ?: [NSNull null], self.style ?: [NSNull null], ]; } @@ -1355,36 +1349,6 @@ + (nullable FGMPlatformSize *)nullableFromList:(NSArray *)list { } @end -@implementation FGMPlatformColor -+ (instancetype)makeWithRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha { - FGMPlatformColor *pigeonResult = [[FGMPlatformColor alloc] init]; - pigeonResult.red = red; - pigeonResult.green = green; - pigeonResult.blue = blue; - pigeonResult.alpha = alpha; - return pigeonResult; -} -+ (FGMPlatformColor *)fromList:(NSArray *)list { - FGMPlatformColor *pigeonResult = [[FGMPlatformColor alloc] init]; - pigeonResult.red = [GetNullableObjectAtIndex(list, 0) doubleValue]; - pigeonResult.green = [GetNullableObjectAtIndex(list, 1) doubleValue]; - pigeonResult.blue = [GetNullableObjectAtIndex(list, 2) doubleValue]; - pigeonResult.alpha = [GetNullableObjectAtIndex(list, 3) doubleValue]; - return pigeonResult; -} -+ (nullable FGMPlatformColor *)nullableFromList:(NSArray *)list { - return (list) ? [FGMPlatformColor fromList:list] : nil; -} -- (NSArray *)toList { - return @[ - @(self.red), - @(self.green), - @(self.blue), - @(self.alpha), - ]; -} -@end - @implementation FGMPlatformTileLayer + (instancetype)makeWithVisible:(BOOL)visible fadeIn:(BOOL)fadeIn @@ -1730,24 +1694,22 @@ - (nullable id)readValueOfType:(UInt8)type { case 162: return [FGMPlatformSize fromList:[self readValue]]; case 163: - return [FGMPlatformColor fromList:[self readValue]]; - case 164: return [FGMPlatformTileLayer fromList:[self readValue]]; - case 165: + case 164: return [FGMPlatformZoomRange fromList:[self readValue]]; - case 166: + case 165: return [FGMPlatformBitmap fromList:[self readValue]]; - case 167: + case 166: return [FGMPlatformBitmapDefaultMarker fromList:[self readValue]]; - case 168: + case 167: return [FGMPlatformBitmapBytes fromList:[self readValue]]; - case 169: + case 168: return [FGMPlatformBitmapAsset fromList:[self readValue]]; - case 170: + case 169: return [FGMPlatformBitmapAssetImage fromList:[self readValue]]; - case 171: + case 170: return [FGMPlatformBitmapAssetMap fromList:[self readValue]]; - case 172: + case 171: return [FGMPlatformBitmapBytesMap fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1865,35 +1827,32 @@ - (void)writeValue:(id)value { } else if ([value isKindOfClass:[FGMPlatformSize class]]) { [self writeByte:162]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformColor class]]) { - [self writeByte:163]; - [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) { - [self writeByte:164]; + [self writeByte:163]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) { - [self writeByte:165]; + [self writeByte:164]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmap class]]) { - [self writeByte:166]; + [self writeByte:165]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmapDefaultMarker class]]) { - [self writeByte:167]; + [self writeByte:166]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmapBytes class]]) { - [self writeByte:168]; + [self writeByte:167]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmapAsset class]]) { - [self writeByte:169]; + [self writeByte:168]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmapAssetImage class]]) { - [self writeByte:170]; + [self writeByte:169]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmapAssetMap class]]) { - [self writeByte:171]; + [self writeByte:170]; [self writeValue:[value toList]]; } else if ([value isKindOfClass:[FGMPlatformBitmapBytesMap class]]) { - [self writeByte:172]; + [self writeByte:171]; [self writeValue:[value toList]]; } else { [super writeValue:value]; diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart index 51a7d1afd47..1794c914855 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart @@ -15,6 +15,9 @@ import 'google_map_inspector_ios.dart'; import 'messages.g.dart'; import 'serialization.dart'; +// TODO(stuartmorgan): Remove the dependency on platform interface toJson +// methods. Channel serialization details should all be package-internal. + /// The non-test implementation of `_apiProvider`. MapsApi _productionApiProvider(int mapId) { return MapsApi(messageChannelSuffix: mapId.toString()); @@ -655,18 +658,8 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { static PlatformCircle _platformCircleFromCircle(Circle circle) { return PlatformCircle( consumeTapEvents: circle.consumeTapEvents, - fillColor: PlatformColor( - red: circle.fillColor.r, - green: circle.fillColor.g, - blue: circle.fillColor.b, - alpha: circle.fillColor.a, - ), - strokeColor: PlatformColor( - red: circle.strokeColor.r, - green: circle.strokeColor.g, - blue: circle.strokeColor.b, - alpha: circle.strokeColor.a, - ), + fillColor: circle.fillColor.value, + strokeColor: circle.strokeColor.value, visible: circle.visible, strokeWidth: circle.strokeWidth, zIndex: circle.zIndex.toDouble(), @@ -741,22 +734,12 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { }).toList(); return PlatformPolygon( polygonId: polygon.polygonId.value, - fillColor: PlatformColor( - red: polygon.fillColor.r, - green: polygon.fillColor.g, - blue: polygon.fillColor.b, - alpha: polygon.fillColor.a, - ), + fillColor: polygon.fillColor.value, geodesic: polygon.geodesic, consumesTapEvents: polygon.consumeTapEvents, points: points, holes: holes, - strokeColor: PlatformColor( - red: polygon.strokeColor.r, - green: polygon.strokeColor.g, - blue: polygon.strokeColor.b, - alpha: polygon.strokeColor.a, - ), + strokeColor: polygon.strokeColor.value, strokeWidth: polygon.strokeWidth, zIndex: polygon.zIndex, visible: polygon.visible, @@ -773,12 +756,7 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { return PlatformPolyline( polylineId: polyline.polylineId.value, consumesTapEvents: polyline.consumeTapEvents, - color: PlatformColor( - red: polyline.color.r, - green: polyline.color.g, - blue: polyline.color.b, - alpha: polyline.color.a, - ), + color: polyline.color.value, geodesic: polyline.geodesic, visible: polyline.visible, width: polyline.width, @@ -1242,7 +1220,7 @@ PlatformMapConfiguration _platformMapConfigurationFromMapConfiguration( indoorViewEnabled: config.indoorViewEnabled, trafficEnabled: config.trafficEnabled, buildingsEnabled: config.buildingsEnabled, - mapId: config.mapId, + cloudMapId: config.cloudMapId, style: config.style, ); } @@ -1284,7 +1262,7 @@ PlatformMapConfiguration _platformMapConfigurationFromOptionsJson( indoorViewEnabled: options['indoorEnabled'] as bool?, trafficEnabled: options['trafficEnabled'] as bool?, buildingsEnabled: options['buildingsEnabled'] as bool?, - mapId: options['cloudMapId'] as String?, + cloudMapId: options['cloudMapId'] as String?, style: options['style'] as String?, ); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart index 2bb8b3fb42d..09197a6bf21 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart @@ -479,8 +479,8 @@ class PlatformCameraUpdateZoomTo { class PlatformCircle { PlatformCircle({ this.consumeTapEvents = false, - required this.fillColor, - required this.strokeColor, + this.fillColor = 0x00000000, + this.strokeColor = 0xFF000000, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -491,9 +491,9 @@ class PlatformCircle { bool consumeTapEvents; - PlatformColor fillColor; + int fillColor; - PlatformColor strokeColor; + int strokeColor; bool visible; @@ -529,8 +529,8 @@ class PlatformCircle { result as List; return PlatformCircle( consumeTapEvents: result[0]! as bool, - fillColor: result[1]! as PlatformColor, - strokeColor: result[2]! as PlatformColor, + fillColor: result[1]! as int, + strokeColor: result[2]! as int, visible: result[3]! as bool, strokeWidth: result[4]! as int, zIndex: result[5]! as double, @@ -849,7 +849,7 @@ class PlatformPolygon { bool consumesTapEvents; - PlatformColor fillColor; + int fillColor; bool geodesic; @@ -859,7 +859,7 @@ class PlatformPolygon { bool visible; - PlatformColor strokeColor; + int strokeColor; int strokeWidth; @@ -889,12 +889,12 @@ class PlatformPolygon { return PlatformPolygon( polygonId: result[0]! as String, consumesTapEvents: result[1]! as bool, - fillColor: result[2]! as PlatformColor, + fillColor: result[2]! as int, geodesic: result[3]! as bool, points: (result[4] as List?)!.cast(), holes: (result[5] as List?)!.cast>(), visible: result[6]! as bool, - strokeColor: result[7]! as PlatformColor, + strokeColor: result[7]! as int, strokeWidth: result[8]! as int, zIndex: result[9]! as int, ); @@ -936,7 +936,7 @@ class PlatformPolyline { bool consumesTapEvents; - PlatformColor color; + int color; bool geodesic; @@ -978,7 +978,7 @@ class PlatformPolyline { return PlatformPolyline( polylineId: result[0]! as String, consumesTapEvents: result[1]! as bool, - color: result[2]! as PlatformColor, + color: result[2]! as int, geodesic: result[3]! as bool, jointType: result[4]! as PlatformJointType, patterns: (result[5] as List?)!.cast(), @@ -1535,7 +1535,7 @@ class PlatformMapConfiguration { this.indoorViewEnabled, this.trafficEnabled, this.buildingsEnabled, - this.mapId, + this.cloudMapId, this.style, }); @@ -1569,7 +1569,7 @@ class PlatformMapConfiguration { bool? buildingsEnabled; - String? mapId; + String? cloudMapId; String? style; @@ -1590,7 +1590,7 @@ class PlatformMapConfiguration { indoorViewEnabled, trafficEnabled, buildingsEnabled, - mapId, + cloudMapId, style, ]; } @@ -1617,7 +1617,7 @@ class PlatformMapConfiguration { indoorViewEnabled: result[12] as bool?, trafficEnabled: result[13] as bool?, buildingsEnabled: result[14] as bool?, - mapId: result[15] as String?, + cloudMapId: result[15] as String?, style: result[16] as String?, ); } @@ -1719,58 +1719,6 @@ class PlatformSize { int get hashCode => Object.hashAll(_toList()); } -/// Pigeon representation of a color. -class PlatformColor { - PlatformColor({ - required this.red, - required this.green, - required this.blue, - required this.alpha, - }); - - double red; - - double green; - - double blue; - - double alpha; - - List _toList() { - return [red, green, blue, alpha]; - } - - Object encode() { - return _toList(); - } - - static PlatformColor decode(Object result) { - result as List; - return PlatformColor( - red: result[0]! as double, - green: result[1]! as double, - blue: result[2]! as double, - alpha: result[3]! as double, - ); - } - - @override - // ignore: avoid_equals_and_hash_code_on_mutable_classes - bool operator ==(Object other) { - if (other is! PlatformColor || other.runtimeType != runtimeType) { - return false; - } - if (identical(this, other)) { - return true; - } - return _deepEquals(encode(), other.encode()); - } - - @override - // ignore: avoid_equals_and_hash_code_on_mutable_classes - int get hashCode => Object.hashAll(_toList()); -} - /// Pigeon equivalent of GMSTileLayer properties. class PlatformTileLayer { PlatformTileLayer({ @@ -2298,35 +2246,32 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformSize) { buffer.putUint8(162); writeValue(buffer, value.encode()); - } else if (value is PlatformColor) { - buffer.putUint8(163); - writeValue(buffer, value.encode()); } else if (value is PlatformTileLayer) { - buffer.putUint8(164); + buffer.putUint8(163); writeValue(buffer, value.encode()); } else if (value is PlatformZoomRange) { - buffer.putUint8(165); + buffer.putUint8(164); writeValue(buffer, value.encode()); } else if (value is PlatformBitmap) { - buffer.putUint8(166); + buffer.putUint8(165); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapDefaultMarker) { - buffer.putUint8(167); + buffer.putUint8(166); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapBytes) { - buffer.putUint8(168); + buffer.putUint8(167); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapAsset) { - buffer.putUint8(169); + buffer.putUint8(168); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapAssetImage) { - buffer.putUint8(170); + buffer.putUint8(169); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapAssetMap) { - buffer.putUint8(171); + buffer.putUint8(170); writeValue(buffer, value.encode()); } else if (value is PlatformBitmapBytesMap) { - buffer.putUint8(172); + buffer.putUint8(171); writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); @@ -2409,24 +2354,22 @@ class _PigeonCodec extends StandardMessageCodec { case 162: return PlatformSize.decode(readValue(buffer)!); case 163: - return PlatformColor.decode(readValue(buffer)!); - case 164: return PlatformTileLayer.decode(readValue(buffer)!); - case 165: + case 164: return PlatformZoomRange.decode(readValue(buffer)!); - case 166: + case 165: return PlatformBitmap.decode(readValue(buffer)!); - case 167: + case 166: return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); - case 168: + case 167: return PlatformBitmapBytes.decode(readValue(buffer)!); - case 169: + case 168: return PlatformBitmapAsset.decode(readValue(buffer)!); - case 170: + case 169: return PlatformBitmapAssetImage.decode(readValue(buffer)!); - case 171: + case 170: return PlatformBitmapAssetMap.decode(readValue(buffer)!); - case 172: + case 171: return PlatformBitmapBytesMap.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart index f31f9f760cd..aa94f6c12b2 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; -// These constants must match the corresponding constants in FGMConversionUtils.m +// These constants must match the corresponding constants in FLTGoogleMapJSONConversions.m const String _heatmapIdKey = 'heatmapId'; const String _heatmapDataKey = 'data'; const String _heatmapGradientKey = 'gradient'; @@ -96,9 +96,7 @@ Object serializeHeatmapGradient(HeatmapGradient gradient) { _addIfNonNull( json, _heatmapGradientColorsKey, - gradient.colors - .map((HeatmapGradientColor e) => e.color.toARGB32()) - .toList(), + gradient.colors.map((HeatmapGradientColor e) => e.color.value).toList(), ); _addIfNonNull( json, diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart index 98af369be23..14f27007671 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart @@ -101,9 +101,9 @@ class PlatformCircle { PlatformCircle({ required this.circleId, required this.center, - required this.fillColor, - required this.strokeColor, this.consumeTapEvents = false, + this.fillColor = 0x00000000, + this.strokeColor = 0xFF000000, this.visible = true, this.strokeWidth = 10, this.zIndex = 0.0, @@ -111,8 +111,8 @@ class PlatformCircle { }); final bool consumeTapEvents; - final PlatformColor fillColor; - final PlatformColor strokeColor; + final int fillColor; + final int strokeColor; final bool visible; final int strokeWidth; final double zIndex; @@ -215,12 +215,12 @@ class PlatformPolygon { final String polygonId; final bool consumesTapEvents; - final PlatformColor fillColor; + final int fillColor; final bool geodesic; final List points; final List> holes; final bool visible; - final PlatformColor strokeColor; + final int strokeColor; final int strokeWidth; final int zIndex; } @@ -245,7 +245,7 @@ class PlatformPolyline { final String polylineId; final bool consumesTapEvents; - final PlatformColor color; + final int color; final bool geodesic; /// The joint type. @@ -414,7 +414,7 @@ class PlatformMapConfiguration { required this.indoorViewEnabled, required this.trafficEnabled, required this.buildingsEnabled, - required this.mapId, + required this.cloudMapId, required this.style, }); @@ -433,7 +433,7 @@ class PlatformMapConfiguration { final bool? indoorViewEnabled; final bool? trafficEnabled; final bool? buildingsEnabled; - final String? mapId; + final String? cloudMapId; final String? style; } @@ -453,21 +453,6 @@ class PlatformSize { final double height; } -/// Pigeon representation of a color. -class PlatformColor { - PlatformColor({ - required this.red, - required this.green, - required this.blue, - required this.alpha, - }); - - final double red; - final double green; - final double blue; - final double alpha; -} - /// Pigeon equivalent of GMSTileLayer properties. class PlatformTileLayer { PlatformTileLayer({ diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml index eb4fe6d3a4e..2dfd81cc2c1 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_maps_flutter_ios description: iOS implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.15.8 +version: 2.15.7 environment: sdk: ^3.8.0 @@ -19,7 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - google_maps_flutter_platform_interface: ^2.13.0 + google_maps_flutter_platform_interface: ^2.12.1 stream_transform: ^2.0.0 dev_dependencies: diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart b/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart index 1b91f2a4a89..84890f6f883 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/test/google_maps_flutter_ios_test.dart @@ -411,8 +411,8 @@ void main() { expect(toChange.length, 1); final PlatformCircle firstChanged = toChange.first; expect(firstChanged.consumeTapEvents, object2new.consumeTapEvents); - _expectColorsEqual(firstChanged.fillColor, object2new.fillColor); - _expectColorsEqual(firstChanged.strokeColor, object2new.strokeColor); + expect(firstChanged.fillColor, object2new.fillColor.value); + expect(firstChanged.strokeColor, object2new.strokeColor.value); expect(firstChanged.visible, object2new.visible); expect(firstChanged.strokeWidth, object2new.strokeWidth); expect(firstChanged.zIndex, object2new.zIndex.toDouble()); @@ -426,8 +426,8 @@ void main() { expect(toAdd.length, 1); final PlatformCircle firstAdded = toAdd.first; expect(firstAdded.consumeTapEvents, object3.consumeTapEvents); - _expectColorsEqual(firstAdded.fillColor, object3.fillColor); - _expectColorsEqual(firstAdded.strokeColor, object3.strokeColor); + expect(firstAdded.fillColor, object3.fillColor.value); + expect(firstAdded.strokeColor, object3.strokeColor.value); expect(firstAdded.visible, object3.visible); expect(firstAdded.strokeWidth, object3.strokeWidth); expect(firstAdded.zIndex, object3.zIndex.toDouble()); @@ -593,7 +593,7 @@ void main() { void expectPolygon(PlatformPolygon actual, Polygon expected) { expect(actual.polygonId, expected.polygonId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - _expectColorsEqual(actual.fillColor, expected.fillColor); + expect(actual.fillColor, expected.fillColor.value); expect(actual.geodesic, expected.geodesic); expect(actual.points.length, expected.points.length); for (final (int i, PlatformLatLng? point) in actual.points.indexed) { @@ -609,7 +609,7 @@ void main() { } } expect(actual.visible, expected.visible); - _expectColorsEqual(actual.strokeColor, expected.strokeColor); + expect(actual.strokeColor, expected.strokeColor.value); expect(actual.strokeWidth, expected.strokeWidth); expect(actual.zIndex, expected.zIndex); } @@ -663,7 +663,7 @@ void main() { void expectPolyline(PlatformPolyline actual, Polyline expected) { expect(actual.polylineId, expected.polylineId.value); expect(actual.consumesTapEvents, expected.consumeTapEvents); - _expectColorsEqual(actual.color, expected.color); + expect(actual.color, expected.color.value); expect(actual.geodesic, expected.geodesic); expect( actual.jointType, @@ -1346,7 +1346,7 @@ void main() { expect(typedBitmap.height, 200.0); }); - testWidgets('mapId is passed', (WidgetTester tester) async { + testWidgets('cloudMapId is passed', (WidgetTester tester) async { const String cloudMapId = '000000000000000'; // Dummy map ID. final Completer passedCloudMapIdCompleter = Completer(); @@ -1366,7 +1366,7 @@ void main() { as PlatformMapViewCreationParams?; if (creationParams != null) { final String? passedMapId = - creationParams.mapConfiguration.mapId; + creationParams.mapConfiguration.cloudMapId; if (passedMapId != null) { passedCloudMapIdCompleter.complete(passedMapId); } @@ -1391,7 +1391,7 @@ void main() { ), textDirection: TextDirection.ltr, ), - mapConfiguration: const MapConfiguration(mapId: cloudMapId), + mapConfiguration: const MapConfiguration(cloudMapId: cloudMapId), ), ), ); @@ -1399,14 +1399,7 @@ void main() { expect( await passedCloudMapIdCompleter.future, cloudMapId, - reason: 'Should pass mapId on PlatformView creation message', + reason: 'Should pass cloudMapId on PlatformView creation message', ); }); } - -void _expectColorsEqual(PlatformColor actual, Color expected) { - expect(actual.red, expected.r); - expect(actual.green, expected.g); - expect(actual.blue, expected.b); - expect(actual.alpha, expected.a); -}