use of com.google.android.gms.auth.api.credentials.Credential in project WordPress-Android by wordpress-mobile.
the class SignInActivity method onConnected.
@Override
public void onConnected(Bundle bundle) {
AppLog.d(T.NUX, "Google API client connected");
SignInFragment signInFragment = (SignInFragment) getSupportFragmentManager().findFragmentByTag(SignInFragment.TAG);
// empty).
if (signInFragment != null && signInFragment.canAutofillUsernameAndPassword()) {
mSmartLockHelper.smartLockAutoFill(new Callback() {
@Override
public void onCredentialRetrieved(Credential credential) {
SignInFragment signInFragment = (SignInFragment) getSupportFragmentManager().findFragmentByTag(SignInFragment.TAG);
if (signInFragment != null) {
signInFragment.onCredentialRetrieved(credential);
}
}
});
}
}
use of com.google.android.gms.auth.api.credentials.Credential in project FirebaseUI-Android by firebase.
the class AuthUI method getDeleteTask.
private Task<Void> getDeleteTask(CredentialTaskApi credentialHelper) {
FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
if (firebaseUser == null) {
// If the current user is null, return a failed task immediately
return Tasks.forException(new Exception("No currently signed in user."));
}
// Delete the Firebase user
Task<Void> deleteUserTask = firebaseUser.delete();
// Get all SmartLock credentials associated with the user
List<Credential> credentials = SmartLockBase.credentialsFromFirebaseUser(firebaseUser);
// For each Credential in the list, create a task to delete it.
List<Task<?>> credentialTasks = new ArrayList<>();
for (Credential credential : credentials) {
credentialTasks.add(credentialHelper.delete(credential));
}
// Create a combined task that will succeed when all credential delete operations
// have completed (even if they fail).
final Task<Void> combinedCredentialTask = Tasks.whenAll(credentialTasks);
// and return.
return deleteUserTask.continueWithTask(new Continuation<Void, Task<Void>>() {
@Override
public Task<Void> then(@NonNull Task<Void> task) throws Exception {
// Call getResult() to propagate failure by throwing an exception
// if there was one.
task.getResult(Exception.class);
// Return the combined credential task
return combinedCredentialTask;
}
});
}
Aggregations