Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/google_maps_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.3.0+1

* Add NSNull Checks for markers controller in iOS.
* Also address an issue where initial markers are set before initialization.

## 0.3.0

* **Breaking change**. Changed the Marker API to be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ final class GoogleMapController
MethodChannel.MethodCallHandler,
OnMapReadyCallback,
PlatformView {

private static final String TAG = "GoogleMapController";
private final int id;
private final AtomicInteger activityState;
Expand All @@ -65,6 +66,7 @@ final class GoogleMapController
private final int registrarActivityHashCode;
private final Context context;
private final MarkersController markersController;
private List<Object> initialMarkers;

GoogleMapController(
int id,
Expand Down Expand Up @@ -154,6 +156,7 @@ public void onMapReady(GoogleMap googleMap) {
googleMap.setOnMarkerClickListener(this);
updateMyLocationEnabled();
markersController.setGoogleMap(googleMap);
updateInitialMarkers();
}

@Override
Expand Down Expand Up @@ -369,7 +372,14 @@ public void setMyLocationEnabled(boolean myLocationEnabled) {

@Override
public void setInitialMarkers(Object initialMarkers) {
markersController.addMarkers((List<Object>) initialMarkers);
this.initialMarkers = (List<Object>) initialMarkers;
if (googleMap != null) {
updateInitialMarkers();
}
}

private void updateInitialMarkers() {
markersController.addMarkers(initialMarkers);
}

@SuppressLint("MissingPermission")
Expand Down
20 changes: 16 additions & 4 deletions packages/google_maps_flutter/ios/Classes/GoogleMapController.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ - (instancetype)initWithFrame:(CGRect)frame
_registrar = registrar;
_cameraDidInitialSetup = NO;
_markersController = [[FLTMarkersController alloc] init:_channel mapView:_mapView];
[_markersController addMarkers:args[@"markersToAdd"]];
id markersToAdd = args[@"markersToAdd"];
if ([markersToAdd isKindOfClass:[NSArray class]]) {
[_markersController addMarkers:markersToAdd];
}
}
return self;
}
Expand Down Expand Up @@ -107,9 +110,18 @@ - (void)onMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
} else if ([call.method isEqualToString:@"map#waitForMap"]) {
result(nil);
} else if ([call.method isEqualToString:@"markers#update"]) {
[_markersController addMarkers:call.arguments[@"markersToAdd"]];
[_markersController changeMarkers:call.arguments[@"markersToChange"]];
[_markersController removeMarkerIds:call.arguments[@"markerIdsToRemove"]];
id markersToAdd = call.arguments[@"markersToAdd"];
if ([markersToAdd isKindOfClass:[NSArray class]]) {
[_markersController addMarkers:markersToAdd];
}
id markersToChange = call.arguments[@"markersToChange"];
if ([markersToChange isKindOfClass:[NSArray class]]) {
[_markersController changeMarkers:markersToChange];
}
id markerIdsToRemove = call.arguments[@"markerIdsToRemove"];
if ([markerIdsToRemove isKindOfClass:[NSArray class]]) {
[_markersController removeMarkerIds:markerIdsToRemove];
}
result(nil);
} else {
result(FlutterMethodNotImplemented);
Expand Down
2 changes: 1 addition & 1 deletion packages/google_maps_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_maps_flutter
description: A Flutter plugin for integrating Google Maps in iOS and Android applications.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
version: 0.3.0
version: 0.3.0+1

dependencies:
flutter:
Expand Down