From 3d73e102d60789c6782a75d8444d8c9c84254635 Mon Sep 17 00:00:00 2001 From: Raees Kattali Date: Wed, 26 Aug 2020 08:18:47 +0300 Subject: [PATCH 01/10] geodesic ios --- .../ios/Classes/GoogleMapPolylineController.h | 1 + .../ios/Classes/GoogleMapPolylineController.m | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h index a5977bf75e1e..2c9993e47349 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h @@ -20,6 +20,7 @@ @property(atomic, readonly) NSString* polylineId; - (instancetype)initPolylineWithPath:(GMSMutablePath*)path polylineId:(NSString*)polylineId + geodesic:(BOOL)geodesic mapView:(GMSMapView*)mapView; - (void)removePolyline; @end diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index b701a5f3a6b5..995df3be74cf 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -11,10 +11,12 @@ @implementation FLTGoogleMapPolylineController { } - (instancetype)initPolylineWithPath:(GMSMutablePath*)path polylineId:(NSString*)polylineId + geodesic:(BOOL)geodesic mapView:(GMSMapView*)mapView { self = [super init]; if (self) { _polyline = [GMSPolyline polylineWithPath:path]; + _polyline.geodesic = geodesic; _mapView = mapView; _polylineId = polylineId; _polyline.userData = @[ polylineId ]; @@ -119,9 +121,11 @@ - (void)addPolylines:(NSArray*)polylinesToAdd { for (NSDictionary* polyline in polylinesToAdd) { GMSMutablePath* path = [FLTPolylinesController getPath:polyline]; NSString* polylineId = [FLTPolylinesController getPolylineId:polyline]; + NSNumber* geodisc = [FLTPolylinesController isGeodesic:polyline]; FLTGoogleMapPolylineController* controller = [[FLTGoogleMapPolylineController alloc] initPolylineWithPath:path polylineId:polylineId + geodesic:geodisc.boolValue mapView:_mapView]; InterpretPolylineOptions(polyline, controller, _registrar); _polylineIdToController[polylineId] = controller; @@ -178,4 +182,9 @@ + (GMSMutablePath*)getPath:(NSDictionary*)polyline { + (NSString*)getPolylineId:(NSDictionary*)polyline { return polyline[@"polylineId"]; } + ++ (NSNumber *)isGeodesic:(NSDictionary*)polyline { + return polyline[@"geodesic"]; +} + @end From 7caffa16a6d4752eca01f650e86febc47b0b8083 Mon Sep 17 00:00:00 2001 From: Raees Kattali Date: Wed, 26 Aug 2020 08:23:57 +0300 Subject: [PATCH 02/10] geodesic ios --- packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md | 4 ++++ packages/google_maps_flutter/google_maps_flutter/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index 02b257d6b168..e2c4e01d1c65 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,5 +1,9 @@ ## 0.5.30 +* Geodesic Polyline support for iOS + +## 0.5.30 + * Add a `dispose` method to the controller to let the native side know that we're done with said controller. * Call `controller.dispose()` from the `dispose` method of the `GoogleMap` widget. diff --git a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml index e7e3aeeb3327..9d2468ac1eaf 100644 --- a/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter/pubspec.yaml @@ -1,7 +1,7 @@ name: google_maps_flutter description: A Flutter plugin for integrating Google Maps in iOS and Android applications. homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter/google_maps_flutter -version: 0.5.30 +version: 0.5.31 dependencies: flutter: From e104fbd2839638db5e29d852d1fcb603e82eb913 Mon Sep 17 00:00:00 2001 From: raees Date: Wed, 26 Aug 2020 09:31:52 +0300 Subject: [PATCH 03/10] Update CHANGELOG.md --- packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md index e2c4e01d1c65..0476f8c9a744 100644 --- a/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.5.30 +## 0.5.31 * Geodesic Polyline support for iOS @@ -416,4 +416,4 @@ ## 0.0.2 -* Initial developers preview release. \ No newline at end of file +* Initial developers preview release. From 03531a732748ce17981235f33b1b84dcfe8be946 Mon Sep 17 00:00:00 2001 From: raees Date: Wed, 26 Aug 2020 22:25:25 +0300 Subject: [PATCH 04/10] typo correction --- .../ios/Classes/GoogleMapPolylineController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index 995df3be74cf..23183dfee3fc 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -121,7 +121,7 @@ - (void)addPolylines:(NSArray*)polylinesToAdd { for (NSDictionary* polyline in polylinesToAdd) { GMSMutablePath* path = [FLTPolylinesController getPath:polyline]; NSString* polylineId = [FLTPolylinesController getPolylineId:polyline]; - NSNumber* geodisc = [FLTPolylinesController isGeodesic:polyline]; + NSNumber* geodesic = [FLTPolylinesController isGeodesic:polyline]; FLTGoogleMapPolylineController* controller = [[FLTGoogleMapPolylineController alloc] initPolylineWithPath:path polylineId:polylineId From 9dd6dd7cb9723b04ae5149d18711d8bb5bdcae77 Mon Sep 17 00:00:00 2001 From: raees Date: Wed, 26 Aug 2020 23:15:12 +0300 Subject: [PATCH 05/10] Update GoogleMapPolylineController.m --- .../ios/Classes/GoogleMapPolylineController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index 23183dfee3fc..7d9ec4086378 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -11,7 +11,7 @@ @implementation FLTGoogleMapPolylineController { } - (instancetype)initPolylineWithPath:(GMSMutablePath*)path polylineId:(NSString*)polylineId - geodesic:(BOOL)geodesic + geodesic:(BOOL)geodesic mapView:(GMSMapView*)mapView { self = [super init]; if (self) { @@ -183,7 +183,7 @@ + (NSString*)getPolylineId:(NSDictionary*)polyline { return polyline[@"polylineId"]; } -+ (NSNumber *)isGeodesic:(NSDictionary*)polyline { ++ (NSNumber*)isGeodesic:(NSDictionary*)polyline { return polyline[@"geodesic"]; } From 3e530cf158aa963e66ccfbb9c41afe0fcfe49c8b Mon Sep 17 00:00:00 2001 From: raees Date: Wed, 26 Aug 2020 23:22:05 +0300 Subject: [PATCH 06/10] Update GoogleMapPolylineController.m --- .../ios/Classes/GoogleMapPolylineController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index 7d9ec4086378..924069fbdf0c 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -125,7 +125,7 @@ - (void)addPolylines:(NSArray*)polylinesToAdd { FLTGoogleMapPolylineController* controller = [[FLTGoogleMapPolylineController alloc] initPolylineWithPath:path polylineId:polylineId - geodesic:geodisc.boolValue + geodesic:geodesic.boolValue mapView:_mapView]; InterpretPolylineOptions(polyline, controller, _registrar); _polylineIdToController[polylineId] = controller; From 579519babcd6516009b7b7cb6a7b3dc9dec98a80 Mon Sep 17 00:00:00 2001 From: Raees Kattali Date: Thu, 27 Aug 2020 00:08:44 +0300 Subject: [PATCH 07/10] formatting --- .../ios/Classes/GoogleMapPolylineController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index 7d9ec4086378..318e510f1f8a 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -11,7 +11,7 @@ @implementation FLTGoogleMapPolylineController { } - (instancetype)initPolylineWithPath:(GMSMutablePath*)path polylineId:(NSString*)polylineId - geodesic:(BOOL)geodesic + geodesic:(BOOL)geodesic mapView:(GMSMapView*)mapView { self = [super init]; if (self) { @@ -125,7 +125,7 @@ - (void)addPolylines:(NSArray*)polylinesToAdd { FLTGoogleMapPolylineController* controller = [[FLTGoogleMapPolylineController alloc] initPolylineWithPath:path polylineId:polylineId - geodesic:geodisc.boolValue + geodesic:geodisc.boolValue mapView:_mapView]; InterpretPolylineOptions(polyline, controller, _registrar); _polylineIdToController[polylineId] = controller; From 27e9ddbf5fb2964a0ae821c5a13b177ba7fbdf08 Mon Sep 17 00:00:00 2001 From: raees Date: Thu, 27 Aug 2020 01:33:35 +0300 Subject: [PATCH 08/10] Update GoogleMapPolylineController.m --- .../ios/Classes/GoogleMapPolylineController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index 318e510f1f8a..1dc8bf99ea5b 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -125,7 +125,7 @@ - (void)addPolylines:(NSArray*)polylinesToAdd { FLTGoogleMapPolylineController* controller = [[FLTGoogleMapPolylineController alloc] initPolylineWithPath:path polylineId:polylineId - geodesic:geodisc.boolValue + geodesic:geodesic.boolValue mapView:_mapView]; InterpretPolylineOptions(polyline, controller, _registrar); _polylineIdToController[polylineId] = controller; From 053f31fa44a6aadfe1cf0720e1c636ce11a7190b Mon Sep 17 00:00:00 2001 From: Raees Kattali Date: Sat, 29 Aug 2020 14:57:26 +0300 Subject: [PATCH 09/10] set geodesic using FLTGoogleMapPolylineOptionsSink --- .../ios/Classes/GoogleMapPolylineController.h | 2 +- .../ios/Classes/GoogleMapPolylineController.m | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h index 2c9993e47349..1f41ce09f92c 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h @@ -13,6 +13,7 @@ - (void)setStrokeWidth:(CGFloat)width; - (void)setPoints:(NSArray*)points; - (void)setZIndex:(int)zIndex; +- (void)setGeoDesic:(BOOL)isGeodesic; @end // Defines polyline controllable by Flutter. @@ -20,7 +21,6 @@ @property(atomic, readonly) NSString* polylineId; - (instancetype)initPolylineWithPath:(GMSMutablePath*)path polylineId:(NSString*)polylineId - geodesic:(BOOL)geodesic mapView:(GMSMapView*)mapView; - (void)removePolyline; @end diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index 1dc8bf99ea5b..ee6342391c59 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -11,12 +11,10 @@ @implementation FLTGoogleMapPolylineController { } - (instancetype)initPolylineWithPath:(GMSMutablePath*)path polylineId:(NSString*)polylineId - geodesic:(BOOL)geodesic mapView:(GMSMapView*)mapView { self = [super init]; if (self) { _polyline = [GMSPolyline polylineWithPath:path]; - _polyline.geodesic = geodesic; _mapView = mapView; _polylineId = polylineId; _polyline.userData = @[ polylineId ]; @@ -54,6 +52,10 @@ - (void)setColor:(UIColor*)color { - (void)setStrokeWidth:(CGFloat)width { _polyline.strokeWidth = width; } + +- (void)setGeoDesic:(BOOL)isGeodesic { + _polyline.geodesic = isGeodesic; +} @end static int ToInt(NSNumber* data) { return [FLTGoogleMapJsonConversions toInt:data]; } @@ -97,6 +99,11 @@ static void InterpretPolylineOptions(NSDictionary* data, id Date: Tue, 1 Sep 2020 08:34:30 +0300 Subject: [PATCH 10/10] naming standard --- .../ios/Classes/GoogleMapPolylineController.h | 2 +- .../ios/Classes/GoogleMapPolylineController.m | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h index 1f41ce09f92c..d1e10ace462e 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.h @@ -13,7 +13,7 @@ - (void)setStrokeWidth:(CGFloat)width; - (void)setPoints:(NSArray*)points; - (void)setZIndex:(int)zIndex; -- (void)setGeoDesic:(BOOL)isGeodesic; +- (void)setGeodesic:(BOOL)isGeodesic; @end // Defines polyline controllable by Flutter. diff --git a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m index ee6342391c59..9bb57ed897ac 100644 --- a/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m +++ b/packages/google_maps_flutter/google_maps_flutter/ios/Classes/GoogleMapPolylineController.m @@ -53,7 +53,7 @@ - (void)setStrokeWidth:(CGFloat)width { _polyline.strokeWidth = width; } -- (void)setGeoDesic:(BOOL)isGeodesic { +- (void)setGeodesic:(BOOL)isGeodesic { _polyline.geodesic = isGeodesic; } @end @@ -100,9 +100,9 @@ static void InterpretPolylineOptions(NSDictionary* data, id