Skip to content

Fix/14030 backup download notice#14155

Merged
zwarm merged 28 commits intorelease/16.8from
fix/14030-backup-download-notice
Feb 26, 2021
Merged

Fix/14030 backup download notice#14155
zwarm merged 28 commits intorelease/16.8from
fix/14030-backup-download-notice

Conversation

@zwarm
Copy link
Copy Markdown
Contributor

@zwarm zwarm commented Feb 25, 2021

Fixes #14030

This PR adds the Backup Download Banner to the activity log list and backup list. The details of this PR were copied from the closed PR #14147. With the exception of styles and layouts, comments from that PR are addressed in this one.

Notable changes ( It may be easiest to review this PR by commits and I'm available if reviewer wants to pair review)

  • activity_log_list_notice_item.xml - New layout file for the notice banner
  • styles.xml & strings.xml - Added new styles for the banner and a few strings
  • ActivityLogAdapter, ActivitiyLogDiffCallback - both updated to support the Notice list item type and the new NoticeItemViewHolder, so that the view will actually show in the list
  • Updated Complete to include url and validUntil and GetBackupDownloadStatusUseCase to send those values downstream
  • Created PostDismissBackupDownloadUseCase which is post the dismiss request to the server. If there is an error, we log it and move on.
  • Four new tracking collections points were added to track button taps from the notice banner. Separate tracks for activity log list notice vs backup list notice.
    JETPACK_BACKUP_DOWNLOAD_FILE_NOTICE_DOWNLOAD_TAPPED -
    JETPACK_BACKUP_DOWNLOAD_FILE_NOTICE_DISMISSED_TAPPED,
    ACTIVITY_LOG_DOWNLOAD_FILE_NOTICE_DOWNLOAD_TAPPED,
    ACTIVITY_LOG_DOWNLOAD_FILE_NOTICE_DISMISSED_TAPPED
  • Added a couple of new function to ActivityLogTracker to make the tracks call reusable
  • Added a new navigation event for DownloadBackupFile, which will forward the user to the web browser for file download. Updated the observer in ActivityLogListFragment to handle the browser launch
  • Added a JetpackBackupDownloadActionState which will let the calling activity know which state the download is in on return. This was a precursor to showing the correct messaging when returning to the activity log list or backup list. Changes were made to BackupDownloadFragment and BackupDownloadViewModel to support this new intent extra.
  • The majority of the changes occur in ActivityLogViewModel, which include:
    • Updating backupDownloadEvent with a displayNotice field, so when reloadEvents executes it uses this property to determine if the notice banner should be shown. Also included downloadId, url, and validUntil.
    • Removed the showBackupDownloadFinishedMessage from within reloadEvents, the snackbar is replaced with the notice banner
    • Added a new function to build the notice list item
    • Added two new functions to handle the download and dismiss button clicks from within the notice banner
    • Updated onQueryBackupDownloadStatus to use the JetpackBackupDownloadActionState to determine which snackbar message to be shown. Note that in the case of returning to the lists, we do want to show the snackbar in addition to the notice banner.
    • Updated handleBackupDownloadStatusForProgress to no longer check if the progress item is shown, we always kick off a reloadEvents
    • Updated handleBackupDownloadStatusForComplete to reloadEvents of the progressItem is not shown
  • Updated and/or added tests

Merge Instructions:

  • Review FluxC PR and merge
    ** PLEASE DO NOT MERGE: This PR merge is dependent on the proper merge of this FluxC PR **
    FYI: After approval of both PRs, the process will follow this flow:
  • Open 2 FluxC PRs to merge release/1.11.1 back to develop and trunk, and add a tag 1.11.1 and GitHub release.
  • Replace FluxC hash with the 1.11.1 tag in WPAndroid build.gradle
  • Remove the "Not Ready for Merge label"
  • Merge this PR in release/16.8
light dark notification
light dark backup-download

To test:

Scenario.1 : BackupDownload Flow - Manual Exit

  • Open app
  • Launch Activity Log screen,
  • Find a rewindable item from the list, click on the ellipsis menu item and select Download backup to launch the Backup Download screen,
  • Click the Create downloadable file button.
  • Navigate back manually (by clicking the X toolbar button or pressing/swiping back).
  • You should automatically be navigated back to the Activity Log screen and a backup status will be triggered,
  • The backup progress item should immediately appears.
  • A snackbar should immediately appear informing that the backup just started.
  • Wait for backup to finish while having the Activity Log screen
  • When backup finishes
  • The backup progress item should disappear
  • The backup download notice should appear

Scenario.2 : BackupDownload Flow - Wait for flow to end and then exit

  • Open app
  • Launch Activity Log screen,
  • Find a rewindable item from the list, click on the ellipsis menu item and select Download backup to launch the Backup Download screen,
  • Click the Create downloadable file button.
  • Wait for the backup download flow to complete keeping the backup flow process open
  • After the backup completes, navigate back manually (by clicking the X toolbar button or pressing/swiping back)
  • A snackbar should immediately appear informing that the backup is complete
  • The backup download notice should appear

Scenario.3 (Notice banner download)

  • Run a backup using scenario 1 or 2 above
  • Click on the "Download" button within the notice banner
  • Note that a browser is launched and the download starts. In some cases, you may be prompted to verify the download.

Scenario.4 (Notice banner dismiss)

  • Run a backup using scenario 1 or 2 above
  • Click on the "Dismiss" button within the notice banner
  • Note the the Notice banner disappears

Scenario.5 (Notification detail tap)

  • Run a backup using scenario 1 or 2 above
  • Wait for the notification to show up in the Android device
  • Tap on the notification to open the Notification Detail view
  • Tap on the Sites Backups link within the notification detail
  • Note that you are navigated to the Backup list and that the notice banner is visible

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.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Feb 25, 2021

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

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Feb 25, 2021

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

Generated by 🚫 dangerJS

activityLogTracker.trackDownloadBackupDismissButtonClicked(rewindableOnly)
viewModelScope.launch {
// reload events first to remove item - convey progress
reloadEvents(backupDownloadEvent = BackupDownloadEvent(displayNotice = false, displayProgress = 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.

@ParaskP7 - Please note that I moved the reloadEvents call before the dismiss call because I didn't want to leave room for the button to be tapped more than once. It appears that all UI refreshes call reloadEvents and disabling the button would to have called the method anyway. Plus I tested with a disable and it made the view jumpy because the transition happens quickly.

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.

👋 @zwarm !

Thanks for guiding me through your thought process. 🙏

viewModel.onQueryBackupDownloadStatus(REWIND_ID, DOWNLOAD_ID)
viewModel.onQueryBackupDownloadStatus(REWIND_ID, DOWNLOAD_ID, JetpackBackupDownloadActionState.COMPLETE.id)

assertThat(viewModel.events.value?.first() as? Notice).isNotNull
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.

@ParaskP7 - This may not be ideal, but it gets the job done - for now. I'm having trouble creating a Notice item to match what is actually created because of the click delegates. I'm open to suggestions, but it can wait after the next beta. Thanks

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.

👋 @zwarm !

Definitely, will also have a quick look. 🙏

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Feb 25, 2021

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

@ParaskP7 ParaskP7 self-assigned this Feb 26, 2021
Copy link
Copy Markdown
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

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

👋 @zwarm !

I have reviewed and tested this PR as per the instructions, everything works exactly as expected, once more, kudos on a wonderful job! 🌟 🌟 🌟

I have left some extra comments for you to consider (also copy-pasted a couple from the previous #14147 PR for your convenience). I am going to approve this PR anyway, since none is blocking. I am NOT going to merge this PR yet to give you some time to apply any of my suggestions. However, feel free to ignore them and merge the PR yourself.

@@ -663,16 +708,21 @@ class ActivityLogViewModel @Inject constructor(
}

private fun handleBackupDownloadStatusForComplete(state: BackupDownloadRequestState.Complete) {
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.

Warning (⚠️): Consider adding a test for the new logic added here.

PS: I copy-pasted that from the sibling PR since I didn't resolve that yet there.

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 guess I missed this one, probably not going to done in time for the beta though. Looks like we also need to add a test for handleBackupDownloadStatusForProgress, I don't see that explicitly called out either. I'll drop it on my to-do list. Thanks

@ParaskP7
Copy link
Copy Markdown
Contributor

👋 @zwarm !

Just checked your latest 3 commits and LGTM, still approved from my side. 💪

@ParaskP7
Copy link
Copy Markdown
Contributor

👋 @zwarm !

Just checked your latest commit and LGTM, still approved from my side. 💪

@zwarm zwarm merged commit f6c9332 into release/16.8 Feb 26, 2021
@zwarm zwarm deleted the fix/14030-backup-download-notice branch February 26, 2021 20:31
@zwarm zwarm mentioned this pull request Jul 22, 2021
34 tasks
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