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 88ed91b01746..285af4a4bc26 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.7 +* Fixes "callee requires a non-null parameter" analyzer warning. * Updates minimum supported SDK version to Flutter 3.19/Dart 3.3. ## 5.7.6 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 99ee0348f518..7ba4db916089 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 @@ -124,7 +124,12 @@ - (void)signInSilentlyWithCompletion:(nonnull void (^)(FSIUserData *_Nullable, FlutterError *_Nullable))completion { [self.signIn restorePreviousSignInWithCompletion:^(GIDGoogleUser *_Nullable user, NSError *_Nullable error) { - [self didSignInForUser:user withServerAuthCode:nil completion:completion error:error]; + if (user != nil) { + [self didSignInForUser:user withServerAuthCode:nil completion:completion]; + } else { + // Forward all errors and let Dart side decide how to handle. + completion(nil, getFlutterError(error)); + } }]; } @@ -152,17 +157,14 @@ - (void)signInWithCompletion:(nonnull void (^)(FSIUserData *_Nullable, [self signInWithHint:nil additionalScopes:self.requestedScopes.allObjects completion:^(GIDSignInResult *_Nullable signInResult, NSError *_Nullable error) { - GIDGoogleUser *user; - NSString *serverAuthCode; if (signInResult) { - user = signInResult.user; - serverAuthCode = signInResult.serverAuthCode; + [self didSignInForUser:signInResult.user + withServerAuthCode:signInResult.serverAuthCode + completion:completion]; + } else { + // Forward all errors and let Dart side decide how to handle. + completion(nil, getFlutterError(error)); } - - [self didSignInForUser:user - withServerAuthCode:serverAuthCode - completion:completion - error:error]; }]; } @catch (NSException *e) { completion(nil, [FlutterError errorWithCode:@"google_sign_in" message:e.reason details:e.name]); @@ -291,30 +293,21 @@ - (GIDConfiguration *)configurationWithClientIdentifier:(NSString *)runtimeClien - (void)didSignInForUser:(GIDGoogleUser *)user withServerAuthCode:(NSString *_Nullable)serverAuthCode - completion:(nonnull void (^)(FSIUserData *_Nullable, - FlutterError *_Nullable))completion - error:(NSError *)error { - if (error != nil) { - // Forward all errors and let Dart side decide how to handle. - completion(nil, getFlutterError(error)); - } else { - NSURL *photoUrl; - if (user.profile.hasImage) { - // Placeholder that will be replaced by on the Dart side based on screen size. - photoUrl = [user.profile imageURLWithDimension:1337]; - } - NSString *idToken; - if (user.idToken) { - idToken = user.idToken.tokenString; - } - completion([FSIUserData makeWithDisplayName:user.profile.name - email:user.profile.email - userId:user.userID - photoUrl:[photoUrl absoluteString] - serverAuthCode:serverAuthCode - idToken:idToken], - nil); + completion: + (nonnull void (^)(FSIUserData *_Nullable, FlutterError *_Nullable))completion { + NSURL *photoUrl; + if (user.profile.hasImage) { + // Placeholder that will be replaced by on the Dart side based on screen size. + photoUrl = [user.profile imageURLWithDimension:1337]; } + + completion([FSIUserData makeWithDisplayName:user.profile.name + email:user.profile.email + userId:user.userID + photoUrl:photoUrl.absoluteString + serverAuthCode:serverAuthCode + idToken:user.idToken.tokenString], + nil); } #if TARGET_OS_IOS 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 c86af4d3f0e0..2bdbc6eec3b7 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.6 +version: 5.7.7 environment: sdk: ^3.3.0