-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Site creation rework: theme loading retry when connection resumes #7247
Conversation
I piggybacked:
|
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Here's a gif with how the no-network toast done in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Listen for network connectivity and try the themes network fetch again when connectivity is restored.
To test #1:
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:
To test #3: