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

Commit 401a2d7

Browse files
committed
Review edits
1 parent de32d15 commit 401a2d7

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

packages/google_sign_in/google_sign_in_ios/ios/Classes/FLTGoogleSignInPlugin.m

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,18 @@
3838

3939
@interface FLTGoogleSignInPlugin ()
4040

41+
// Configuration wrapping Google Cloud Console, Google Apps, OpenID,
42+
// and other initialization metadata.
4143
@property(strong) GIDConfiguration *configuration;
44+
45+
// Permissions requested during at sign in "init" method call
46+
// unioned with scopes requested later with incremental authorization
47+
// "requestScopes" method call.
48+
// The "email" and "profile" base scopes are always implicitly requested.
4249
@property(copy) NSSet<NSString *> *requestedScopes;
50+
51+
// Instance used to manage Google Sign In authentication including
52+
// sign in, sign out, and requesting additional scopes.
4353
@property(strong, readonly) GIDSignIn *signIn;
4454

4555
// Redeclared as not a designated initializer.
@@ -80,8 +90,8 @@ - (instancetype)initWithSignIn:(GIDSignIn *)signIn {
8090
- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result {
8191
if ([call.method isEqualToString:@"init"]) {
8292
GIDConfiguration *configuration =
83-
[self configurationClientIdArgument:call.arguments[@"clientId"]
84-
hostedDomainArgument:call.arguments[@"hostedDomain"]];
93+
[self configurationWithClientIdArgument:call.arguments[@"clientId"]
94+
hostedDomainArgument:call.arguments[@"hostedDomain"]];
8595
if (configuration != nil) {
8696
if ([call.arguments[@"scopes"] isKindOfClass:[NSArray class]]) {
8797
self.requestedScopes = [NSSet setWithArray:call.arguments[@"scopes"]];
@@ -101,8 +111,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
101111
result(@([self.signIn hasPreviousSignIn]));
102112
} else if ([call.method isEqualToString:@"signIn"]) {
103113
@try {
104-
GIDConfiguration *configuration =
105-
self.configuration ?: [self configurationClientIdArgument:nil hostedDomainArgument:nil];
114+
GIDConfiguration *configuration = self.configuration
115+
?: [self configurationWithClientIdArgument:nil
116+
hostedDomainArgument:nil];
106117
[self.signIn signInWithConfiguration:configuration
107118
presentingViewController:[self topViewController]
108119
hint:nil
@@ -188,8 +199,8 @@ - (void)signIn:(GIDSignIn *)signIn dismissViewController:(UIViewController *)vie
188199
#pragma mark - private methods
189200

190201
/// @return @c nil if GoogleService-Info.plist not found.
191-
- (GIDConfiguration *)configurationClientIdArgument:(id)clientIDArg
192-
hostedDomainArgument:(id)hostedDomainArg {
202+
- (GIDConfiguration *)configurationWithClientIdArgument:(id)clientIDArg
203+
hostedDomainArgument:(id)hostedDomainArg {
193204
NSString *plistPath = [NSBundle.mainBundle pathForResource:@"GoogleService-Info" ofType:@"plist"];
194205
if (plistPath == nil) {
195206
return nil;
@@ -219,8 +230,7 @@ - (void)didSignInForUser:(GIDGoogleUser *)user
219230
} else {
220231
NSURL *photoUrl;
221232
if (user.profile.hasImage) {
222-
// Placeholder that will be replaced by on the Dart side based on screen
223-
// size
233+
// Placeholder that will be replaced by on the Dart side based on screen size.
224234
photoUrl = [user.profile imageURLWithDimension:1337];
225235
}
226236
[self respondWithAccount:@{

0 commit comments

Comments
 (0)