Skip to content

Commit e650b10

Browse files
[google_sign_in] Clean up pre-Pigeon code (flutter#6141)
Internal native helper code was still using `id` arguments, doing type checking, and handling `NSNull`, none of which is relevant now that the calling code has been converted to Pigeon and is already strongly typed as `NSString`.
1 parent 8f730b9 commit e650b10

File tree

3 files changed

+19
-29
lines changed

3 files changed

+19
-29
lines changed

packages/google_sign_in/google_sign_in_ios/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 5.7.4
22

3+
* Improves type handling in Objective-C code.
34
* Updates minimum iOS version to 12.0 and minimum Flutter version to 3.16.6.
45

56
## 5.7.3

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

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -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

packages/google_sign_in/google_sign_in_ios/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: google_sign_in_ios
22
description: iOS implementation of the google_sign_in plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
5-
version: 5.7.3
5+
version: 5.7.4
66

77
environment:
88
sdk: ^3.2.3

0 commit comments

Comments
 (0)