-
Notifications
You must be signed in to change notification settings - Fork 9.7k
GoogleMaps on iOS #525
GoogleMaps on iOS #525
Conversation
sigurdm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
|
||
| - (BOOL)application:(UIApplication *)application | ||
| didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| [GMSServices provideAPIKey:kAPIKey]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to move the apikeys into dart-land
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that in a separate PR.
| } | ||
| } | ||
|
|
||
| // GMSMapViewDelegate methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it is common to use
#pragma mark - ...
To mark a new section. You could also mark the MapOptionsSink section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| // Conversion functions between iOS types and JSON-like values sent via platform channels. | ||
| // Forward declarations. | ||
|
|
||
| static id positionToJson(GMSCameraPosition* position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move these to convert.[h,mm] to align with the java version?
| result(controller.mapId); | ||
| } else if ([call.method isEqualToString:@"showMapOverlay"]) { | ||
| FlutterError* error; | ||
| FLTGoogleMapController* controller = [self mapFromCall:call error:&error]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the reporting of error to result could be extracted into mapFromCall?
Or you could collect all the calls with a map id inside one else-branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| return nil; | ||
| } | ||
|
|
||
| static void writeMapOptions(id json, id<FLTGoogleMapOptionsSink> sink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=> interpretMapOptions?
To correspond to the java naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| id infoWindowText = data[@"infoWindowText"]; | ||
| if (infoWindowText) { | ||
| NSArray* infoWindowTextData = infoWindowText; | ||
| NSString* title = [infoWindowTextData[0] isEqual:[NSNull null]] ? nil : infoWindowTextData[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I believe you can use == to compare with [NSNull null].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| 'zIndex': zIndex, | ||
| }; | ||
| final Map<String, dynamic> json = <String, dynamic>{}; | ||
| if (alpha != null) json['alpha'] = alpha; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps make a inline helper
addIfPresent(String fieldName, dynamic value]) {
if (field != null) json[fieldName] = value;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| s.dependency 'Flutter' | ||
|
|
||
| s.dependency 'GoogleMaps' | ||
| s.compiler_flags = '-fno-modules' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this line deserve a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
mravn-google
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
| } | ||
| } | ||
|
|
||
| // GMSMapViewDelegate methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| s.dependency 'Flutter' | ||
|
|
||
| s.dependency 'GoogleMaps' | ||
| s.compiler_flags = '-fno-modules' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| 'zIndex': zIndex, | ||
| }; | ||
| final Map<String, dynamic> json = <String, dynamic>{}; | ||
| if (alpha != null) json['alpha'] = alpha; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
|
||
| - (BOOL)application:(UIApplication *)application | ||
| didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| [GMSServices provideAPIKey:kAPIKey]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that in a separate PR.
| result(controller.mapId); | ||
| } else if ([call.method isEqualToString:@"showMapOverlay"]) { | ||
| FlutterError* error; | ||
| FLTGoogleMapController* controller = [self mapFromCall:call error:&error]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| return nil; | ||
| } | ||
|
|
||
| static void writeMapOptions(id json, id<FLTGoogleMapOptionsSink> sink) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| id infoWindowText = data[@"infoWindowText"]; | ||
| if (infoWindowText) { | ||
| NSArray* infoWindowTextData = infoWindowText; | ||
| NSString* title = [infoWindowTextData[0] isEqual:[NSNull null]] ? nil : infoWindowTextData[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
[NSNull null]values on iOS side).TBD (later PR): unify API coverage, add tests, texture snapshotting on iOS.