-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
GB finish uploads out of editor #10954
Conversation
WordPress/WordPressTest/Gutenberg/GutenbergImgUploadProcessorTests.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergImgUploadProcessor.swift
Outdated
Show resolved
Hide resolved
if media.remoteStatus == .failed { | ||
return | ||
} | ||
if media.mediaType == .image { | ||
let imgPostUploadProcessor = ImgUploadProcessor(mediaUploadID: mediaUploadID, remoteURLString: remoteURLStr, width: media.width?.intValue, height: media.height?.intValue) | ||
postContent = imgPostUploadProcessor.process(postContent) | ||
let gutenbergImgPostUploadProcessor = GutenbergImgUploadProcessor(mediaUploadID: gutenbergMediaUploadID, serverMediaID: mediaID, remoteURLString: remoteURLStr) |
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.
Is this replacing the post content for all posts, not just those in Gutenberg?
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.
So we apply both processors on all posts, but only the GB ones will be affected for the processor, because they have a different format for the media uploads ids.
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.
Hey @SergioEstevao ! This is working great 🎉
There is one small detail:
When I open gutenberg with an upload running, there is a warning saying
Sending 'mediaUpload' with no listeners registered
That happens when we try to send messages to RN too early, and the JS is not loaded yet.
There is a isJSLoaded
property in Gutenberg.swift that we can use in these cases, and avoid sending messages before the bridge is ready.
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.
Thank you @SergioEstevao for the fixes, it's working great! 🎉
Fixes wordpress-mobile/gutenberg-mobile#206
This PR adds the possibility to async publish Post on GB while images are uploading.
To test: