Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@mravn-google
Copy link
Contributor

@mravn-google mravn-google commented May 2, 2018

  • Initial iOS support:
    • Showing and configuring GoogleMaps, no texture snapshotting yet.
    • Adding and configuring markers.
    • Event handling: camera movements and marker taps.
  • Dart/Android changes:
    • Don't premultiply with screen density on Dart side.
    • Reason for camera movement now just a boolean value indicating if it was a user gesture.
    • Avoid making null-valued options part of JSON (so we don't have to worry about [NSNull null] values on iOS side).
    • Example app now also reflects camera move started/camera idle events.

TBD (later PR): unify API coverage, add tests, texture snapshotting on iOS.

@mravn-google mravn-google self-assigned this May 2, 2018
@mravn-google mravn-google changed the title Initial iOS solution [WIP] Initial iOS solution May 2, 2018
@mravn-google mravn-google changed the title [WIP] Initial iOS solution [WIP] GoogleMaps on iOS May 2, 2018
@mravn-google mravn-google changed the title [WIP] GoogleMaps on iOS GoogleMaps on iOS May 4, 2018
@mravn-google mravn-google requested a review from sigurdm May 4, 2018 10:11
Copy link
Contributor

@sigurdm sigurdm left a 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];
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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];
Copy link
Contributor

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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];
Copy link
Contributor

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].

Copy link
Contributor Author

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;
Copy link
Contributor

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;
}

Copy link
Contributor Author

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'
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor Author

@mravn-google mravn-google left a 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
Copy link
Contributor Author

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'
Copy link
Contributor Author

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;
Copy link
Contributor Author

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];
Copy link
Contributor Author

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];
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mravn-google mravn-google merged commit 2db1f4b into flutter:master May 4, 2018
@mravn-google mravn-google deleted the ios_maps branch May 4, 2018 16:00
haydenflinner pushed a commit to haydenflinner/plugins that referenced this pull request May 4, 2018
slightfoot pushed a commit to slightfoot/plugins that referenced this pull request Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants