Skip to content

Part 1: Sign In Jetpack basic check and error messaging#1121

Merged
nbradbury merged 21 commits intofeature/signin-milestone-1from
amanda/sign-in-milestone-1
Jun 4, 2019
Merged

Part 1: Sign In Jetpack basic check and error messaging#1121
nbradbury merged 21 commits intofeature/signin-milestone-1from
amanda/sign-in-milestone-1

Conversation

@AmandaRiu
Copy link
Copy Markdown
Contributor

@AmandaRiu AmandaRiu commented Jun 4, 2019

This PR partially addresses #1091. To keep the PRs smaller, I'm breaking them down for review to be merged into a feature branch. This PR covers the following changes:

  • Removes any mention of Jetpack from the login prologue
  • Starts the login with the site address screen
  • Updates label text for LoginEmailFragment to use the site url
  • Updates error messaging in LoginSiteAddressFragment for all scenarios except the "not connected" scenario (coming in a later PR)
  • Uses SiteAction.FETCH_CONNECT_SITE_INFO to get information on the URL entered to determine if the site has WordPress installed, and if it has Jetpack installed and connected.
  • Adds the new "Jetpack Required" fragment (help buttons work, but other buttons just show toast message at this point).

Note: The code to check the URL for WordPress and Jetpack is a temporary measure for this round. If we decide to fully implement this login flow, we'll need to use the full XMLRPC discovery code and implement handlers for various scenarios such as HTTP Authentication required and self-signed SSL certifications.

Not a valid URL

Not a WordPress site

The initial designs required a check for WooCommerce on a site, but this is not possible without a major overhaul. Instead we check if WordPress is installed, and if not, we display an error:

Jetpack not connected

If jetpack is not installed and connected properly, the user will be directed to the "Jetpack Required" view:

WooCommerce site

If the site is a WordPress site and has Jetpack installed and connected, the user should be routed to login by email as normal. Other than the label changes, everything else should remain the same for the purpose of this PR:

cc: @kyleaparker for design review

Update release notes:

  • If there are user facing changes, I have added an item to RELEASE-NOTES.txt.

@AmandaRiu AmandaRiu added the Login label Jun 4, 2019
@AmandaRiu AmandaRiu added this to the 2.1 milestone Jun 4, 2019
@peril-woocommerce
Copy link
Copy Markdown

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS

@AmandaRiu AmandaRiu changed the title Amanda/sign in milestone 1 Part 1: Sign In Jetpack basic and error messaging Jun 4, 2019
@AmandaRiu AmandaRiu changed the title Part 1: Sign In Jetpack basic and error messaging Part 1: Sign In Jetpack basic check and error messaging Jun 4, 2019
@AmandaRiu AmandaRiu added the needs: design Requires design input/work from a designer. label Jun 4, 2019
@AmandaRiu AmandaRiu marked this pull request as ready for review June 4, 2019 02:33
@AmandaRiu AmandaRiu requested review from anitaa1990 and nbradbury June 4, 2019 02:33
Copy link
Copy Markdown
Contributor

@anitaa1990 anitaa1990 left a comment

Choose a reason for hiding this comment

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

This looks great @AmandaRiu! I love how you migrated a lot of the UI to ConstraintLayout 😄

I tested the functionality and everything works good 👍 I am still trying to understand how the login lib works so not sure if I am the best person to review 😊

@nbradbury nbradbury self-assigned this Jun 4, 2019
@@ -0,0 +1,109 @@
package com.woocommerce.android
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 there a reason this isn't in the ui/login folder?

Screen Shot 2019-06-04 at 12 36 07 PM

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 sure what happened there. I manually moved it once, and then again in the latest branch I'm working on for the second PR. I've manually moved it again 🤞 a0b19dc

): View? {
setHasOptionsMenu(true)

// Inflate the layout for this fragment
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 know this is nitpicky (Nickpicky?), but is this comment necessary?

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.

ha! no that's a really good suggestion. Done in fe639d2

@nbradbury
Copy link
Copy Markdown
Contributor

When I tap "Need more help" here:

Screenshot_1559670289

It immediately asks me for my name and email address:

Screenshot_1559670292

I think it should simply show the Help & Support activity, just as it does when the Help button is tapped in the toolbar.

@nbradbury
Copy link
Copy Markdown
Contributor

@AmandaRiu I'm finished with my first round and it looks good despite my nitpicks. However, one potentially big problem I'm seeing is that after testing with a site that had Jetpack disabled, I then enabled Jetpack and tried again but continued to see the Jetpack required screen.

I'm assuming this is a caching issue, or something similar, but it could be a annoyance for users that enable Jetpack and still can't login.

Copy link
Copy Markdown
Contributor Author

@AmandaRiu AmandaRiu left a comment

Choose a reason for hiding this comment

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

@nbradbury Thank you for the quick review! I've addressed the comments inline and referenced code changes where needed.

I think it should simply show the Help & Support activity, just as it does when the Help button is tapped in the toolbar.

This is pre-existing functionality and I'd prefer not to tinker with it for this project. I'd be down for changing the flow, it would be pretty easy, but I'd definitely like to get @kyleaparker 's thumbs up on it, so we should just create an official ticket so it can be reviewed.

I'm assuming this is a caching issue, or something similar, but it could be a annoyance for users that enable Jetpack and still can't login.

Oh that's no good. I'll have to look into that as well. There must be something I can do there. I'll add it to my TODO list for the project. I wouldn't worry about it for this PR as this is focused more on the flow. Even the way we're checking for Jetpack is temporary.

Ready for another round!

@AmandaRiu AmandaRiu mentioned this pull request Jun 4, 2019
1 task
@nbradbury
Copy link
Copy Markdown
Contributor

@AmandaRiu I was about to merge this then thought I should test against a couple more sites. Both sites I tested with end up showing that Jetpack screen, even though both of them are wp.com sites running WooCommerce.

I know you mentioned "The code to check the URL for WordPress and Jetpack is a temporary measure for this round" - does that mean go ahead and merge even if it's not working?

Aside: I'm assuming this is why my self-hosted site kept showing that screen even after I enabled Jetpack, so the caching issue I mentioned is likely a red herring.

@AmandaRiu
Copy link
Copy Markdown
Contributor Author

@nbradbury

I was about to merge this then thought I should test against a couple more sites. Both sites I tested with end up showing that Jetpack screen, even though both of them are wp.com sites running WooCommerce.

After some digging we figured out that Atomic sites have different values returned during the Connected Site check. This is an example response:

exists: true
hasJetpack: true
isJetpackActive: false
isJetpackConnected: false
isWordPress: true
isWordPressDotCom: true
jetpackVersion: "7.4"
skipRemoteInstall: false
urlAfterRedirects: "amandariu.com"

This is an atomic store and it seems like these values will always be false for an atomic store:

isJetpackActive: false
isJetpackConnected: false

I tested with a temp ninja site and walked through the results of the connect site check and verified that during each step of jetpack installation process, install, activate, connect...those values update as expected and can be relied on. I've updated the logic to only require hasJetpack = true if isWordPressDotCom = true in d347c49. This is now working as expected. Ready for testing!

@nbradbury
Copy link
Copy Markdown
Contributor

Looks good! :shipit:

@nbradbury nbradbury merged commit 772781e into feature/signin-milestone-1 Jun 4, 2019
@nbradbury nbradbury deleted the amanda/sign-in-milestone-1 branch June 4, 2019 22:25
@kyleaparker
Copy link
Copy Markdown

This is pre-existing functionality and I'd prefer not to tinker with it for this project. I'd be down for changing the flow, it would be pretty easy, but I'd definitely like to get @kyleaparker 's thumbs up on it, so we should just create an official ticket so it can be reviewed.

👍 ok to leave for the first milestone, will take a look and see if there are improvements we could make later on

@designsimply designsimply added feature: login Related to any part of the log in or sign in flow, or authentication. and removed Login labels May 6, 2021
@peril-woocommerce
Copy link
Copy Markdown

Fails
🚫

Danger failed to run /app/danger-0.kofk8nkoyi.ts.

🚫

Danger failed to run /app/danger-0.0x5ekwsc2bm.ts.

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.
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 woocommerce-android
  2. git checkout amanda/sign-in-milestone-1
  3. git subtree push --prefix=libs/login/ https://github.com/wordpress-mobile/WordPress-Login-Flow-Android.git merge/woocommerce-android/1121
  4. Browse to https://github.com/wordpress-mobile/WordPress-Login-Flow-Android/pull/new/merge/woocommerce-android/1121 and open a new PR.

Error TypeError

Cannot read property 'added' of null
TypeError: Cannot read property 'added' of null
    at Object.exports.default (/app/danger-0.kofk8nkoyi.ts:16:44)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Dangerfile

11|         warn("The PlayStoreStrings.po file must be updated any time changes are made to release notes");
12|     }
13| 
14|     // If changes were made to the strings, make sure they follow our guidelines
15|     const modifiedStrings = modifiedFiles.filter((path: string) => path.endsWith('values/strings.xml'))
----------------------------------------------^
16| 
17|     for (let file of modifiedStrings) {        
18|         const stringDiffs = await danger.git.diffForFile(file)
19| 

Error TypeError

Cannot read property 'diff' of null
TypeError: Cannot read property 'diff' of null
    at checkCommitDiffs (/app/danger-0.0x5ekwsc2bm.ts:43:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Dangerfile

38|         if (git === undefined) {
39|             console.log("About to crash due to an error")
40|             console.log("File:", thisFile)
41|             console.log("Danger Object: ", danger)
42| 
---------------------------------------------------^
43|             if (danger !== undefined) {
44|                 console.log("Danger is no longer defined")
45|             }
46|             else {

Generated by 🚫 dangerJS

@peril-woocommerce
Copy link
Copy Markdown

Fails
🚫

Danger failed to run /app/danger-0.nm2mqckx6v.ts.

🚫

Danger failed to run /app/danger-0.rgcymzrcm7m.ts.

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.
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 woocommerce-android
  2. git checkout amanda/sign-in-milestone-1
  3. git subtree push --prefix=libs/login/ https://github.com/wordpress-mobile/WordPress-Login-Flow-Android.git merge/woocommerce-android/1121
  4. Browse to https://github.com/wordpress-mobile/WordPress-Login-Flow-Android/pull/new/merge/woocommerce-android/1121 and open a new PR.

Error TypeError

Cannot read property 'added' of null
TypeError: Cannot read property 'added' of null
    at Object.exports.default (/app/danger-0.nm2mqckx6v.ts:16:44)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Dangerfile

11|         warn("The PlayStoreStrings.po file must be updated any time changes are made to release notes");
12|     }
13| 
14|     // If changes were made to the strings, make sure they follow our guidelines
15|     const modifiedStrings = modifiedFiles.filter((path: string) => path.endsWith('values/strings.xml'))
----------------------------------------------^
16| 
17|     for (let file of modifiedStrings) {        
18|         const stringDiffs = await danger.git.diffForFile(file)
19| 

Error TypeError

Cannot read property 'diff' of null
TypeError: Cannot read property 'diff' of null
    at checkCommitDiffs (/app/danger-0.rgcymzrcm7m.ts:43:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Dangerfile

38|         if (git === undefined) {
39|             console.log("About to crash due to an error")
40|             console.log("File:", thisFile)
41|             console.log("Danger Object: ", danger)
42| 
---------------------------------------------------^
43|             if (danger !== undefined) {
44|                 console.log("Danger is no longer defined")
45|             }
46|             else {

Generated by 🚫 dangerJS

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

Labels

feature: login Related to any part of the log in or sign in flow, or authentication. needs: design Requires design input/work from a designer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants