File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
main/java/com/firebase/ui/auth/ui/idp
test/java/com/firebase/ui/auth/ui/idp Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,8 @@ private void populateIdpList(List<IdpConfig> providerConfigs) {
206206 private void populateIdpListCustomLayout (List <IdpConfig > providerConfigs ) {
207207 Map <String , Integer > providerButtonIds = customLayout .getProvidersButton ();
208208 for (IdpConfig idpConfig : providerConfigs ) {
209- final String providerId = idpConfig .getProviderId ();
209+ final String providerId = providerOrEmailLinkProvider (idpConfig .getProviderId ());
210+
210211 if (!providerButtonIds .containsKey (providerId )) {
211212 throw new IllegalStateException ("No button found for auth provider: " + providerId );
212213 }
@@ -217,6 +218,15 @@ private void populateIdpListCustomLayout(List<IdpConfig> providerConfigs) {
217218 }
218219 }
219220
221+ @ NonNull
222+ private String providerOrEmailLinkProvider (@ NonNull String providerId ) {
223+ if (providerId .equals (EmailAuthProvider .EMAIL_LINK_SIGN_IN_METHOD )) {
224+ return EmailAuthProvider .PROVIDER_ID ;
225+ }
226+
227+ return providerId ;
228+ }
229+
220230 private void handleSignInOperation (IdpConfig idpConfig , View view ) {
221231 ViewModelProvider supplier = ViewModelProviders .of (this );
222232 final String providerId = idpConfig .getProviderId ();
Original file line number Diff line number Diff line change @@ -122,6 +122,28 @@ public void testCustomAuthMethodPickerLayout() {
122122 nextIntent .intent .getComponent ().getClassName ());
123123 }
124124
125+ @ Test
126+ public void testCustomAuthMethodPickerLayoutWithEmailLink () {
127+ List <String > providers = Arrays .asList (EmailAuthProvider .EMAIL_LINK_SIGN_IN_METHOD );
128+
129+ AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout
130+ .Builder (R .layout .fui_provider_button_email )
131+ .setEmailButtonId (R .id .email_button )
132+ .build ();
133+
134+ AuthMethodPickerActivity authMethodPickerActivity = createActivityWithCustomLayout (providers , customLayout );
135+
136+ Button emailButton = authMethodPickerActivity .findViewById (R .id .email_button );
137+ emailButton .performClick ();
138+
139+ //Expected result -> Directing users to EmailActivity
140+ ShadowActivity .IntentForResult nextIntent =
141+ Shadows .shadowOf (authMethodPickerActivity ).getNextStartedActivityForResult ();
142+ assertEquals (
143+ EmailActivity .class .getName (),
144+ nextIntent .intent .getComponent ().getClassName ());
145+ }
146+
125147 private AuthMethodPickerActivity createActivityWithCustomLayout (List <String > providers ,
126148 AuthMethodPickerLayout layout ) {
127149 Intent startIntent = AuthMethodPickerActivity .createIntent (
You can’t perform that action at this time.
0 commit comments