-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Refactor email flow into fragments #447
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
Refactor email flow into fragments #447
Conversation
Change-Id: Ibaf6e4fc280438c2d35f3d425370143d2c4e09db
@SUPERCILEX I'd like your thoughts on this. In a way it's a step backwards since what you did had less screens, but as I played around with things more I kept getting hung up on how the register screen would just jump to something else after the email field lost focus. |
Also my tests pass locally ... can't figure out what Travis is angry about. |
@samtstern For the tests, I don't think this is related to Travis because I tried to run them on my machine and all of them failed: For the refactoring, what if we unified email sign in into a single |
Would that be a fundamentally different UX flow than the fragment swap? Or just avoiding the fragments? |
I just tried your refactor, and no, it doesn't look like mine is different UX wise. Having that extra step to register and preventing the user from changing their email once they are in the process of registering really perturbs me which is why I changed it in the first place, but I agree that sending the user to a new screen without any choice could be really frustrating. What if we showed an Alertdialog instead of sending them directly to the welcome back activity? It could be something like "You already have an account with this email" CONTINUE, CHANGE EMAIL. What do you think of that? I feel like it's the best of both worlds. |
I'll experiment with a dialog and see how that feels |
Sounds good! |
There's also the issue of presenting users who already have an account with the "create account" screen when they attempt to sign in. My personal reaction would be to click "back" since I'd assume I was on the wrong screen for an existing user. |
Oh, that didn't occur to me. In the end, I think we should proceed with your change: it keeps the performance improvements and reduces confusion. Authentication is hard! 😄 |
@SUPERCILEX yeah that didn't occur to me either when we were reviewing yours, sorry! I'll keep playing with the UI and see if I can make the transitions nice. And then I'll figure out what's going on with the tests |
Change-Id: I98c1a7b46b312738d8fc9d8ab1e5d5a14d1f7bce
Added some nice animations: So now the |
Oooh, that looks slick! |
@@ -33,7 +33,6 @@ | |||
|
|||
<activity | |||
android:name=".ui.email.RegisterEmailActivity" | |||
android:label="@string/title_register_email_activity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we replace this title with something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supplied by the fragments, but I'll add a default
|
||
/** | ||
* Activity displaying a form to create a new email/password account. | ||
* Activity to control the entire email sign up flow. Plays host to {@link CheckEmailFragment} | ||
* and {@link RegisterEmailFragment} and triggers {@link WelcomeBackPasswordPrompt}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and triggers {@link WelcomeBackPasswordPrompt} and {@link WelcomeBackIdpPrompt}
// If email is passed in, fill in the field and move down to the name field. | ||
String email = getArguments().getString(ExtraConstants.EXTRA_EMAIL); | ||
if (!TextUtils.isEmpty(email)) { | ||
mEmailEditText.setText(email); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have to lock the email field again? We didn't have to do this before because it would check to see if the user had an existing account on every focus change. Now it looks like the user can change the email without us knowing if they already have an account. Also, shouldn't this condition always be true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think we can leave the email field unlocked. Here's basically the worst thing the user could do, and it's not so bad:
- User enters
[email protected]
in the check email screen, gets sent to RegisterEmailFragment since it's a new account. - User then changes her mind and enters
[email protected]
, which is not a new account. - After entering name and password, the error message says "an account already exists" (thanks to your new error handling).
In that case the user will have to press back and try again, but since that's so unlikely I think it's ok to have a sub-optimal experience for those users, and now we have the editable email field (which you mentioned that you prefer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great! The user not being able to edit their email really bothered me so now that it's no longer the case... This change is going to be really cool especially with those animations! 👍
<!--<alpha--> | ||
<!--android:duration="@android:integer/config_mediumAnimTime"--> | ||
<!--android:fromAlpha="0.0"--> | ||
<!--android:toAlpha="1.0" />--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these aren't being used.
<!--<alpha--> | ||
<!--android:duration="@android:integer/config_mediumAnimTime"--> | ||
<!--android:fromAlpha="1.0"--> | ||
<!--android:toAlpha="0.0" />--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above.
@@ -14,23 +14,23 @@ | |||
is showing we use a relative layout to position them absolutely | |||
--> | |||
<android.support.design.widget.TextInputLayout | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:id="@+id/email_layout" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above, we could lock the email field from here: android:enabled="false"
.
if (!TextUtils.isEmpty(email)) { | ||
mEmailEditText.setText(email); | ||
validateAndProceed(); | ||
} if (mHelper.getFlowParams().smartLockEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably go on a new line.
Change-Id: I5fecad0d92466b727eea47b0ec03da876652b143
Change-Id: I0fc2e3773efff571236df288c72e250cf6f06803
I cannot for my life replicate the issues Travis CI is having with Robolectric ... |
Related: |
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
Ok... @samtstern So it does have something to do with the manifest hack. I have a successful build here where I commented out the manifest stuff: https://travis-ci.org/SUPERCILEX/FirebaseUI-Android/builds/182411811. |
Ok that is very good to know! I will hunt based on that |
f2d7157
to
57ee6c2
Compare
Ok undid the manifest hack ... I actually don't need it anymore. I did need it when I was trying to test the Fragments directly and I figured it couldn't hurt but apparently it can hurt haha. |
Haha yeah. 😄 It looks like you set |
Change-Id: Icb240b86747841dd6ac885ce79b31a9fcf382756
Fixed! 😄 |
@amandle PTAL. Like I said above I know it's large (in diff) so we can meet about this if you're not sure what's going on/ |
@samtstern STOPSHIP!!! I was working on a some features for your refactor and noticed that screen rotation is completely broken. Rotating the screen cancels the |
@samtstern I created samtstern#4 to address a slew of bugs: |
e472748
to
18d06ae
Compare
Ok I am going to merge this into the If this lingers any longer it will get even more out of hand and also prevent any additional work. |
Thanks @samtstern! |
I was playing around with the new sign-in flow and the check email step felt very "jumpy" to me. You'd enter an email and could just get throw into some other screen without much chance to fix it. I think this is why the email screen was a separate step to begin with.
So I moved the email screen back to being its own step, but refactored things into Fragments so we keep all of the speed improvements implemented in the previous refactor. Now RegisterEmailActivity is a controller for a few different states, and each Fragment/Activity is doing less which I like.