diff --git a/packages/google_sign_in/google_sign_in/CHANGELOG.md b/packages/google_sign_in/google_sign_in/CHANGELOG.md index 761ba0476eff..3a09cd6e4809 100644 --- a/packages/google_sign_in/google_sign_in/CHANGELOG.md +++ b/packages/google_sign_in/google_sign_in/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.5.3 + +* Prevent exceptions from crashing app on iOS. + ## 4.5.2 * Update package:e2e reference to use the local version in the flutter/plugins diff --git a/packages/google_sign_in/google_sign_in/ios/Classes/FLTGoogleSignInPlugin.m b/packages/google_sign_in/google_sign_in/ios/Classes/FLTGoogleSignInPlugin.m index f621d1e68312..90802035afd6 100644 --- a/packages/google_sign_in/google_sign_in/ios/Classes/FLTGoogleSignInPlugin.m +++ b/packages/google_sign_in/google_sign_in/ios/Classes/FLTGoogleSignInPlugin.m @@ -80,7 +80,9 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result [GIDSignIn sharedInstance].clientID = plist[kClientIdKey]; [GIDSignIn sharedInstance].serverClientID = plist[kServerClientIdKey]; [GIDSignIn sharedInstance].scopes = call.arguments[@"scopes"]; - [GIDSignIn sharedInstance].hostedDomain = call.arguments[@"hostedDomain"]; + NSString *hostedDomain = call.arguments[@"hostedDomain"]; + [GIDSignIn sharedInstance].hostedDomain = + hostedDomain != (id)[NSNull null] ? hostedDomain : @""; result(nil); } else { result([FlutterError errorWithCode:@"missing-config" @@ -102,7 +104,6 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result [[GIDSignIn sharedInstance] signIn]; } @catch (NSException *e) { result([FlutterError errorWithCode:@"google_sign_in" message:e.reason details:e.name]); - [e raise]; } } } else if ([call.method isEqualToString:@"getTokens"]) { @@ -240,9 +241,11 @@ - (void)signIn:(GIDSignIn *)signIn #pragma mark - private methods - (void)respondWithAccount:(id)account error:(NSError *)error { - FlutterResult result = _accountRequest; - _accountRequest = nil; - result(error != nil ? getFlutterError(error) : account); + dispatch_async(dispatch_get_main_queue(), ^{ + FlutterResult result = _accountRequest; + _accountRequest = nil; + result(error != nil ? getFlutterError(error) : account); + }); } - (UIViewController *)topViewController { diff --git a/packages/google_sign_in/google_sign_in/pubspec.yaml b/packages/google_sign_in/google_sign_in/pubspec.yaml index e76dbedfa116..e73b905b7b12 100644 --- a/packages/google_sign_in/google_sign_in/pubspec.yaml +++ b/packages/google_sign_in/google_sign_in/pubspec.yaml @@ -2,7 +2,7 @@ name: google_sign_in description: Flutter plugin for Google Sign-In, a secure authentication system for signing in with a Google account on Android and iOS. homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in/google_sign_in -version: 4.5.2 +version: 4.5.3 flutter: plugin: