diff --git a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md index 7126a66e6787..5d5716e1715d 100644 --- a/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in_ios/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 5.7.4 +* Improves type handling in Objective-C code. * Updates minimum iOS version to 12.0 and minimum Flutter version to 3.16.6. ## 5.7.3 diff --git a/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m b/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m index 2f7e558ec202..d7a5cd85303c 100644 --- a/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m +++ b/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m @@ -111,9 +111,9 @@ - (BOOL)handleOpenURLs:(NSArray *)urls { - (void)initializeSignInWithParameters:(nonnull FSIInitParams *)params error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - GIDConfiguration *configuration = [self configurationWithClientIdArgument:params.clientId - serverClientIdArgument:params.serverClientId - hostedDomainArgument:params.hostedDomain]; + GIDConfiguration *configuration = [self configurationWithClientIdentifier:params.clientId + serverClientIdentifier:params.serverClientId + hostedDomain:params.hostedDomain]; self.requestedScopes = [NSSet setWithArray:params.scopes]; if (configuration != nil) { self.configuration = configuration; @@ -141,9 +141,9 @@ - (void)signInWithCompletion:(nonnull void (^)(FSIUserData *_Nullable, // If neither are available, do not set the configuration - GIDSignIn will automatically use // settings from the Info.plist (which is the recommended method). if (!self.configuration && self.googleServiceProperties) { - self.configuration = [self configurationWithClientIdArgument:nil - serverClientIdArgument:nil - hostedDomainArgument:nil]; + self.configuration = [self configurationWithClientIdentifier:nil + serverClientIdentifier:nil + hostedDomain:nil]; } if (self.configuration) { self.signIn.configuration = self.configuration; @@ -270,30 +270,19 @@ - (void)addScopes:(NSArray *)scopes #endif } -/// @return @c nil if GoogleService-Info.plist not found and clientId is not provided. -- (GIDConfiguration *)configurationWithClientIdArgument:(id)clientIDArg - serverClientIdArgument:(id)serverClientIDArg - hostedDomainArgument:(id)hostedDomainArg { - NSString *clientID; - BOOL hasDynamicClientId = [clientIDArg isKindOfClass:[NSString class]]; - if (hasDynamicClientId) { - clientID = clientIDArg; - } else if (self.googleServiceProperties) { - clientID = self.googleServiceProperties[kClientIdKey]; - } else { - // We couldn't resolve a clientId, without which we cannot create a GIDConfiguration. +/// @return @c nil if GoogleService-Info.plist not found and runtimeClientIdentifier is not +/// provided. +- (GIDConfiguration *)configurationWithClientIdentifier:(NSString *)runtimeClientIdentifier + serverClientIdentifier:(NSString *)runtimeServerClientIdentifier + hostedDomain:(NSString *)hostedDomain { + NSString *clientID = runtimeClientIdentifier ?: self.googleServiceProperties[kClientIdKey]; + if (!clientID) { + // Creating a GIDConfiguration requires a client identifier. return nil; } + NSString *serverClientID = + runtimeServerClientIdentifier ?: self.googleServiceProperties[kServerClientIdKey]; - BOOL hasDynamicServerClientId = [serverClientIDArg isKindOfClass:[NSString class]]; - NSString *serverClientID = hasDynamicServerClientId - ? serverClientIDArg - : self.googleServiceProperties[kServerClientIdKey]; - - NSString *hostedDomain = nil; - if (hostedDomainArg != [NSNull null]) { - hostedDomain = hostedDomainArg; - } return [[GIDConfiguration alloc] initWithClientID:clientID serverClientID:serverClientID hostedDomain:hostedDomain diff --git a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml index 1e5044379f51..22c153723756 100644 --- a/packages/google_sign_in/google_sign_in_ios/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in_ios/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in_ios description: iOS implementation of the google_sign_in plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 -version: 5.7.3 +version: 5.7.4 environment: sdk: ^3.2.3