Skip to content

Conversation

@mzorz
Copy link
Contributor

@mzorz mzorz commented Jan 25, 2019

This PR adds the needed interfaces to make Gutenberg start receiving upload progress updates when it's shown on the screen, for images that exist within the open Post that are currently being uploaded.

This can be tested with the WPAndroid PR wordpress-mobile/WordPress-Android#9129

Related Gutenberg PR:
WordPress/gutenberg#13516

Notes:

  • refactored the MediaUploadCallback implementation a bit as it's needed to be passed to 3 interfaces (onCapturePhotoPressed, onUploadMediaPressed, and now also onImageQueryReattach)
  • this new interface allows the listener to be set on the bridge, updates were already being listened to
  • also, the hosting app can start sending latest max progress updates once the Image component calls the new interface from componentDidUpdate() in Introduce onImageQueryReattach interface WordPress/gutenberg#13516 instead of waiting for the next update (this is useful for slow connections where there would be a gap between the time the user opens the Editor and an update is actually seen)

return RNReactNativeGutenbergBridge.onCapturePhotoPressed( callback );
}

export function onImageQueryReattach( callback ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we send up what is the ID of the media we want to reattach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not necessary to be passed here at all, as all we need to do is to tell the parent app which the new callback is so it can be set in this line here.
Later the events are being broadcasted and there we tell the listeners which progress is being made for which mediaId.

@mzorz mzorz merged commit 1d8bb72 into develop Jan 28, 2019
@mzorz mzorz deleted the media_upload_progress_reattach_android branch January 28, 2019 14:11
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.

4 participants