-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[RNMobile] Using deferredEventEmitter to wait for the Editor to be mounted before issuing replaceBlock signal #27944
Conversation
…e issuing the replaceBlock signal for edited Stories
Size Change: 0 B Total Size: 1.37 MB ℹ️ View Unchanged
|
…ks just loaded in mobile gutenberg can signal the native app of which new clientIds they've been loaded with
.../src/main/java/org/wordpress/mobile/ReactNativeGutenbergBridge/GutenbergBridgeJS2Parent.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mzorz just an update here. I did a first pass on the code. I am going to do another review soon and run some tests so that I can verify the changes made here in connection with the other PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for these changes @mzorz Looks good to me! LGTM 🚢
Description
This PR aims at approaching the edition of Stories on mobile by using the
deferredEventEmitter
instead of passing a live callback, which would otherwise get lost if the GutenbergEditor gets killed when opening the Story composer (for Story block editing) on Android and the system decides to claim memory.This approach seems to work, except for the following problem: the
clientId
of a block will not be the same anymore in between Editor startups, so we can't use theblockId
as a means of identifying which Story block to replace. This is what happens on WPAndroid:Given this, we're using some new bridge signals to let the native side know when a Story block has been loaded (after a Gutenberg fireup) passing its newly assigned clientId, and the native side can compare whether this block needs to be replaced with a new one or not by calculating a hash on its contents as seen in the WPAndroid PR.
In summary, this PR basically adds these changes:
mediaFilesBlockReplaceSync
that gets triggered every time a Story block is loadedUnrelated changes
requestMediaFilesEditorLoad
How has this been tested?
Use WPAndroid PR wordpress-mobile/WordPress-Android#13699
Gutenberg mobile PR wordpress-mobile/gutenberg-mobile#2949
Jetpack PR Automattic/jetpack#18540
Related stories library PR Automattic/stories-android#632
Screenshots
Types of changes
Checklist: