[go: nahoru, domu]

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

Site creation rework: theme loading retry when connection resumes #7247

Merged

Conversation

hypest
Copy link
Contributor
@hypest hypest commented Feb 16, 2018

Listen for network connectivity and try the themes network fetch again when connectivity is restored.

To test #1:

  1. Disable wifi/cellular so the device/emulator has no connectivity
  2. With the app logged in to WPCOM, add a new WPCOM site via the Site Picker
  3. Tap on any of the 3 site category options in the wizard
  4. Notice the "A network error occurred. Please check your connection and try again." error message.
  5. Without leaving the app, enable connectivity
  6. Notice the app screen showing a progress bar when connectivity restores and then loading the themes

This PR also includes the fix for #7221 . Shows a "Close" button when the site-creation process finishes but the new site has been created remotely. If it hasn't, a "Back" button is displayed.

To test #2:

  • With the app logged in to wpcom, go to the site picker and start creating a new site. Bring the wizard up to step 4 (subdomain selection) but wait.
  • Turn connectivity off
  • Push the "CREATE SITE" button
  • The "Creating" screen comes up, it informs that something went wrong and it displays a "Back" button on the toolbar
  • Tap the "Back" button and notice the wizard returning to step 4

To test #3:

  • With the app logged in to wpcom, go to the site picker and start creating a new site. Bring the wizard up to step 4 (subdomain selection).
  • Be ready to turn connectivity off after the "Creating" screen comes up
  • Push the "CREATE SITE" button and wait for the process to reach the "Retrieving site information" step
  • Turn connectivity off
  • The app informs that something went wrong and it displays a "X" button on the toolbar
  • Tap the "X" button and notice the app returning directly to the site picker

@hypest hypest requested a review from theck13 February 16, 2018 22:14
@hypest hypest changed the title Site creation rework: theme loading retry when connectivity Site creation rework: theme loading retry when connection resumes Feb 16, 2018
@hypest
Copy link
Contributor Author
hypest commented Feb 17, 2018

I piggybacked:

@hypest hypest mentioned this pull request Feb 17, 2018
13 tasks
Copy link
Contributor
@theck13 theck13 left a comment

Choose a reason for hiding this comment

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

There are a few optimizations we can make. Other than that, everything looks good!

} else if (failedState.getStep() == SiteCreationService.SiteCreationStep.IDLE
|| failedState.getStep() == SiteCreationService.SiteCreationStep.NEW_SITE) {
} else if (failedState.getStep() == SiteCreationStep.IDLE
|| failedState.getStep() == SiteCreationStep.NEW_SITE) {
createSite();
} else {
retryFromState(failedState, (long) failedState.getPayload());
Copy link
Contributor
@theck13 theck13 Feb 18, 2018

Choose a reason for hiding this comment

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

Both the createSite and retryFromState methods are declared private and they are accessed outside the private scope as well as the mIsPageFinished variable. Making them package-private or protected will avoid create wasteful synthetic accessor methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done with 71f4c2d.

}

public boolean isCreationSucceeded() {
return mCreationSucceeded;
SiteCreationState state = SiteCreationService.getState();
return state != null && SiteCreationService.getState().getStep() == SiteCreationStep.SUCCESS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since state is created in the line above, can't we simplify SiteCreationService.getState().getStep() to state.getStep() to minimize the SiteCreationService.getState() calls? Otherwise, creating state doesn't reduce the number of SiteCreationService.getState() calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, good find! I was going to reuse the variable but that fell between the cracks! Done with 12a8e0f.

@hypest
Copy link
Contributor Author
hypest commented Feb 20, 2018

Here's a gif with how the no-network toast done in
3d61f5a works:

no-network-toast

Copy link
Contributor
@theck13 theck13 left a comment

Choose a reason for hiding this comment

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

:shipit:

@theck13 theck13 merged commit 816ca86 into feature/new-signup Feb 20, 2018
@theck13 theck13 deleted the feature/site-creation-theme-retry-when-connectivity branch February 20, 2018 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants