Skip to content

Conversation

lsirac
Copy link
Contributor

@lsirac lsirac commented Oct 15, 2018

Most of email link sign in (phase 1, meaning the flow needs to be completed on the same device)

@lsirac lsirac requested a review from samtstern as a code owner October 15, 2018 18:47
@samtstern
Copy link
Contributor

@lsirac let me know when you want code review to start (even if it's just on some parts)

@lsirac
Copy link
Contributor Author

lsirac commented Oct 15, 2018

Things to look for:

  1. All UI stuff (seriously, I never really do any UI stuff, so there may be bugs)
  2. EmailLinkSignInHandler - here's where everything happens (signing in, linking, anonymous upgrade)
  3. EmailActivity - added some new fragments to this, just something to look at when I'm registering them
  4. When catching the link, we open a lot of activities e.g. AuthUI->KickOff->Catcher, etc, I don't see a way around that
  5. TroubleSigningInFragment - I made sure that we don't resend the emails on rotations, but maybe I missed something

Copy link
Contributor

@samtstern samtstern left a comment

Choose a reason for hiding this comment

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

First pass. Mostly small comments, whatever formatter you used is very strange and throwing me off / creating a lot of noise.

I did not look at layouts or tests yet.

Exception {
persistenceManager.clearAllData(getApplication());
if (!task.isSuccessful()) {
return Tasks.forResult(task.getResult(Exception.class));
Copy link
Contributor

Choose a reason for hiding this comment

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

If the task is not successful then calling getResult() will throw right? Shouldn't this be Tasks.forException(task.getException())? Maybe I am missing something,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but can't we just return the original task here anyway?

@samtstern
Copy link
Contributor

Some notes from playing around with this PR within the sample app:

  • The button says "sign in with email" but shouldn't it say "sign in with email link" or something to distinguish it?
  • When I tried to use email link sign in without the provider enabled in my FIrebase project, I saw the EmailLinkFragment very briefly flicker into existence which left me confused. I wonder if we're not waiting for the email sending to finish before showing that?
  • Once I did enable the provider but did no other config, I ran into "UNAUTHORIZED_DOMAIN:Domain not whitelisted by project" however that was only higher up in the logs. The error that bubbled up was com.firebase.ui.auth.data.model.UserCancellationException: Unknown error but I believe we should be sending back some sort of "developer error" message, not user cancellation.
  • This is more of a product issue, but I was surprised to get com.google.firebase.auth.FirebaseAuthException: Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions. [ FDL domain is not configured ]. We should probably do that for the developer!

In the end the flow does work (woot!) but there was a big flickering activity stack. I think you mentioned that in one of your self-review comments and I'll dig in and see if we can try to make that look nicer.

@samtstern
Copy link
Contributor

samtstern commented Oct 18, 2018

I was able to get a crash by doing the following:

  • Sign in with email link
  • Go back try to sign in with the same email, but with email+password
2018-10-18 09:46:08.085 25713-25713/com.firebase.uidemo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.firebase.uidemo, PID: 25713
    java.lang.IllegalStateException: User has no providers even though we got a collision.
        at com.firebase.ui.auth.viewmodel.email.EmailProviderResponseHandler$StartWelcomeBackFlow.onSuccess(EmailProviderResponseHandler.java:101)
        at com.firebase.ui.auth.viewmodel.email.EmailProviderResponseHandler$StartWelcomeBackFlow.onSuccess(EmailProviderResponseHandler.java:91)

Not sure if that's expected? I assume the other way around should work (password first, then link the next time) right?


Edit it does seem to work if I start with a password and then use a link.

@samtstern
Copy link
Contributor

Some UI feedback on the "trouble signing in" flow:

  • The "trouble signing in" link doesn't seem to show any sort of pressed/clicked state when I tap it, which seems janky. It's also styled differently than the ToS/PP links (no underline, different color) which makes me think it's not clickable. Maybe we should make it a borderless button?
  • There's no transition to the "Trouble getting email?" screen, which felt strange.
  • Hitting the back button at the "Trouble getting email" screen takes me back to the NASCAR screen rather than back to the "email sent" screen, which seems too harsh.

Copy link
Contributor

@samtstern samtstern left a comment

Choose a reason for hiding this comment

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

Some more very small comments. I think we're getting close to merge, any TODOs on your side?

public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
mProgressBar = view.findViewById(R.id.top_progress_bar);
mListener = (TroubleSigningInListener) getActivity();
getView().setVisibility(View.GONE);
Copy link
Contributor

Choose a reason for hiding this comment

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

So what goes it look like at this point? Blank screen?

@samtstern
Copy link
Contributor

@lsirac by the way:

com.firebase.ui.auth.viewmodel.EmailLinkEmailHandlerTest > testSendSignInLinkToEmail_expectSuccess FAILED
    org.mockito.exceptions.verification.TooManyActualInvocations at EmailLinkEmailHandlerTest.java:77
com.firebase.ui.auth.viewmodel.EmailLinkEmailHandlerTest > testSendSignInLinkToEmail_expectFailure FAILED
    org.mockito.exceptions.verification.TooManyActualInvocations at EmailLinkEmailHandlerTest.java:98

Copy link
Contributor

@samtstern samtstern left a comment

Choose a reason for hiding this comment

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

New progress bar looks great, 🚢 it!

@samtstern
Copy link
Contributor

(review assuming tests pass)

@samtstern samtstern changed the title [WIP] Email link sign in Email link sign in Oct 23, 2018
@lsirac
Copy link
Contributor Author

lsirac commented Oct 23, 2018

Some notes from playing around with this PR within the sample app:

  • The button says "sign in with email" but shouldn't it say "sign in with email link" or something to distinguish it?
  • When I tried to use email link sign in without the provider enabled in my FIrebase project, I saw the EmailLinkFragment very briefly flicker into existence which left me confused. I wonder if we're not waiting for the email sending to finish before showing that?
  • Once I did enable the provider but did no other config, I ran into "UNAUTHORIZED_DOMAIN:Domain not whitelisted by project" however that was only higher up in the logs. The error that bubbled up was com.firebase.ui.auth.data.model.UserCancellationException: Unknown error but I believe we should be sending back some sort of "developer error" message, not user cancellation.
  • This is more of a product issue, but I was surprised to get com.google.firebase.auth.FirebaseAuthException: Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions. [ FDL domain is not configured ]. We should probably do that for the developer!

In the end the flow does work (woot!) but there was a big flickering activity stack. I think you mentioned that in one of your self-review comments and I'll dig in and see if we can try to make that look nicer.

Thanks Sam!

To quickly respond:

  1. From the DD, looks like we're keeping the same button
  2. This should be fixed now
  3. This should also be fixed

@lsirac lsirac closed this Oct 23, 2018
@lsirac lsirac reopened this Oct 23, 2018
@lsirac lsirac changed the title Email link sign in Email link sign in (Phase 1) Oct 24, 2018
@lsirac
Copy link
Contributor Author

lsirac commented Oct 24, 2018

Done. 👍

@lsirac
Copy link
Contributor Author

lsirac commented Oct 24, 2018

I will add the documentation in a separate PR

@samtstern samtstern added this to the 4.3.0 milestone Oct 24, 2018
@samtstern samtstern merged commit 150f1fa into version-4.3.0-dev Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants