Skip to content
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

Offline mode: Post conflict resolution overlay #20607

Merged
merged 36 commits into from
Apr 12, 2024

Conversation

zwarm
Copy link
Contributor

@zwarm zwarm commented Apr 7, 2024

Fixes #20164

This PR updates the dialogs for post version conflicts and autosave available. Instead of the small android dialog, they are now a full page overlay.

CC @osullivanchris - Any design suggestions or comments? Are we completely off base? Went off the iOS screens.

Before

Version Conflict Autosave

After

Version Conflict Light Version Conflict Dark
Version Conflict Light Selected Version Conflict Dark Selected
Autosave Light Autosave Dark
Autosave Light Selected Autosave Dark Selected

Prepare for testing

  • Install the Jetpack and WordPress apps from this PR
  • Navigate to Me > Debug Settings
  • Enabled the sync_publishing flag and restart the app
  • Prepare a version conflict post and an autosave available post
  • Enable log collection to verify track events

Test Overlay (Run twice - once for Version Conflict & once for Autosave Available)

  • Tap on the post row that shows "Version Conflict" or "You've made unsaved changes to this post"
  • ✅ Verify the correct resolution dialog is shown (see images above)
  • ✅ Verify logs shows the tracking event 🔵 Tracked: resolve_autosave_conflict_screen_shown OR 🔵 Tracked: resolve_conflict_screen_shown
  • Select the checkbox next to Current Device
  • ✅ Verify the Confirm button is enabled
  • Deselect the checkbox next to Current Device
  • ✅ Verify the Confirm button is disabled
  • Select the checkbox next to Another Device
  • ✅ Verify the Confirm button is enabled
  • Deselect the checkbox next to Another Device
  • ✅ Verify the Confirm button is disabled
  • Tap on the "X" to close the overlay
  • ✅ Verify the overlay is closed
  • ✅ Verify logs shows the tracking event 🔵 Tracked: resolve_autosave_conflict_close_tapped OR 🔵 Tracked: resolve_conflict_close_tapped
  • Reopen the same post from the post list to relaunch the Version Conflict & once for Autosave Available overlay
  • Tap on the "Cancel" button to close the overlay
  • ✅ Verify the overlay is closed
  • ✅ Verify logs shows the tracking event 🔵 Tracked: resolve_autosave_conflict_cancel_tapped OR 🔵 Tracked: resolve_conflict_cancel_tapped
  • Reopen the same post from the post list to relaunch the Version Conflict & once for Autosave Available overlay
  • Select the Current Device and tap confirm
  • ✅ Verify the overlay closes
  • ✅ Verify logs shows the tracking event 🔵 Tracked: resolve_conflict_confirm_tapped, Properties: {"confirm_type":"local_version"} OR 🔵 Tracked: resolve_conflict_confirm_tapped, Properties: {"confirm_type":"remote_version"} OR 🔵 Tracked: resolve_autosave_conflict_confirm_tapped, Properties: {"confirm_type":"local_version"} OR 🔵 Tracked: resolve_autosave_conflict_confirm_tapped, Properties: {"confirm_type":"remote_version"}
  • ✅ Verify the post was updated with the other device version

Regression Notes

  1. Potential unintended areas of impact
    The post conflicts are not resolved properly

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Added PostResolutionOverlayViewModelTest and PostResolutionOverlayAnalyticsTrackerTest

  3. What automated tests I added (or what prevented me from doing so)
    Relied on existing instrumentation tests


PR Submission Checklist:

  • I have completed the Regression Notes.
  • 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.

Testing Checklist (strike-out the not-applying and unnecessary ones):

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@dangermattic
Copy link
Collaborator

dangermattic commented Apr 7, 2024

3 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ This PR is assigned to the milestone 24.7. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 7, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20607-0f4f175
Commit0f4f175
Direct Downloadwordpress-prototype-build-pr20607-0f4f175.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 7, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20607-0f4f175
Commit0f4f175
Direct Downloadjetpack-prototype-build-pr20607-0f4f175.apk
Note: Google Login is not supported on these builds.

@zwarm zwarm requested a review from AjeshRPai April 10, 2024 23:55
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

Attention: Patch coverage is 37.37624% with 253 lines in your changes are missing coverage. Please review.

Project coverage is 40.38%. Comparing base (f833f0b) to head (0f4f175).
Report is 89 commits behind head on trunk.

Files Patch % Lines
...ordpress/android/ui/posts/PostResolutionOverlay.kt 0.00% 170 Missing ⚠️
...wordpress/android/ui/posts/PostListDialogHelper.kt 6.12% 46 Missing ⚠️
...android/ui/posts/PostResolutionOverlayViewModel.kt 83.33% 2 Missing and 14 partials ⚠️
...ordpress/android/ui/posts/PostListMainViewModel.kt 50.00% 7 Missing and 1 partial ⚠️
...s/android/ui/posts/PostResolutionOverlayUiState.kt 87.09% 3 Missing and 1 partial ⚠️
...ordpress/android/ui/uploads/PostUploadHandler.java 0.00% 3 Missing ⚠️
...ava/org/wordpress/android/util/DateUtilsWrapper.kt 0.00% 3 Missing ⚠️
...rg/wordpress/android/ui/posts/PostActionHandler.kt 50.00% 1 Missing ⚠️
...ress/android/ui/posts/editor/StorePostViewModel.kt 50.00% 1 Missing ⚠️
...org/wordpress/android/util/DateTimeUtilsWrapper.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #20607      +/-   ##
==========================================
- Coverage   40.39%   40.38%   -0.02%     
==========================================
  Files        1474     1479       +5     
  Lines       67906    68276     +370     
  Branches    11226    11281      +55     
==========================================
+ Hits        27433    27570     +137     
- Misses      37994    38211     +217     
- Partials     2479     2495      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zwarm zwarm marked this pull request as ready for review April 11, 2024 19:15
@zwarm zwarm modified the milestones: 24.6 ❄️, 24.7 Apr 11, 2024
@pantstamp
Copy link
Contributor

Hey @zwarm ! Awesome work!

I reviewed the code and tested the app. I found the following:

  1. Minor Issue: When the configuration is changed to landscape mode and the user scrolls down to view content, attempting to scroll back up can unintentionally dismiss the bottom sheet dialog due to overlapping gestures. Please refer to the recording for a demonstration. Perhaps we could consider creating a future PR to introduce a different layout for landscape mode that eliminates the need for scrolling. This is not a blocker for approving this PR.
  2. Major Issue: During testing of the configuration changes, I observed that confirming the conflict resolution sometimes triggers multiple toasts. It's unclear whether this issue occurs solely on orientation change or if it also happens when we dismiss and reopen the dialog. I will investigate further, as I consider this a blocker. Please review the recording for more details.

Copy link

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
2.2% Duplication on New Code

See analysis details on SonarCloud

@pantstamp
Copy link
Contributor

@zwarm I've pushed a fix for the major issue mentioned earlier. The problem was that we weren't checking whether the PostListMainViewModel had already been started. Consequently, during a configuration change, multiple instances of the PostListEventListener object were being created. These instances were triggering multiple events to the PostConflictResolver object, resulting in multiple toasts being displayed to the user.

I have tested the changes and they have resolved the issue, so I am approving the PR!

Copy link
Contributor

@pantstamp pantstamp left a comment

Choose a reason for hiding this comment

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

Great work! LGTM!

@pantstamp pantstamp merged commit 0f6f547 into trunk Apr 12, 2024
21 checks passed
@pantstamp pantstamp deleted the issue/20164-conflict-resolution-dialog branch April 12, 2024 11:27
@zwarm
Copy link
Contributor Author

zwarm commented Apr 12, 2024

@zwarm I've pushed a fix for the major issue mentioned earlier. The problem was that we weren't checking whether the PostListMainViewModel had already been started. Consequently, during a configuration change, multiple instances of the PostListEventListener object were being created. These instances were triggering multiple events to the PostConflictResolver object, resulting in multiple toasts being displayed to the user.

@pantstamp - this was a great find. I recall other reports of multiple toasts showing. Thanks for the fix. 🙇

@zwarm
Copy link
Contributor Author

zwarm commented Apr 12, 2024

Minor Issue: When the configuration is changed to landscape mode and the user scrolls down to view content, attempting to scroll back up can unintentionally dismiss the bottom sheet dialog due to overlapping gestures.

Thanks for the video, I wonder if we should disallow swipe to close on landscape? Probably not, but we can try it.

@osullivanchris
Copy link

Hey I think its a good idea to use the Whats New format (also similar to Bloganuary) which it looks like you've done. I've just tidied up the type styles and stuff more appropriate for this case. I didn't have a modal and x button to hand but what you have there is fine.

image

Figma link eYeHXEMDbnFptE40xUqZ2T-fi-2551%3A6479

Copy link

sentry-io bot commented Apr 14, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ApplicationNotResponding: ANR for at least 5000 ms. org.wordpress.android.ui.posts.PostsListActivit... View Issue

Did you find this useful? React with a 👍 or 👎

@zwarm
Copy link
Contributor Author

zwarm commented Apr 29, 2024

@osullivanchris - Thank you for the feedback, but somehow I missed the GH ping 🤦 . I'll add a new ticket to make this adjustments in an upcoming version.

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.

Offline Mode: Resolve Conflict
5 participants