Skip to content

Don't show hard-to-use IDPs for Smart Lock sign-in #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.EmailAuthProvider;
import com.google.firebase.auth.FacebookAuthProvider;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.FirebaseAuthInvalidUserException;
import com.google.firebase.auth.GoogleAuthProvider;
import com.google.firebase.auth.PhoneAuthProvider;
import com.google.firebase.auth.TwitterAuthProvider;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -111,7 +109,7 @@ public void onCreate(Bundle savedInstance) {
supportPasswords = true;
}
}
List<String> accountTypes = getSupportedAccountTypes();
List<String> accountTypes = getCredentialAccountTypes();

// If the request will be empty, avoid the step entirely
boolean willRequestCredentials = supportPasswords || accountTypes.size() > 0;
Expand Down Expand Up @@ -220,13 +218,11 @@ public void finish(int resultCode, Intent resultIntent) {
}
}

private List<String> getSupportedAccountTypes() {
private List<String> getCredentialAccountTypes() {
List<String> accounts = new ArrayList<>();
for (AuthUI.IdpConfig idpConfig : getFlowParams().providerInfo) {
@AuthUI.SupportedProvider String providerId = idpConfig.getProviderId();
if (providerId.equals(GoogleAuthProvider.PROVIDER_ID)
|| providerId.equals(FacebookAuthProvider.PROVIDER_ID)
|| providerId.equals(TwitterAuthProvider.PROVIDER_ID)) {
if (providerId.equals(GoogleAuthProvider.PROVIDER_ID)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we change the name of this method to be "getCredentialAccountTypes" or something that implies it has to do with SmartLock?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

accounts.add(ProviderUtils.providerIdToAccountType(providerId));
}
}
Expand Down