Fix post-signup interstitial for login with magic link #11020
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #11019
This PR adds a functionality for showing the post-signup interstitial after the login epilogue screen.
In #10976 we tried to completely replace the login epilogue screen for the interstitial screen at the end of the login flow when the user had no sites, to avoid showing an empty epilogue screen. The assumption was that we would have all relevant login flows covered by adding the following logic inside
LoginActivity
:WordPress-Android/WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java
Lines 245 to 251 in acbf579
However, when using a Magic Link, the login epilogue screen is launched from the main activity:
WordPress-Android/WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java
Lines 1057 to 1058 in fe3fe8b
This caused the interstitial screen not being shown at all for logins using Magic Link.
A naive approach to this problem would be to replicate the logic above that we used on
LoginActivity
to the main activity as well, but that wouldn't work as we wanted because, when launched from the main activity, theLoginEpilogueActivity
receives an argumentdoLoginUpdate
oftrue
and is responsible to fetch the user account and settings (including sites) itself. This meant we couldn't perform a check to determine if the user had sites, which in turn meant we couldn't determine if it would be possible to replace the empty login epilogue screen for the interstitial screen like we do in the other cases.After discussing a few options with @maxme, we've decided to go with the solution proposed here, where we'll try to replace the login epilogue screen for the interstitial where possible and let the login epilogue screen be followed by the interstitial where not.
So for example, at the end of the email/password login flow, an user with no sites would not see the login epilogue screen at all. Instead, they would only see the interstitial screen. As for the Magic Link flow, an user with no sites would still see the login epilogue screen, but it would be followed by the interstitial.
This is illustrated below:
To test
PR submission checklist:
RELEASE-NOTES.txt
if necessary.