File tree 2 files changed +30
-1
lines changed
app/src/main/java/com/firebase/uidemo/auth
auth/src/main/java/com/firebase/ui/auth
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 27
27
import android .support .v7 .app .AlertDialog ;
28
28
import android .support .v7 .app .AppCompatActivity ;
29
29
import android .text .TextUtils ;
30
+ import android .util .Log ;
30
31
import android .view .View ;
31
32
import android .widget .ImageView ;
32
33
import android .widget .TextView ;
56
57
57
58
public class SignedInActivity extends AppCompatActivity {
58
59
60
+ private static final String TAG = "SignedInActivity" ;
61
+
59
62
private static final String EXTRA_IDP_RESPONSE = "extra_idp_response" ;
60
63
private static final String EXTRA_SIGNED_IN_CONFIG = "extra_signed_in_config" ;
61
64
@@ -126,6 +129,7 @@ public void onComplete(@NonNull Task<Void> task) {
126
129
startActivity (AuthUiActivity .createIntent (SignedInActivity .this ));
127
130
finish ();
128
131
} else {
132
+ Log .w (TAG , "signOut:failure" , task .getException ());
129
133
showSnackbar (R .string .sign_out_failed );
130
134
}
131
135
}
Original file line number Diff line number Diff line change 81
81
* for examples on how to get started with FirebaseUI Auth.
82
82
*/
83
83
public class AuthUI {
84
+
85
+ private static final String TAG = "AuthUI" ;
86
+
84
87
@ StringDef ({
85
88
EmailAuthProvider .PROVIDER_ID ,
86
89
PhoneAuthProvider .PROVIDER_ID ,
@@ -268,9 +271,31 @@ public static int getDefaultTheme() {
268
271
@ NonNull
269
272
public Task <Void > signOut (@ NonNull Context context ) {
270
273
mAuth .signOut ();
274
+
275
+ Task <Void > maybeDisableAutoSignIn = GoogleApiUtils .getCredentialsClient (context )
276
+ .disableAutoSignIn ()
277
+ .continueWithTask (new Continuation <Void , Task <Void >>() {
278
+ @ Override
279
+ public Task <Void > then (@ NonNull Task <Void > task ) throws Exception {
280
+ // We want to ignore a specific exception, since it's not a good reason
281
+ // to fail (see Issue 1156).
282
+ if (!task .isSuccessful () && (task .getException () instanceof ApiException )) {
283
+ ApiException ae = (ApiException ) task .getException ();
284
+ if (ae .getStatusCode () == CommonStatusCodes .CANCELED ) {
285
+ Log .w (TAG , "Could not disable auto-sign in, maybe there are no " +
286
+ "SmartLock accounts available?" , ae );
287
+
288
+ return Tasks .forResult (null );
289
+ }
290
+ }
291
+
292
+ return task ;
293
+ }
294
+ });
295
+
271
296
return Tasks .whenAll (
272
297
signOutIdps (context ),
273
- GoogleApiUtils . getCredentialsClient ( context ). disableAutoSignIn () );
298
+ maybeDisableAutoSignIn );
274
299
}
275
300
276
301
/**
You can’t perform that action at this time.
0 commit comments