Jetpack Section: Backup Screen - Introduce Backup Screen#13762
Jetpack Section: Backup Screen - Introduce Backup Screen#13762
Conversation
This 'FluxC' hash updates 'FluxC' to that 'branch' version where 'ActivityLogStore.getActivityLogForSite(...)' utilises the 'rewindableOnly' to retrieve only the rewindable activities from the database. This step is required in order to build the 'Backups' screen. During code review and before merging to 'develop' this hash will be replaced with the appropriate tag.
This commit adds a new launcher method, the 'viewBackupList', which launches an 'Activity Log' screen, just like the 'viewActivityLogList(...)'. The only difference is the additional extra boolean, the 'ACTIVITY_LOG_REWINDABLE_ONLY_KEY', which is added prior to launching the screen and will become the differentiator between presenting the 'Activity Log' or 'Backups' screen.
If the rewindable only flag is present and true then the title of the activity becomes 'Backup', else it remains as 'Activity Log'. This way both screens are visually differentiated by title.
If the rewindable only flag is present and true then the 'Activity Type' chip is hidden, else it remains visible. As such, on the 'Activity Log' screen the 'Activity Type' chip and filtering capability will be available. But, on the 'Backups' screen the same 'Activity Type' chip and filtering capability will not be available. This way both screens are visually differentiated by 'Activity Type'. Note: This commit also update the synthetic import, from 'toolbar_main' to 'activity_log_list_activity'. It seems that the previous import was incorrect.
This commit adds the following: 1) Parses the 'ACTIVITY_LOG_REWINDABLE_ONLY_KEY' as passed by the 'Activity', and 2) Saves the 'ACTIVITY_LOG_REWINDABLE_ONLY_KEY' during 'onSaveInstanceState' for configuration change purposes. 3) Passes the rewindable only flag to the fragment's 'ViewModel'.
As part of this commit the below occurred: 1) The 'rewindableOnly' flag was added on the test suite. But, no additional tests or updates occurred on the test suite itself. This is by design since the store is mocked. 2) An enhancement to the test suite's 'initializeActivityList()' function was made to replicate a list that contains both rewindable, and non-rewindable items.
These tests will fail as the implementation is not ready yet. The next commit will make the tests pass (TDD).
This commit makes the previous failing test pass (TDD).
This will then match the way 'EmptyUiState.Backup' level is structured and increase readability while using this sealed class.
This behavior was not intended and has been confirmed with design that it should be removed. Also, on the iOS platform, this extra behavior was never implemented. As such, this commit also increases feature parity between the two platforms.
Also, as part of this extraction a accompanying Javadoc was added to explain the reasoning for such code branching and for preventing any further encouragement to do the same in the future (should the need arises and the complexity needs to further increase).
This Javadoc tries to do two things: 1) Explain the reasoning for such code branching, and 2) Prevent any further encouragement to do the same in the future (should the need arises and the complexity needs to further increase).
This 'FluxC' tag updates FluxC to that 'develop' version where 'ActivityLogStore.getActivityLogForSite(...)' utilises the 'rewindableOnly' to retrieve only the rewindable activities from the database. This step is required in order to build the 'Backups' screen.
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APK here. |
malinajirka
left a comment
There was a problem hiding this comment.
Really great job @ParaskP7! The differences between Activity Log and Backup Screen are clearly separated ❤️.
Enable BackupsFeatureConfig, scroll down and click the RESTART THE APP button. DO NOT confuse this feature flag with the BackupFeatureConfig (singular). Make sure to enable the right feature flag.
Tbh I didn't realize these two flags are so similar. I think it might be worth renaming them (eg. BackupScreenFeatureFlag and BackupDownloadFeatureFlag). It'd be quite unfortunate if there was a bug in production and we disabled the wrong flag. Wdyt?
WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListFragment.kt
Outdated
Show resolved
Hide resolved
I agree! 🌟 I'll create a PR after this PR is merged which will do exactly that. @zwarm are you okay Jirka's suggestion? |
The system recreates the activity, as such the extras will still be available in activity's intent. As such, retrieving the 'rewindableOnly' flag from there is a much better and robust alternative. Note: The 'SiteModel' is a bit different since it can change. Ideally only the 'siteId' would be stored to avoid that as well. As such, those two cases are not comparable.
This is a much better alternative with less boilerplate code.
|
Feel free to merge this when the conflict is resolved ;)! |
…f github.com:wordpress-mobile/WordPress-Android into issue/13629-introduce-backups-screen � Conflicts: � WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java � WordPress/src/main/java/org/wordpress/android/ui/activitylog/list/ActivityLogListFragment.kt � WordPress/src/test/java/org/wordpress/android/viewmodel/activitylog/ActivityLogViewModelTest.kt � build.gradle
FYI: This PR is now ready @malinajirka : #13785 |
Parent #13629
This PR introduces the
Backupsscreen, which is actually anActivity Logscreen in disguise. As such, this PR reused theActivity Logscreen to show theBackupsscreen. The below list of items change when launching an theActivity Logfor theBackupsscreen:Backup.Activity Typechip is being hidden.Rewindableitems.Your first backup will be ready soon.No matching backups found.To test:
My Sitetab.My Site->Toolbar Avatar->App Settings->Test feature configuration.BackupsFeatureConfig, scroll down and click theRESTART THE APPbutton. DO NOT confuse this feature flag with theBackupFeatureConfig(singular). Make sure to enable the right feature flag.My Sitetab and noticeBackupmenu is shown.Activitymenu and verify UI correctness (see above) and that all features work as expected. This is includes but is not limited to:Date RangeandActivity Typefilters.Restore to this pointandDownload backupfrom the menu item.Backupmenu and verify UI correctness (see above) and that all features work as expected. This is includes but is not limited to:Date Rangefilter.Restore to this pointandDownload backupfrom the menu item.This solution is based on the investigation notes here. Below is a summary of the decisions that was made based on that:
filtering after storing in dbapproach chosen above would decrease user experience (ie. 1 rewindable item per 20 items per page) or even worse break it altogether (ie. 0 rewindable items per 20 items per page). As such, the API enhancement is unavoidable and it is already being discussed.Activity Typefilter since the API for this filter is only available for all items. An intermediate solution is still viable, but it has been decided to just hide this filter for now.Activity Logscreen since by not doing so this will create lots of duplicate code.Future:
PR submission checklist:
RELEASE-NOTES.txtif necessary.