Fix/14030 backup download notice#14155
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
Generated by 🚫 dangerJS |
| activityLogTracker.trackDownloadBackupDismissButtonClicked(rewindableOnly) | ||
| viewModelScope.launch { | ||
| // reload events first to remove item - convey progress | ||
| reloadEvents(backupDownloadEvent = BackupDownloadEvent(displayNotice = false, displayProgress = false)) |
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
👋 @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 |
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
👋 @zwarm !
Definitely, will also have a quick look. 🙏
|
You can test the changes on this Pull Request by downloading the APK here. |
There was a problem hiding this comment.
👋 @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.
WordPress/src/main/java/org/wordpress/android/viewmodel/activitylog/ActivityLogViewModel.kt
Outdated
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/viewmodel/activitylog/ActivityLogViewModel.kt
Show resolved
Hide resolved
| @@ -663,16 +708,21 @@ class ActivityLogViewModel @Inject constructor( | |||
| } | |||
|
|
|||
| private fun handleBackupDownloadStatusForComplete(state: BackupDownloadRequestState.Complete) { | |||
There was a problem hiding this comment.
Warning (
PS: I copy-pasted that from the sibling PR since I didn't resolve that yet there.
There was a problem hiding this comment.
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
|
👋 @zwarm ! Just checked your latest 3 commits and LGTM, still approved from my side. 💪 |
|
👋 @zwarm ! Just checked your latest commit and LGTM, still approved from my side. 💪 |
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 bannerstyles.xml&strings.xml- Added new styles for the banner and a few stringsActivityLogAdapter,ActivitiyLogDiffCallback- both updated to support theNoticelist item type and the newNoticeItemViewHolder, so that the view will actually show in the listCompleteto include url and validUntil andGetBackupDownloadStatusUseCaseto send those values downstreamPostDismissBackupDownloadUseCasewhich is post the dismiss request to the server. If there is an error, we log it and move on.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
ActivityLogTrackerto make the tracks call reusableDownloadBackupFile, which will forward the user to the web browser for file download. Updated the observer inActivityLogListFragmentto handle the browser launchJetpackBackupDownloadActionStatewhich 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 toBackupDownloadFragmentandBackupDownloadViewModelto support this new intent extra.ActivityLogViewModel, which include:backupDownloadEventwith a displayNotice field, so whenreloadEventsexecutes it uses this property to determine if the notice banner should be shown. Also included downloadId, url, and validUntil.onQueryBackupDownloadStatusto 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.handleBackupDownloadStatusForProgressto no longer check if the progress item is shown, we always kick off a reloadEventshandleBackupDownloadStatusForCompleteto reloadEvents of the progressItem is not shownMerge Instructions:
** 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:
release/1.11.1back to develop and trunk, and add a tag1.11.1and GitHub release.1.11.1tag in WPAndroid build.gradlerelease/16.8To test:
Scenario.1 : BackupDownload Flow - Manual Exit
Activity Logscreen,Download backupto launch theBackup Downloadscreen,Create downloadable filebutton.Xtoolbar button or pressing/swiping back).Activity Logscreen and a backup status will be triggered,Activity LogscreenScenario.2 : BackupDownload Flow - Wait for flow to end and then exit
Activity Logscreen,Download backupto launch theBackup Downloadscreen,Create downloadable filebutton.Xtoolbar button or pressing/swiping back)Scenario.3 (Notice banner download)
Scenario.4 (Notice banner dismiss)
Scenario.5 (Notification detail tap)
PR submission checklist:
RELEASE-NOTES.txtif necessary.