Skip to content
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

Fix/10930 email error dissapears on rotation - continued #11537

Merged
merged 8 commits into from
Apr 2, 2020

Conversation

jd-alexander
Copy link
Contributor

@jd-alexander jd-alexander commented Mar 26, 2020

Fixes #11003

Findings

This PR is a continuation of #11003 where the email error wasn't being preserved when a configuration change took place.

Testing

  1. Press Log In
  2. Enter an invalid email address and press Next. An error message will be shown
  3. Rotate the screen.
  4. Notice the error is still shown.

Reviewing

  1. Only 1 reviewer is needed but anyone can review.
  2. Once approved, close Issue/10930 email address error is preserved on rotation #11003

Submitter Checklist

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.
  • I have considered adding accessibility improvements for my changes.
  • If it's feasible, I have added unit tests.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Mar 26, 2020

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/11537
  4. Browse to https://github.com/wordpress-mobile/WordPress-Login-Flow-Android/pull/new/merge/WordPress-Android/11537 and open a new PR.

Generated by 🚫 dangerJS

@jd-alexander jd-alexander changed the title Fix/10930 email error dissapears on rotation continuation Fix/10930 email error dissapears on rotation - continued Mar 26, 2020
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Mar 26, 2020

You can test the changes on this Pull Request by downloading the APK here.

@jd-alexander jd-alexander added this to the 14.6 milestone Mar 27, 2020
@jd-alexander jd-alexander requested a review from ashiagr March 27, 2020 03:16
@jd-alexander jd-alexander marked this pull request as ready for review March 27, 2020 03:16
Copy link
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

👋@jd-alexander 😊! I tested your changes, code-wise it looks good and it should have worked but it seems Android behaves differently 😖and TextWatcher's onTextChanged() is called again when phone orientation is changed which alters the behaviour.

If it might help, tested on
Pixel 3a, API level 29
Pixel 3, API level 27

preserve_email

@jd-alexander
Copy link
Contributor Author

jd-alexander commented Mar 27, 2020

Thanks @ashiagr will check it out! Yeah, The onTextChanged threw it off. I am thinking if adding that is really necessary. Being that when you rotate and there was an error, it reminds you that you need to enter a correct email. I will think some more about it.

@jd-alexander jd-alexander requested a review from ashiagr March 31, 2020 15:43
@jd-alexander
Copy link
Contributor Author

I removed the clearing of the mIsValidEmail 3eb51e8 Let me know what you think. Do you think it has to be preserved for all states?

@ashiagr
Copy link
Contributor

ashiagr commented Apr 1, 2020

I removed the clearing of the mIsValidEmail

Thanks @jd-alexander !

I was wondering if we can delay adding text changed listener till the screen renders after rotation as described here while retaining mIsValidEmail inside onTextChanged. How about something like this?

mEmailInput.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    @Override public void onGlobalLayout() {
        mEmailInput.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        mEmailInput.addTextChangedListener(LoginEmailFragment.this);
    }
});

This way we can avoid redisplay of error text on rotation once it is cleared after text change.

email-addr

Also since we're trying to preserve email address error, I was thinking to also preserve another email error email_not_registered_wpcom. We can create a new issue if you feel so.

device-2020-04-01-102545

@jd-alexander
Copy link
Contributor Author

I was wondering if we can delay adding text changed listener till the screen renders after rotation as described here while retaining mIsValidEmail inside onTextChanged. How about something like this?

Nice @ashiagr Knew you would have something cool I didn't remember 😉

I used .post() instead and it works the same. Let me know if that's fine 26cef97

Also since we're trying to preserve email address error, I was thinking to also preserve another email error email_not_registered_wpcom. We can create a new issue if you feel so.

Makes sense! Good eye 😄 Since we are here right now, I just decided to support all the email errors in this class.
Done in 709c35e

Copy link
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

Perfect @jd-alexander 🎉! LGTM 🚢.

P.S. As discussed on slack, we should also push the changes to the login lib repo.

@ashiagr ashiagr merged commit b4f632a into develop Apr 2, 2020
@ashiagr ashiagr deleted the fix/10930-email-error-dissapears-on-rotation branch April 2, 2020 05:37
AmandaRiu added a commit that referenced this pull request May 23, 2020
cfc0675d21 Add title to the layout override for the site help dialog
63fc73efa0 Use wrap_content for image width so wider images will scale better
68b0c58437 Merge commit '8487e6f4cfee09193f48b803fcf1eb2252355022' into darkmode/login-theme-1
c826be2ccb Merge pull request #35 from wordpress-mobile/feature/login-style-changes-v2
1f6c6e4bca Gutenberg/integrate release 1.25.0 with dark mode (#11580)
1d668f54a5 Merge pull request #11537 from wordpress-mobile/fix/10930-email-error-dissapears-on-rotation
fd6665242f store the res id instead of the boolean so it supports multiple errors.
858decb8b1 utilized runnable that's posted when the UI has been drawn.
ab37113dbf removed clearing in text watcher.
3691e848b8 Fixed config change issues.
fd0c8c97e8 Merge pull request #34 from wordpress-mobile/merge/WordPress-Android/11492
c134376ee6 Merge commit 'e80a69322fe65ad994bee1854a2343c2089af323' into issue/fix-login-subtree
526919648d Ignore onDiscoverySucceeded events if LoginBaseDiscoveryFragment is detached
775f096826 Revert "Feature/material theme and Dark Theme support (#11469)" (#11486)
65d5c8f67b Feature/material theme and Dark Theme support (#11469)
e80a69322f Merge pull request #33 from wordpress-mobile/merge/WordPress-Android/11051
40824a4333 Merge commit '0c3930794ed0c77e4926d334674e85263ef2a651' into update_login_lib_with_signup_sheet_nav_bar_buttons_visibility_fix
fec863d2f8 Resolved merge conflict by removing SignupBottomSheetDialog.java file.
f2d8c102ad Merge branch 'develop' into issue/10908-navigation-bar-buttons-not-visible-with-signup-sheet
7e46000166 Fix validation in input of Email
fccc72b9a4 Merge pull request #32 from wordpress-mobile/merge/WordPress-Android/11172
d634c91e9f Merge commit '371f14160a780fbd7797d71921859d0fee5764d5' into update-login-lib-with-password-toggle-fix
cd81dd1ce9 Add custom selector for password button
8f444b2d13 Merge branch 'issue/10908-navigation-bar-buttons-not-visible-with-signup-sheet' of https://github.com/wordpress-mobile/WordPress-Android into issue/10908-navigation-bar-buttons-not-visible-with-signup-sheet
b53dda144c Add null check for design_bottom_sheet layout
521d09f42c Update libs/login/WordPressLoginFlow/src/main/java/org/wordpress/android/login/widgets/WPBottomSheetDialogFragment.java
7178f5c123 Show full width navigation bar and restrict max width for large screens
8a768d3dd2 Partial fix for terms of service announcement bering read twice.
989fb1d5a2 Remove empty line after brace
2d5d733080 Extract parts of code from onCreateView to onViewCreated
a24d5289ab Eliminate setRetainInstance(true)
2e71a00135 Remove dialog.setOnDismissListener
cfff7a060d Avoid using a parameter in Fragment's constructor
8b09b2d836 Convert BottomSheetDialog to BottomSheetDialogFragment and update styles
a87d595f7a Merge pull request #1796 from woocommerce/release/merge-3.3
f18c390619 Fix signup bottom sheet navigation bar buttons not visible issue
4f4657fb64 Add requested changes
e407a7f304 Revert erroneously deleted code during merge
821d29b90b Revert erroneously deleted code during merge
188cc0ee64 Check if view is null before accessing property
1a4414eec7 Merge commit 'bd659986940153549bfc26a8f6a4104bf748fe3c' into hotfix/1778-npe
d2b8135e1e Added logic to fetch the correct SiteModel from the local db for the incoming url
d80e8e616d Remove whitespaces
b18703520d Issue/10930 email address error is preserved on rotation
3421ca9534 Merge branch 'develop' into test
a20471e8c1 Merge branch 'develop' of https://github.com/woocommerce/woocommerce-android into feature/refund-by-items-master
7757f052b7 Merge branch 'develop' into feature/edit-product-master
f869be0bfc Merge branch 'feature/refund-by-items-master' into 0nko/refund-items-list
ea896f6172 Merge pull request #10833 from wordpress-mobile/issue/10832-fix-npe-in-login-fragment
64678168e4 check if listener is null before handling discovery error
1de03a5522 check if listener is null before handling discovery error
a6e0946af0 Update gradle plugin to version 3.5.3
a23213aa25 Fixed wrong key variable
c89899f001 Updated Glide version to 4.10.0 in the login module
2dd431ccdd Updated Glide version in the login lib
e3211148cd Merge pull request #10787 from wordpress-mobile/anitaa/woo-login-changes
00f6bd2e62 Added flag that checks if login has started.
d5e8683cf6 Added period to login with site credentials
eee4c53fa7 Fixed bug when the forgot password url in username password screen was not valid
2810b14e28 Upgrade gradle plugin to version 3.5.2
daf7384622 Merge pull request #1552 from woocommerce/login-lib-changes
f75cbaaacd Merge commit '4e588147352f8fe88f1417a03a00114dd7d51640' into login-lib-changes
b2d28c652d Add signup flow name parameter to signup auth email request

git-subtree-dir: libs/login
git-subtree-split: cfc0675d2167b938369cf1896083453a593e9b8e
@hypest
Copy link
Contributor

hypest commented Jun 3, 2020

👋 @jd-alexander , does this PR also address this other ticket? #10930. Let's close it if it does, thanks!

@jd-alexander
Copy link
Contributor Author

Yes, it does @hypest Closing!

wzieba pushed a commit that referenced this pull request Sep 27, 2024
…-dissapears-on-rotation

Fix/10930 email error dissapears on rotation - continued
wzieba pushed a commit that referenced this pull request Oct 21, 2024
…-dissapears-on-rotation

Fix/10930 email error dissapears on rotation - continued
wzieba pushed a commit that referenced this pull request Oct 21, 2024
…-dissapears-on-rotation

Fix/10930 email error dissapears on rotation - continued
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.

4 participants