Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Expose exception on the signIn method in Google sign in. #1180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/google_sign_in/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.0+1

* Added a better error message for iOS when the app is missing necessary URL schemes.

## 4.0.0

* **Breaking change**. Migrate from the deprecated original Android Support
Expand Down
7 changes: 6 additions & 1 deletion packages/google_sign_in/ios/Classes/GoogleSignInPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
result(@([[GIDSignIn sharedInstance] hasAuthInKeychain]));
} else if ([call.method isEqualToString:@"signIn"]) {
if ([self setAccountRequest:result]) {
[[GIDSignIn sharedInstance] signIn];
@try {
[[GIDSignIn sharedInstance] signIn];
} @catch (NSException *e) {
result([FlutterError errorWithCode:@"google_sign_in" message:e.reason details:e.name]);
[e raise];
Copy link
Contributor Author

@cyanglaz cyanglaz Feb 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still Debating myself if we should fail more graciously that was requested by the customer in flutter/flutter#12734 or we should still crashing it to just have better error message to force user to fix it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing configuration is fatal. An app like this should never be released and there's no gracious failure for it. Raising FlutterError is the right way to go for this.

}
}
} else if ([call.method isEqualToString:@"getTokens"]) {
GIDGoogleUser *currentUser = [GIDSignIn sharedInstance].currentUser;
Expand Down
2 changes: 1 addition & 1 deletion packages/google_sign_in/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for Google Sign-In, a secure authentication system
for signing in with a Google account on Android and iOS.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/google_sign_in
version: 4.0.0
version: 4.0.0+1

flutter:
plugin:
Expand Down