feat: Implement LatestContentProvider for WebView recovery#22774
Conversation
Allow GutenbergKit to retrieve the latest content persisted in the host app as needed. This is important for allowing GutenbergKit to display the latest content after the WebView reloads or re-initializes from memory pressure or backgrounding.
|
|
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## jkmassel/gutenbergkit-settings-refactor #22774 +/- ##
========================================================================
Coverage 37.40% 37.40%
========================================================================
Files 2320 2320
Lines 123654 123658 +4
Branches 16793 16795 +2
========================================================================
+ Hits 46256 46258 +2
- Misses 73687 73689 +2
Partials 3711 3711 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Integrate an unrelated content loss fix that is necessary for testing this branch's focus on content preservation.
| gravatar = '2.5.0' | ||
| greenrobot-eventbus = '3.3.1' | ||
| gutenberg-kit = 'v0.15.0' | ||
| gutenberg-kit = '432-944fbfce704642cfe725dc69c03b3cf6d5018854' |
There was a problem hiding this comment.
This integrates the bug fix from wordpress-mobile/GutenbergKit#432, which is required for testing the LatestContentProvider's ability to preserve content persistence through WebView reloads.
Once wordpress-mobile/GutenbergKit#432 merges, this should be updated to point to a new release containing that fix.
Project dependencies changeslist! Upgraded Dependencies
org.wordpress.gutenbergkit:android:432-944fbfce704642cfe725dc69c03b3cf6d5018854, (changed from v0.15.0)tree +--- project :libs:editor
-| \--- org.wordpress.gutenbergkit:android:v0.15.0
+| \--- org.wordpress.gutenbergkit:android:432-944fbfce704642cfe725dc69c03b3cf6d5018854
-\--- org.wordpress.gutenbergkit:android:v0.15.0 (*)
+\--- org.wordpress.gutenbergkit:android:432-944fbfce704642cfe725dc69c03b3cf6d5018854 (*) |
jkmassel
left a comment
There was a problem hiding this comment.
Tested on-device, no data loss
| * Returns the persisted post title for content recovery after WebView refresh. | ||
| * @return The most recently persisted title from autosave. | ||
| */ | ||
| String getPersistedTitle(); |
There was a problem hiding this comment.
Because this is a Java file, we should have @ NonNull for this (and getPersistedContent)
0203851
into
jkmassel/gutenbergkit-settings-refactor


Description
Ref CMM-1123.
This is a rebased version of #22493 (which was tested and approved). This now targets the
jkmassel/gutenbergkit-settings-refactorbranch (#22764) so it can be reviewed/tested on top of the GutenbergKit v0.15.0 upgrade.Implements GutenbergKit's
LatestContentProviderinterface for pull-based content recovery.When the WebView reinitializes (due to OS memory pressure or page refresh), the editor now requests the latest content from the app rather than using stale content from the initial WebView load. This ensures users don't lose their work during WebView recovery.
Changes:
getPersistedTitle()andgetPersistedContent()methods toEditorFragmentListenerinterfaceLatestContentProvideronGutenbergViewinGutenbergKitEditorFragmentGutenbergKitActivityreturning content fromEditPostRepositoryRebase notes:
EditorConfigurationBuilderto the new builder API:setStatus(...)→setPostStatus(...)and removed the now-redundantsetPostType(...)call (postType is a constructor argument)Related PRs:
Testing instructions
WebView refresh recovery:
chrome://inspect