Skip to content

Issue/13328 restore warning#13775

Merged
zwarm merged 15 commits intodevelopfrom
issue/13328-restore-warning
Jan 15, 2021
Merged

Issue/13328 restore warning#13775
zwarm merged 15 commits intodevelopfrom
issue/13328-restore-warning

Conversation

@zwarm
Copy link
Copy Markdown
Contributor

@zwarm zwarm commented Jan 14, 2021

Parent #13328

This PR implements the "warning" wizard step/view for the restore request.

The basic architecture is a clone of BackupDownloadDetailsViewModel with regards to making the request. What differs is the handling of the onBackPressed and error events. I'm on the fence as to whether this should be an actual wizard step or just a different view in the Details step. I am going to leave it as it for this PR, as I can adjust how the errors are handled separately.

Merge Instructions

Cloned Classes
RestoreWarningAdapter
RestoreWarningFragment
RestoreRequestState
RestoreWarningStateListItemBuilder
restore_warning_fragment.xml

Notes:

  • Ignore styling - this is being handled separately
  • Ignore unit test placement in packages - this is being handled separately
  • RestoreActivity & RestoreViewModel (+unit tests) will continue to get updated as I move throughout the steps of the wizard

To test:
Warning: The Restore site button is hooked up, so if you press it your site will be backed up!

  • Launch the app with RestoreFeatureConfig flag on and the BackupFeatureFlag on
  • Navigate to ActivityLog
  • Tap the more menu
  • Select the restore option
  • Tap the Restore Site button on the Details View
  • Verify
  • (1) The warning view is shown
  • (2) Tapping on X or back button returns you to the details view
  • (3) Tapping the restore site button will kick off a restore. You'll see a snackbar message, but the next page won't show because it hasn't been implemented

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@zwarm zwarm added this to the 16.6 milestone Jan 14, 2021
@zwarm zwarm requested a review from ashiagr January 14, 2021 16:38
@peril-wordpress-mobile
Copy link
Copy Markdown

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

Generated by 🚫 dangerJS

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Jan 14, 2021

You can test the changes on this Pull Request by downloading the APK here.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Jan 14, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

Copy link
Copy Markdown
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

Thanks @zwarm! Since most of the classes were cloned and reviewed originally, I found everything fine overall. I just left one comment for PostRestoreUseCase.

Also few suggestions (not related to the PR):

  1. How about we show a warning on the "Restore" screen that "This will override and remove all content created after this point" (similar to web version) before we try restore. I know you just referred the mockups so cc'ing @osullivanchris. I think it's an important message to be displayed to the user.

restore warning

  1. On unchecking all restore items on the "Restore" screen, we might want to disable "Restore site" action button. I'm not sure what will restore if all items are unchecked. The button gets disabled on the web, just fyi.

Comment on lines +29 to +33
if (!networkUtilsWrapper.isNetworkAvailable()) {
NetworkUnavailable
}

val result = activityLogStore.rewind(RewindPayload(site, rewindId, types))
Copy link
Copy Markdown
Contributor

@ashiagr ashiagr Jan 15, 2021

Choose a reason for hiding this comment

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

❓: After NetworkUnavailable is fired, control will go to the next line and RemoteRequestFailure will be fired and only this last state will be sent to the VM ignoring NetworkUnavailable. Can we re-confirm this behaviour? We might want to add unit tests for use case to check this.

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.

@ashiagr - this all goes back to "should warning be a step" or really a state in details because we show network error as a snackbar back on details view in backup. I left this as an issue to address outside of this PR - handling "back" with error in the wizard.

@osullivanchris
Copy link
Copy Markdown

How about we show a warning on the "Restore" screen that "This will override and remove all content created after this point" (similar to web version) before we try restore. I know you just referred the mockups so cc'ing @osullivanchris. I think it's an important message to be displayed to the user.

Hey thanks for the ping @ashiagr!

I think we are having pretty much the same discussion over here? I hadn't seen this message on web. Seems like a good one to include. Similar to the iOS discussion did you mean to replace the warning message I had in there, or have this in addition?

@ashiagr
Copy link
Copy Markdown
Contributor

ashiagr commented Jan 15, 2021

I think we are having pretty much the same discussion over here? I hadn't seen this message on web. Seems like a good one to include. Similar to the iOS discussion did you mean to replace the warning message I had in there, or have this in addition?

Yeah I meant the same warning. We can just reuse the one shown in the web version.

@zwarm
Copy link
Copy Markdown
Contributor Author

zwarm commented Jan 15, 2021

  1. How about we show a warning on the "Restore" screen that "This will override and remove all content created after this point" (similar to web version) before we try restore. I know you just referred the mockups so cc'ing @osullivanchris. I think it's an important message to be displayed to the user.

I'm with you on this and I agree that we should closely match the language on the web.

  1. On unchecking all restore items on the "Restore" screen, we might want to disable "Restore site" action button. I'm not sure what will restore if all items are unchecked. The button gets disabled on the web, just fyi.

I can definitely implement this. @osullivanchris - just say the word

@zwarm
Copy link
Copy Markdown
Contributor Author

zwarm commented Jan 15, 2021

@ashiagr Thanks for the review, I pushed the minor comments. Leaving the UI message changes as a separate task. I'll merge this PR when CI completes

@osullivanchris
Copy link
Copy Markdown

I'm with you on this and I agree that we should closely match the language on the web.

Agree but still not 100% sure what we are proposing. Are we changing text, or adding an additional line of text? Can you show me what we're talking about, or need me to mock up? Just not exactly clear on this.

I can definitely implement this. @osullivanchris - just say the word

Yep making the restore action disabled when nothing is selected makes sense to me. Go for it.

@ashiagr
Copy link
Copy Markdown
Contributor

ashiagr commented Jan 15, 2021

Agree but still not 100% sure what we are proposing. Are we changing text, or adding an additional line of text? Can you show me what we're talking about, or need me to mock up? Just not exactly clear on this.

I was looking for the message on the screen with the checkboxes 🤦‍♀️ since it appeared on clicking checkboxes on the web, I think it's fine to use the existing warning message unless iOS wants any changes.

@osullivanchris
Copy link
Copy Markdown

Discussed with @ashiagr on slack and realised the word 'All' is the only thing causing conflict for me now. Its the same as web. But it seems wrong to tell people that we are doing "All" whether they select some, or all, boxes. Hope that makes sense :) Will revert with same on the iOS issue

Base automatically changed from issue/13328-restore-details to develop January 15, 2021 14:23
@zwarm zwarm merged commit 2d1e606 into develop Jan 15, 2021
@zwarm zwarm deleted the issue/13328-restore-warning branch January 15, 2021 14:34
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.

3 participants