Skip to content

Commit 982f204

Browse files
diedu89samtstern
authored andcommitted
Avoid error when canceling google signin (#1443)
1 parent 43912a7 commit 982f204

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

auth/src/main/java/com/firebase/ui/auth/data/remote/GoogleSignInHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import com.firebase.ui.auth.data.model.IntentRequiredException;
1616
import com.firebase.ui.auth.data.model.Resource;
1717
import com.firebase.ui.auth.data.model.User;
18+
import com.firebase.ui.auth.data.model.UserCancellationException;
1819
import com.firebase.ui.auth.ui.HelperActivityBase;
1920
import com.firebase.ui.auth.util.ExtraConstants;
2021
import com.firebase.ui.auth.viewmodel.ProviderSignInBase;
@@ -96,7 +97,10 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d
9697
// Hack for https://github.com/googlesamples/google-services/issues/345
9798
// Google remembers the account so the picker doesn't appear twice for the user.
9899
start();
99-
} else {
100+
}else if(e.getStatusCode() == GoogleSignInStatusCodes.SIGN_IN_CANCELLED){
101+
setResult(Resource.<IdpResponse>forFailure(new UserCancellationException()));
102+
}
103+
else {
100104
if (e.getStatusCode() == CommonStatusCodes.DEVELOPER_ERROR) {
101105
Log.w(TAG, "Developer error: this application is misconfigured. " +
102106
"Check your SHA1 and package name in the Firebase console.");

buildSrc/src/main/kotlin/Config.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ object Config {
6262
const val auth = "com.google.android.gms:play-services-auth:16.0.0"
6363
}
6464

65+
6566
object Provider {
6667
const val facebook = "com.facebook.android:facebook-login:4.35.0"
6768
// WARNING: the Twitter requires Java 8 support. Therefore, the dep cannot be upgraded

0 commit comments

Comments
 (0)