use of com.firebase.ui.auth.util.GoogleApiClientTaskHelper in project FirebaseUI-Android by firebase.
the class AuthUI method delete.
/**
* Delete the use from FirebaseAuth and delete any associated credentials from the Credentials
* API. Returns a {@code Task} that succeeds if the Firebase Auth user deletion succeeds and
* fails if the Firebase Auth deletion fails. Credentials deletion failures are handled
* silently.
*
* @param activity the calling {@link Activity}.
* @deprecated use {@link #delete(FragmentActivity)} instead
*/
@Deprecated
public Task<Void> delete(@NonNull Activity activity) {
// Initialize SmartLock helper
GoogleApiClientTaskHelper gacHelper = GoogleApiClientTaskHelper.getInstance(activity);
gacHelper.getBuilder().addApi(Auth.CREDENTIALS_API);
CredentialTaskApi credentialHelper = CredentialsApiHelper.getInstance(gacHelper);
return getDeleteTask(credentialHelper);
}
use of com.firebase.ui.auth.util.GoogleApiClientTaskHelper in project FirebaseUI-Android by firebase.
the class AuthUI method signOut.
/**
* Signs the current user out, if one is signed in.
*
* @param activity The activity requesting the user be signed out.
* @return a task which, upon completion, signals that the user has been signed out ({@code
* result.isSuccess()}, or that the sign-out attempt failed unexpectedly ({@code
* !result.isSuccess()}).
* @deprecated use {@link #signOut(FragmentActivity)} instead
*/
@Deprecated
public Task<Void> signOut(@NonNull Activity activity) {
// Get helper for Google Sign In and Credentials API
GoogleApiClientTaskHelper taskHelper = GoogleApiClientTaskHelper.getInstance(activity);
taskHelper.getBuilder().addApi(Auth.CREDENTIALS_API).addApi(Auth.GOOGLE_SIGN_IN_API, GoogleSignInOptions.DEFAULT_SIGN_IN);
// Get Credentials Helper
CredentialTaskApi credentialsHelper = CredentialsApiHelper.getInstance(taskHelper);
// Firebase Sign out
mAuth.signOut();
// Disable credentials auto sign-in
Task<Status> disableCredentialsTask = credentialsHelper.disableAutoSignIn();
// Google sign out
Task<Void> googleSignOutTask = taskHelper.getConnectedGoogleApiClient().continueWith(new Continuation<GoogleApiClient, Void>() {
@Override
public Void then(@NonNull Task<GoogleApiClient> task) throws Exception {
if (task.isSuccessful()) {
Auth.GoogleSignInApi.signOut(task.getResult());
}
return null;
}
});
// Facebook sign out
LoginManager.getInstance().logOut();
// Wait for all tasks to complete
return Tasks.whenAll(disableCredentialsTask, googleSignOutTask);
}
Aggregations