Issue/10930 email address error is preserved on rotation#11003
Issue/10930 email address error is preserved on rotation#11003FernandaCG wants to merge 4 commits intowordpress-mobile:developfrom
Conversation
Generated by 🚫 dangerJS |
|
Hi @FernandaCG the changes look good! I tested it and it works! However, due to the nature of these changes, they have to be pushed to the subtree project as stated in the comment above by |
libs/login/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java
Outdated
Show resolved
Hide resolved
libs/login/WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginEmailFragment.java
Outdated
Show resolved
Hide resolved
| private String mGoogleEmail; | ||
| private String mRequestedEmail; | ||
| private boolean mIsSocialLogin; | ||
| private boolean mIsValidEmail = true; |
There was a problem hiding this comment.
Why set the email as true since you won't know if it is valid until it's checked. I think it's better to leave the default value of false.
|
Hi @jd-alexander! I followed the instructions of peril-wordpress-mobile but when I execute the git subtree push command, I receive a 403 error. |
|
@FernandaCG Thanks! I just realized I will have to do it. I will do another review of your changes later today! Thank you so much for your patience 😄 |
jd-alexander
left a comment
There was a problem hiding this comment.
Thanks again @FernandaCG Once these final changes are done I will create the PR in the subtree project and get this merged in!
| } | ||
|
|
||
| private void showErrorIfEmailInvalid() { | ||
| if (!mIsValidEmail && mEmailInput.getEditText().getText().length() > 0) { |
There was a problem hiding this comment.
Hi @FernandaCG Did you check the length of the EditText so that the warning doesn't get shown when the activity is loaded? I tested this and that is the behavior I saw. Good job 😄 We can take this a bit further though and utilize the Boolean object wrapper so that the initial value can be null before the email validation is done because if you click next and it shows the warning and you rotate the screen the warning disappears and we don't want that to happen 😄
There was a problem hiding this comment.
I'm not so sure how to do that. I try validating the mEmailInput.getEditText().getText() == null or setting the mEmailInput to null, but not works.
I need some help 😄
There was a problem hiding this comment.
Oh I meant to just change the private boolean mIsValidEmail = false; to private Boolean mIsValidEmail;so now you can check if it's null before showing the error. Makes sense? Let me know.
There was a problem hiding this comment.
I understand, thank you for your help.
I just commit my changes
| private String mGoogleEmail; | ||
| private String mRequestedEmail; | ||
| private boolean mIsSocialLogin; | ||
| private boolean mIsValidEmail = false; |
There was a problem hiding this comment.
The default value of a boolean is already false so you don't have to specify 😄
|
@FernandaCG Hi, are you still going to be working on this? Let me know. Thanks 😄 |
|
Hi! Yes, I'm still working on that 😄 |
| mIsSocialLogin = savedInstanceState.getBoolean(KEY_IS_SOCIAL); | ||
| mIsDisplayingEmailHints = savedInstanceState.getBoolean(KEY_IS_DISPLAYING_EMAIL_HINTS); | ||
| mHasDismissedEmailHints = savedInstanceState.getBoolean(KEY_HAS_DISMISSED_EMAIL_HINTS); | ||
| if (savedInstanceState.getBoolean(VALIDITY_EMAIL) || !(savedInstanceState |
There was a problem hiding this comment.
Hi again! I don't think this if statement is needed. Similar to Boolean values above you can just grab the value and that will take care of it 😄 because if it's true or false then it will be set and if no value is detected it will be null.
So just having this line below works.
mIsValidEmail = savedInstanceState.getBoolean(VALIDITY_EMAIL);
There was a problem hiding this comment.
Hi! Thanks for the changes 😄You are almost there. I have some suggestions that are tagged above and below!
Also, when testing, if the error is shown and then you modify the contents of the EditText it's cleared so you shouldn't see it when the app gets rotated anymore. So you can clear the mIsValidEmail here
| outState.putBoolean(KEY_IS_DISPLAYING_EMAIL_HINTS, mIsDisplayingEmailHints); | ||
| outState.putBoolean(KEY_HAS_DISMISSED_EMAIL_HINTS, mHasDismissedEmailHints); | ||
| outState.putBoolean(VALIDITY_EMAIL, mIsValidEmail); | ||
| if (mIsValidEmail != null) { |
There was a problem hiding this comment.
You don't have to check if this is null, you can simply just put it similar to the others above 😄
There was a problem hiding this comment.
@jd-alexander Unfortunately that's not entirely correct, because it looks like mIsValidEmail is a Boolean and not a boolean. I think that created a bit of a confusion here.
@FernandaCG Could you update the mIsValidEmail's type to boolean and remove the null check here? You should be able to follow the example of mIsSocialLogin for the other parts as it should work similarly.
Let me know if either of you have any questions.
There was a problem hiding this comment.
Thanks @oguzkocer I just realized my mistake 🤦♂ Yes, since Boolean is the wrapper type so the check can be made. I was looking at the values above and got confused.
|
We're freezing |
|
We're freezing |
|
We're freezing @FernandaCG Could you follow up on this PR when you get a chance? |
|
This issue is targeting the current frozen milestone which is about to be released. I am bumping it to @jd-alexander It looks like @FernandaCG is not available to follow up on this PR, would you mind finishing it up instead? |
I don't mind at all. I will add it to my tasks. Thanks 🙏 |
Fixes #10930
Description:
When rotate the device, the email error is preserved now.
Testing instructions:
I also test it in an physical device.
PR submission checklist:
I have considered adding unit tests where possible.
I have considered if this change warrants user-facing release notes and have added them to
RELEASE-NOTES.txtif necessary.