You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to add a mechanism to the main apps for Gallery block that will update the post html if uploads are completed during the time block editor is closed. During the upload of a media, we use temporary IDs and local urls in the block html, but once the upload is completed, temporary IDs need to be replaced with remote IDs, similarly local urls needs to be replaced with remote urls.
We already have a similar mechanism for Image, Video, Media-Text blocks but Gallery will be more tricky because now we'll need to handle multiple upload complete events.
Android part is here inside src/main/java/org/wordpress/android/ui/posts/PostUtils.java
iOS part is inside GutenbergImgUploadProcessor.swift and GutenbergVideoUploadProcessor.swift
Describe the solution you'd like
We should avoid race conditions that can be caused by multiple uploads getting completed pretty closely.
Another challenge is, the html of gallery is much more complex than single-media blocks we have so far and we'll need a smarter mechanism to find the block associated with the recently completed upload. Same is true for the replacement mechanism.
The solution should not depend on the attribute order since there's no guarantee that attributes will be sorted in a certain way. We have a work in progress issue to fix this for Image, Video, Media-Text. This is sorted on iOS but in progress on Android. We don't need to wait for this issue to be fixed to start Gallery as it will need a different kind of matching mechanism anyway, but still let's keep an eye on what kind of approach is used in that issue and see if we are aligned.
Also, I highly suggest making this development by using unit-tests as it is not very practical to wait for an upload to complete whenever we want to test the solution.
Technical alignment between iOS and Android is another important thing.
Additional context
Since Gallery is not merged yet this PR's branch should be used for having Gallery: #1498
We need to add a mechanism to the main apps for Gallery block that will update the post html if uploads are completed during the time block editor is closed. During the upload of a media, we use temporary IDs and local urls in the block html, but once the upload is completed, temporary IDs need to be replaced with remote IDs, similarly local urls needs to be replaced with remote urls.
We already have a similar mechanism for Image, Video, Media-Text blocks but Gallery will be more tricky because now we'll need to handle multiple upload complete events.
Android part is here inside
src/main/java/org/wordpress/android/ui/posts/PostUtils.java
iOS part is inside
GutenbergImgUploadProcessor.swift
andGutenbergVideoUploadProcessor.swift
Describe the solution you'd like
We should avoid race conditions that can be caused by multiple uploads getting completed pretty closely.
Another challenge is, the html of gallery is much more complex than single-media blocks we have so far and we'll need a smarter mechanism to find the block associated with the recently completed upload. Same is true for the replacement mechanism.
The solution should not depend on the attribute order since there's no guarantee that attributes will be sorted in a certain way. We have a work in progress issue to fix this for Image, Video, Media-Text. This is sorted on iOS but in progress on Android. We don't need to wait for this issue to be fixed to start Gallery as it will need a different kind of matching mechanism anyway, but still let's keep an eye on what kind of approach is used in that issue and see if we are aligned.
Also, I highly suggest making this development by using unit-tests as it is not very practical to wait for an upload to complete whenever we want to test the solution.
Technical alignment between iOS and Android is another important thing.
Additional context
Since Gallery is not merged yet this PR's branch should be used for having Gallery: #1498
This is a subtask for completing Mobile gallery block - Upload options
The text was updated successfully, but these errors were encountered: