Skip to content

Issue/10930 email address error is preserved on rotation#11003

Closed
FernandaCG wants to merge 4 commits intowordpress-mobile:developfrom
FernandaCG:fix/10930-email-error-dissapears-on-rotation
Closed

Issue/10930 email address error is preserved on rotation#11003
FernandaCG wants to merge 4 commits intowordpress-mobile:developfrom
FernandaCG:fix/10930-email-error-dissapears-on-rotation

Conversation

@FernandaCG
Copy link
Copy Markdown
Contributor

@FernandaCG FernandaCG commented Dec 20, 2019

Fixes #10930

Description:
When rotate the device, the email error is preserved now.

Testing instructions:

  1. Press Log In
  2. Enter Email address and press Next. An error message will be shown
  3. Rotate the screen.

test (1)

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.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Dec 20, 2019

Messages
📖

This PR contains changes in the subtree libs/login/. It is your responsibility to ensure these changes are merged back into wordpress-mobile/WordPress-Login-Flow-Android. Follow these handy steps!
WARNING: Make sure your git version is 2.19.x or lower - there is currently a bug in later versions that will corrupt the subtree history!

  1. cd WordPress-Android
  2. git checkout fix/10930-email-error-dissapears-on-rotation
  3. git subtree push --prefix=libs/login/ https://github.com/wordpress-mobile/WordPress-Login-Flow-Android.git merge/WordPress-Android/11003
  4. Browse to https://github.com/wordpress-mobile/WordPress-Login-Flow-Android/pull/new/merge/WordPress-Android/11003 and open a new PR.

Generated by 🚫 dangerJS

@jd-alexander
Copy link
Copy Markdown
Contributor

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 peril-wordpress-mobile bot. So once you follow those instructions, your changes will be merged. Let me know if you need any help!

private String mGoogleEmail;
private String mRequestedEmail;
private boolean mIsSocialLogin;
private boolean mIsValidEmail = true;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@FernandaCG
Copy link
Copy Markdown
Contributor Author

FernandaCG commented Jan 6, 2020

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.

@jd-alexander
Copy link
Copy Markdown
Contributor

@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 😄

Copy link
Copy Markdown
Contributor

@jd-alexander jd-alexander left a comment

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The default value of a boolean is already false so you don't have to specify 😄

@jkmassel jkmassel modified the milestones: 14.0, 14.1 Jan 14, 2020
@jd-alexander
Copy link
Copy Markdown
Contributor

@FernandaCG Hi, are you still going to be working on this? Let me know. Thanks 😄

@FernandaCG
Copy link
Copy Markdown
Contributor Author

Hi! Yes, I'm still working on that 😄

@maxme maxme modified the milestones: 14.1, 14.2 Jan 27, 2020
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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);

Copy link
Copy Markdown
Contributor

@jd-alexander jd-alexander left a comment

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You don't have to check if this is null, you can simply just put it similar to the others above 😄

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@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.

Copy link
Copy Markdown
Contributor

@jd-alexander jd-alexander Feb 21, 2020

Choose a reason for hiding this comment

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

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.

@jkmassel
Copy link
Copy Markdown
Contributor

We're freezing 14.2 today, so this PR is being bumped to 14.3. If you'd like it to ship with 14.2, please merge it into release/14.2 and ping me – I'll be happy to cut a new beta release.

@jkmassel jkmassel modified the milestones: 14.2, 14.3 Feb 10, 2020
@oguzkocer
Copy link
Copy Markdown
Contributor

We're freezing 14.3 today, so this PR is being bumped to 14.4. If you'd like it to ship with 14.3, please merge it into release/14.3 and ping me – I'll be happy to cut a new beta release.

@oguzkocer oguzkocer removed this from the 14.3 ❄️ milestone Feb 24, 2020
@oguzkocer oguzkocer added this to the 14.4 milestone Feb 24, 2020
@oguzkocer
Copy link
Copy Markdown
Contributor

We're freezing 14.4 today, so this PR is being bumped to 14.5. If you'd like it to ship with 14.4, please merge it into release/14.4 and ping me – I'll be happy to cut a new beta release.


@FernandaCG Could you follow up on this PR when you get a chance?

@oguzkocer oguzkocer modified the milestones: 14.4, 14.5 Mar 9, 2020
@oguzkocer
Copy link
Copy Markdown
Contributor

This issue is targeting the current frozen milestone which is about to be released. I am bumping it to 14.6 which is when a PR that lands to develop in the next 2 weeks will be released. If it's more urgent than that, please make sure to target release/14.5 branch which will be available later today and update the milestone for the issue accordingly.


@jd-alexander It looks like @FernandaCG is not available to follow up on this PR, would you mind finishing it up instead?

@oguzkocer oguzkocer modified the milestones: 14.5, 14.6 Mar 23, 2020
@jd-alexander
Copy link
Copy Markdown
Contributor

@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 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login: The Email Address error is not preserved once the screen is rotated

5 participants