Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix iOS plugin formatting.
  • Loading branch information
emerssso committed Mar 19, 2020
commit d6cbeb434c925b094e4b999cbeb2881f4104ac82
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
details:error.localizedDescription];
}

@interface FLTGoogleSignInPlugin () <GIDSignInDelegate>
@interface FLTGoogleSignInPlugin ()<GIDSignInDelegate>
@end

@implementation FLTGoogleSignInPlugin {
Expand Down Expand Up @@ -71,8 +71,8 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
message:@"Games sign in is not supported on iOS"
details:nil]);
} else {
NSString *path = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info"
ofType:@"plist"];
NSString *path =
[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
if (path) {
NSMutableDictionary *plist = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
[GIDSignIn sharedInstance].clientID = plist[kClientIdKey];
Expand Down Expand Up @@ -137,16 +137,17 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
return;
}

if([self setAccountRequest:result]) {
if ([self setAccountRequest:result]) {
_additionalScopesRequest = missingScopes;
[GIDSignIn sharedInstance].scopes = [currentScopes arrayByAddingObjectsFromArray:missingScopes];
[GIDSignIn sharedInstance].scopes =
[currentScopes arrayByAddingObjectsFromArray:missingScopes];
[GIDSignIn sharedInstance].presentingViewController = [self topViewController];
[GIDSignIn sharedInstance].loginHint = user.profile.email;
@try {
[[GIDSignIn sharedInstance] signIn];
} @catch (NSException *e) {
result([FlutterError errorWithCode:@"request_scopes" message:e.reason details:e.name]);
}
}
}
} else {
result(FlutterMethodNotImplemented);
Expand Down Expand Up @@ -189,10 +190,10 @@ - (void)signIn:(GIDSignIn *)signIn
// Forward all errors and let Dart side decide how to handle.
[self respondWithAccount:nil error:error];
} else {
if(_additionalScopesRequest) {
if (_additionalScopesRequest) {
bool granted = YES;
for(NSString *scope in _additionalScopesRequest) {
if(![user.grantedScopes containsObject:scope]) {
for (NSString *scope in _additionalScopesRequest) {
if (![user.grantedScopes containsObject:scope]) {
granted = NO;
break;
}
Expand All @@ -202,20 +203,19 @@ - (void)signIn:(GIDSignIn *)signIn
_additionalScopesRequest = nil;
return;
} else {

NSURL *photoUrl;
if (user.profile.hasImage) {
// Placeholder that will be replaced by on the Dart side based on screen
// size
photoUrl = [user.profile imageURLWithDimension:1337];
}
[self respondWithAccount:@{
@"displayName" : user.profile.name ?: [NSNull null],
@"email" : user.profile.email ?: [NSNull null],
@"id" : user.userID ?: [NSNull null],
@"photoUrl" : [photoUrl absoluteString] ?: [NSNull null],
}
error:nil];
NSURL *photoUrl;
if (user.profile.hasImage) {
// Placeholder that will be replaced by on the Dart side based on screen
// size
photoUrl = [user.profile imageURLWithDimension:1337];
}
[self respondWithAccount:@{
@"displayName" : user.profile.name ?: [NSNull null],
@"email" : user.profile.email ?: [NSNull null],
@"id" : user.userID ?: [NSNull null],
@"photoUrl" : [photoUrl absoluteString] ?: [NSNull null],
}
error:nil];
}
}
}
Expand Down