Skip to content

Issue/7140 add epilogue email#7177

Merged
hypest merged 11 commits intofeature/new-signupfrom
issue/7140-add-epilogue-email
Feb 1, 2018
Merged

Issue/7140 add epilogue email#7177
hypest merged 11 commits intofeature/new-signupfrom
issue/7140-add-epilogue-email

Conversation

@theck13
Copy link
Copy Markdown
Contributor

@theck13 theck13 commented Jan 31, 2018

Fix

Add epilogue for email as described in #7140.

Test

  1. Clear app data.
  2. Tap Sign Up button.
  3. Tap Sign Up with Email button.
  4. Enter email address not associated with WordPress.com account.
  5. Notice Signup Magic Link screen.
  6. Check email inbox of address used in Step 3.
  7. Notice signup email from WordPress.com.
  8. Tap Sign up to WordPress.com button in email.
  9. Notice Epilogue for Email screen.
  10. Tap avatar in header.
  11. Notice add avatar interface.
  12. Notice avatar is updated once adding avatar is finished.
  13. Tap Continue button.
    a. If display name, username, or password were changed, notice progress dialog.
    b. If display name, username, or password were not changed, notice no progress dialog.

Note

Some methods (i.e. startCropActivity and startGravatarUpload) were taken from MeFragment to handle uploading an avatar image. We should consider moving these methods to a utility class or library to eliminate duplicated code. We could also move methods like createDisplayNameFromEmail and createUsernameFromEmail to a utility class or library for use elsewhere.

Copy link
Copy Markdown
Contributor

@hypest hypest left a comment

Choose a reason for hiding this comment

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

Here's a first pass from my review @theck13 . Planning to continue with some additional passes but wanted to share this early. Thanks!

}
} else {
if (hasMagicLinkLoginIntent()) {
if (hasMagicLinkLoginIntent() || hasMagicLinkSignupIntent()) {
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.

Is the hasMagicLinkSignupIntent() condition needed? Can it be true while hasMagicLinkLoginIntent() is false?

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.

That is true that hasMagicLinkLoginIntent() must be true if hasMagicLinkSignupIntent() is true since they have the same scheme and host. I removed hasMagicLinkSignupIntent() from this conditional in 722916d.

}

mDispatcher.dispatch(AccountActionBuilder.newPushSettingsAction(payload));
} else if (changedPassword()) {
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.

I notice that the check for password and username modification is via else if blocks but I wonder, can't those be changed in parallel to the display name?

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.

The display name and password can be changed in the same payload, but the username is different. Dispatching those two payloads simultaneously makes it difficult to know when to continue since it's not guaranteed when each call will return. That's why I chose to cascade them.

I did notice a logic error in the updateAccountOrContinue() method. I updated it in 44382b5.

if (mAccountStore.hasAccessToken()) {
// Check signup first since login and signup have the same action and host,
// but signup has an extra parameter.
if (hasMagicLinkSignupIntent()) {
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.

hasMagicLinkSignupIntent() seems to only check for the extra new_user query param without checking for the rest of the magiclink format so, maybe we can include it inside the hasMagicLinkLoginIntent() conditional below to be more secure?

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 updated the logic in c1897d7.

public void onSuccess() {
endProgress();
mPhotoUrl = GravatarUtils.fixGravatarUrl(mAccount.getAccount().getAvatarUrl(),
getResources().getDimensionPixelSize(R.dimen.avatar_sz_login_epilogue));
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.

Good call incorporating the injectCache() track @theck13 , I can see the new image be used immediately on the epilogue after setting it.

Here's a thingie: turns out that the injected image response is for a URL that is slightly different to the URL loaded in the MeFragment after the epilogue is dimissed, which causes the annoyance where the Me screen doesn't load the injected avatar.

Problem seems to be the size parameter which is different between these two screens. What do you think about handling this issue in this PR?

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.

Nice catch! I updated the size in SignupEpilogueFragment.java to match MeFragment.java in c75f5a7.

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.

Works like a charm now, thanks! 👍

@hypest
Copy link
Copy Markdown
Contributor

hypest commented Feb 1, 2018

LGTM!

@hypest hypest merged commit fb9228e into feature/new-signup Feb 1, 2018
@hypest hypest deleted the issue/7140-add-epilogue-email branch February 1, 2018 16:30
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.

2 participants