@@ -111,9 +111,9 @@ - (BOOL)handleOpenURLs:(NSArray<NSURL *> *)urls {
111111
112112- (void )initializeSignInWithParameters : (nonnull FSIInitParams *)params
113113 error : (FlutterError *_Nullable __autoreleasing *_Nonnull)error {
114- GIDConfiguration *configuration = [self configurationWithClientIdArgument : params.clientId
115- serverClientIdArgument : params.serverClientId
116- hostedDomainArgument : params.hostedDomain];
114+ GIDConfiguration *configuration = [self configurationWithClientIdentifier : params.clientId
115+ serverClientIdentifier : params.serverClientId
116+ hostedDomain : params.hostedDomain];
117117 self.requestedScopes = [NSSet setWithArray: params.scopes];
118118 if (configuration != nil ) {
119119 self.configuration = configuration;
@@ -141,9 +141,9 @@ - (void)signInWithCompletion:(nonnull void (^)(FSIUserData *_Nullable,
141141 // If neither are available, do not set the configuration - GIDSignIn will automatically use
142142 // settings from the Info.plist (which is the recommended method).
143143 if (!self.configuration && self.googleServiceProperties ) {
144- self.configuration = [self configurationWithClientIdArgument :nil
145- serverClientIdArgument :nil
146- hostedDomainArgument :nil ];
144+ self.configuration = [self configurationWithClientIdentifier :nil
145+ serverClientIdentifier :nil
146+ hostedDomain :nil ];
147147 }
148148 if (self.configuration ) {
149149 self.signIn .configuration = self.configuration ;
@@ -270,30 +270,19 @@ - (void)addScopes:(NSArray<NSString *> *)scopes
270270#endif
271271}
272272
273- // / @return @c nil if GoogleService-Info.plist not found and clientId is not provided.
274- - (GIDConfiguration *)configurationWithClientIdArgument : (id )clientIDArg
275- serverClientIdArgument : (id )serverClientIDArg
276- hostedDomainArgument : (id )hostedDomainArg {
277- NSString *clientID;
278- BOOL hasDynamicClientId = [clientIDArg isKindOfClass: [NSString class ]];
279- if (hasDynamicClientId) {
280- clientID = clientIDArg;
281- } else if (self.googleServiceProperties ) {
282- clientID = self.googleServiceProperties [kClientIdKey ];
283- } else {
284- // We couldn't resolve a clientId, without which we cannot create a GIDConfiguration.
273+ // / @return @c nil if GoogleService-Info.plist not found and runtimeClientIdentifier is not
274+ // / provided.
275+ - (GIDConfiguration *)configurationWithClientIdentifier : (NSString *)runtimeClientIdentifier
276+ serverClientIdentifier : (NSString *)runtimeServerClientIdentifier
277+ hostedDomain : (NSString *)hostedDomain {
278+ NSString *clientID = runtimeClientIdentifier ?: self.googleServiceProperties [kClientIdKey ];
279+ if (!clientID) {
280+ // Creating a GIDConfiguration requires a client identifier.
285281 return nil ;
286282 }
283+ NSString *serverClientID =
284+ runtimeServerClientIdentifier ?: self.googleServiceProperties [kServerClientIdKey ];
287285
288- BOOL hasDynamicServerClientId = [serverClientIDArg isKindOfClass: [NSString class ]];
289- NSString *serverClientID = hasDynamicServerClientId
290- ? serverClientIDArg
291- : self.googleServiceProperties [kServerClientIdKey ];
292-
293- NSString *hostedDomain = nil ;
294- if (hostedDomainArg != [NSNull null ]) {
295- hostedDomain = hostedDomainArg;
296- }
297286 return [[GIDConfiguration alloc ] initWithClientID: clientID
298287 serverClientID: serverClientID
299288 hostedDomain: hostedDomain
0 commit comments