use of com.firebase.ui.auth.AuthMethodPickerLayout in project FirebaseUI-Android by firebase.
the class AuthUiActivity method getSignInIntent.
private Intent getSignInIntent(@Nullable String link) {
AuthUI.SignInIntentBuilder builder = getAuthUI().createSignInIntentBuilder().setTheme(getSelectedTheme()).setLogo(getSelectedLogo()).setAvailableProviders(getSelectedProviders()).setIsSmartLockEnabled(mBinding.credentialSelectorEnabled.isChecked(), mBinding.hintSelectorEnabled.isChecked());
if (mBinding.customLayout.isChecked()) {
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout.Builder(R.layout.auth_method_picker_custom_layout).setGoogleButtonId(R.id.custom_google_signin_button).setEmailButtonId(R.id.custom_email_signin_clickable_text).setTosAndPrivacyPolicyId(R.id.custom_tos_pp).build();
builder.setTheme(R.style.CustomTheme);
builder.setAuthMethodPickerLayout(customLayout);
}
if (getSelectedTosUrl() != null && getSelectedPrivacyPolicyUrl() != null) {
builder.setTosAndPrivacyPolicyUrls(getSelectedTosUrl(), getSelectedPrivacyPolicyUrl());
}
if (link != null) {
builder.setEmailLink(link);
}
FirebaseAuth auth = FirebaseAuth.getInstance();
if (auth.getCurrentUser() != null && auth.getCurrentUser().isAnonymous()) {
builder.enableAnonymousUsersAutoUpgrade();
}
return builder.build();
}
use of com.firebase.ui.auth.AuthMethodPickerLayout in project FirebaseUI-Android by firebase.
the class AuthMethodPickerActivityTest method testCustomAuthMethodPickerLayout.
@Test
public void testCustomAuthMethodPickerLayout() {
List<String> providers = Arrays.asList(EmailAuthProvider.PROVIDER_ID);
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout.Builder(R.layout.fui_provider_button_email).setEmailButtonId(R.id.email_button).build();
AuthMethodPickerActivity authMethodPickerActivity = createActivityWithCustomLayout(providers, customLayout, false);
Button emailButton = authMethodPickerActivity.findViewById(R.id.email_button);
emailButton.performClick();
// Expected result -> Directing users to EmailActivity
ShadowActivity.IntentForResult nextIntent = Shadows.shadowOf(authMethodPickerActivity).getNextStartedActivityForResult();
assertEquals(EmailActivity.class.getName(), nextIntent.intent.getComponent().getClassName());
}
use of com.firebase.ui.auth.AuthMethodPickerLayout in project FirebaseUI-Android by firebase.
the class AuthMethodPickerActivityTest method testCustomAuthMethodPickerLayoutWithDefaultEmail.
@Test
public void testCustomAuthMethodPickerLayoutWithDefaultEmail() {
List<String> providers = Arrays.asList(EmailAuthProvider.PROVIDER_ID);
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout.Builder(R.layout.fui_provider_button_email).setEmailButtonId(R.id.email_button).build();
AuthMethodPickerActivity authMethodPickerActivity = createActivityWithCustomLayout(providers, customLayout, true);
Button emailButton = authMethodPickerActivity.findViewById(R.id.email_button);
emailButton.performClick();
// Expected result -> Directing users to EmailActivity
ShadowActivity.IntentForResult nextIntent = Shadows.shadowOf(authMethodPickerActivity).getNextStartedActivityForResult();
assertEquals(EmailActivity.class.getName(), nextIntent.intent.getComponent().getClassName());
}
use of com.firebase.ui.auth.AuthMethodPickerLayout in project FirebaseUI-Android by firebase.
the class AuthMethodPickerActivityTest method testCustomAuthMethodPickerLayoutWithEmailLink.
@Test
public void testCustomAuthMethodPickerLayoutWithEmailLink() {
List<String> providers = Arrays.asList(EmailAuthProvider.EMAIL_LINK_SIGN_IN_METHOD);
AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout.Builder(R.layout.fui_provider_button_email).setEmailButtonId(R.id.email_button).build();
AuthMethodPickerActivity authMethodPickerActivity = createActivityWithCustomLayout(providers, customLayout, false);
Button emailButton = authMethodPickerActivity.findViewById(R.id.email_button);
emailButton.performClick();
// Expected result -> Directing users to EmailActivity
ShadowActivity.IntentForResult nextIntent = Shadows.shadowOf(authMethodPickerActivity).getNextStartedActivityForResult();
assertEquals(EmailActivity.class.getName(), nextIntent.intent.getComponent().getClassName());
}
Aggregations