Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
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/google_sign_in/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.1.2

* Added a new error code `network_error`, and return it when a network error occurred.

## 4.1.1

* Support passing `clientId` to the web plugin programmatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public static final class Delegate implements IDelegate, PluginRegistry.Activity
// These error codes must match with ones declared on iOS and Dart sides.
private static final String ERROR_REASON_SIGN_IN_CANCELED = "sign_in_canceled";
private static final String ERROR_REASON_SIGN_IN_REQUIRED = "sign_in_required";
private static final String ERROR_REASON_NETWORK_ERROR = "network_error";
private static final String ERROR_REASON_SIGN_IN_FAILED = "sign_in_failed";
private static final String ERROR_FAILURE_TO_RECOVER_AUTH = "failed_to_recover_auth";
private static final String ERROR_USER_RECOVERABLE_AUTH = "user_recoverable_auth";
Expand Down Expand Up @@ -372,6 +373,8 @@ private String errorCodeForStatus(int statusCode) {
return ERROR_REASON_SIGN_IN_CANCELED;
} else if (statusCode == CommonStatusCodes.SIGN_IN_REQUIRED) {
return ERROR_REASON_SIGN_IN_REQUIRED;
} else if (statusCode == CommonStatusCodes.NETWORK_ERROR) {
return ERROR_REASON_NETWORK_ERROR;
} else {
return ERROR_REASON_SIGN_IN_FAILED;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// These error codes must match with ones declared on Android and Dart sides.
static NSString *const kErrorReasonSignInRequired = @"sign_in_required";
static NSString *const kErrorReasonSignInCanceled = @"sign_in_canceled";
static NSString *const kErrorReasonNetworkError = @"network_error";
static NSString *const kErrorReasonSignInFailed = @"sign_in_failed";

static FlutterError *getFlutterError(NSError *error) {
Expand All @@ -21,6 +22,8 @@
errorCode = kErrorReasonSignInRequired;
} else if (error.code == kGIDSignInErrorCodeCanceled) {
errorCode = kErrorReasonSignInCanceled;
} else if ([error.domain isEqualToString:NSURLErrorDomain]) {
errorCode = kErrorReasonNetworkError;
} else {
errorCode = kErrorReasonSignInFailed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ class GoogleSignIn {
/// user.
static const String kSignInCanceledError = 'sign_in_canceled';

/// Error code indicating network error. Retrying should resolve the problem.
static const String kNetworkError = 'network_error';

/// Error code indicating that attempt to sign in failed.
static const String kSignInFailedError = 'sign_in_failed';

Expand Down Expand Up @@ -314,8 +317,9 @@ class GoogleSignIn {
///
/// When [suppressErrors] is set to `false` and an error occurred during sign in
/// returned Future completes with [PlatformException] whose `code` can be
/// either [kSignInRequiredError] (when there is no authenticated user) or
/// [kSignInFailedError] (when an unknown error occurred).
/// one of [kSignInRequiredError] (when there is no authenticated user) ,
/// [kNetworkError] (when a network error occurred) or [kSignInFailedError]
/// (when an unknown error occurred).
Future<GoogleSignInAccount> signInSilently({
bool suppressErrors = true,
}) async {
Expand Down
2 changes: 1 addition & 1 deletion packages/google_sign_in/google_sign_in/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.1.1
version: 4.1.2

flutter:
plugin:
Expand Down