|
17 | 17 | import android.content.Context;
|
18 | 18 | import android.content.Intent;
|
19 | 19 | import android.os.Bundle;
|
| 20 | +import android.os.CancellationSignal; |
20 | 21 | import android.os.Parcel;
|
21 | 22 | import android.os.Parcelable;
|
22 | 23 | import android.text.TextUtils;
|
|
32 | 33 | import com.firebase.ui.auth.util.data.PhoneNumberUtils;
|
33 | 34 | import com.firebase.ui.auth.util.data.ProviderAvailability;
|
34 | 35 | import com.firebase.ui.auth.util.data.ProviderUtils;
|
| 36 | +import com.google.android.gms.auth.api.identity.Identity; |
35 | 37 | import com.google.android.gms.auth.api.signin.GoogleSignIn;
|
36 | 38 | import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
37 | 39 | import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
|
68 | 70 | import java.util.Locale;
|
69 | 71 | import java.util.Map;
|
70 | 72 | import java.util.Set;
|
| 73 | +import java.util.concurrent.Executors; |
71 | 74 |
|
72 | 75 | import androidx.annotation.CallSuper;
|
73 | 76 | import androidx.annotation.DrawableRes;
|
|
76 | 79 | import androidx.annotation.RestrictTo;
|
77 | 80 | import androidx.annotation.StringDef;
|
78 | 81 | import androidx.annotation.StyleRes;
|
| 82 | +import androidx.credentials.ClearCredentialStateRequest; |
| 83 | +import androidx.credentials.CredentialManagerCallback; |
| 84 | +import androidx.credentials.exceptions.ClearCredentialException; |
79 | 85 |
|
80 | 86 | /**
|
81 | 87 | * The entry point to the AuthUI authentication flow, and related utility methods. If your
|
@@ -281,6 +287,26 @@ public Task<Void> signOut(@NonNull Context context) {
|
281 | 287 | Log.w(TAG, "Google Play services not available during signOut");
|
282 | 288 | }
|
283 | 289 |
|
| 290 | + // TODO(thatfiredev): add this logic to delete() too |
| 291 | + ClearCredentialStateRequest clearRequest = new ClearCredentialStateRequest(); |
| 292 | + GoogleApiUtils.getCredentialManager(context) |
| 293 | + .clearCredentialStateAsync( |
| 294 | + clearRequest, |
| 295 | + new CancellationSignal(), |
| 296 | + Executors.newSingleThreadExecutor(), |
| 297 | + new CredentialManagerCallback<>() { |
| 298 | + @Override |
| 299 | + public void onResult(Void unused) { |
| 300 | + |
| 301 | + } |
| 302 | + |
| 303 | + @Override |
| 304 | + public void onError(@NonNull ClearCredentialException e) { |
| 305 | + |
| 306 | + } |
| 307 | + } |
| 308 | + ); |
| 309 | + |
284 | 310 | return signOutIdps(context).continueWith(task -> {
|
285 | 311 | task.getResult(); // Propagate exceptions if any.
|
286 | 312 | mAuth.signOut();
|
@@ -342,11 +368,8 @@ private Task<Void> signOutIdps(@NonNull Context context) {
|
342 | 368 | if (ProviderAvailability.IS_FACEBOOK_AVAILABLE) {
|
343 | 369 | LoginManager.getInstance().logOut();
|
344 | 370 | }
|
345 |
| - if (GoogleApiUtils.isPlayServicesAvailable(context)) { |
346 |
| - return GoogleSignIn.getClient(context, GoogleSignInOptions.DEFAULT_SIGN_IN).signOut(); |
347 |
| - } else { |
348 |
| - return Tasks.forResult((Void) null); |
349 |
| - } |
| 371 | + // TODO(thatfiredev): This doesn't need to be a Task anymore |
| 372 | + return Tasks.forResult((Void) null); |
350 | 373 | }
|
351 | 374 |
|
352 | 375 | /**
|
|
0 commit comments