38
38
39
39
@interface FLTGoogleSignInPlugin ()
40
40
41
+ // Configuration wrapping Google Cloud Console, Google Apps, OpenID,
42
+ // and other initialization metadata.
41
43
@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.
42
49
@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.
43
53
@property (strong , readonly ) GIDSignIn *signIn;
44
54
45
55
// Redeclared as not a designated initializer.
@@ -80,8 +90,8 @@ - (instancetype)initWithSignIn:(GIDSignIn *)signIn {
80
90
- (void )handleMethodCall : (FlutterMethodCall *)call result : (FlutterResult)result {
81
91
if ([call.method isEqualToString: @" init" ]) {
82
92
GIDConfiguration *configuration =
83
- [self configurationClientIdArgument : call.arguments[@" clientId" ]
84
- hostedDomainArgument: call.arguments[@" hostedDomain" ]];
93
+ [self configurationWithClientIdArgument : call.arguments[@" clientId" ]
94
+ hostedDomainArgument: call.arguments[@" hostedDomain" ]];
85
95
if (configuration != nil ) {
86
96
if ([call.arguments[@" scopes" ] isKindOfClass: [NSArray class ]]) {
87
97
self.requestedScopes = [NSSet setWithArray: call.arguments[@" scopes" ]];
@@ -101,8 +111,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
101
111
result (@([self .signIn hasPreviousSignIn ]));
102
112
} else if ([call.method isEqualToString: @" signIn" ]) {
103
113
@try {
104
- GIDConfiguration *configuration =
105
- self.configuration ?: [self configurationClientIdArgument: nil hostedDomainArgument: nil ];
114
+ GIDConfiguration *configuration = self.configuration
115
+ ?: [self configurationWithClientIdArgument: nil
116
+ hostedDomainArgument: nil ];
106
117
[self .signIn signInWithConfiguration: configuration
107
118
presentingViewController: [self topViewController ]
108
119
hint: nil
@@ -188,8 +199,8 @@ - (void)signIn:(GIDSignIn *)signIn dismissViewController:(UIViewController *)vie
188
199
#pragma mark - private methods
189
200
190
201
// / @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 {
193
204
NSString *plistPath = [NSBundle .mainBundle pathForResource: @" GoogleService-Info" ofType: @" plist" ];
194
205
if (plistPath == nil ) {
195
206
return nil ;
@@ -219,8 +230,7 @@ - (void)didSignInForUser:(GIDGoogleUser *)user
219
230
} else {
220
231
NSURL *photoUrl;
221
232
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.
224
234
photoUrl = [user.profile imageURLWithDimension: 1337 ];
225
235
}
226
236
[self respondWithAccount: @{
0 commit comments