Skip to content
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

Image set via parent media library picker #220

Merged
merged 7 commits into from
Nov 6, 2018

Conversation

hypest
Copy link
Contributor

@hypest hypest commented Nov 5, 2018

Addresses #192 for the Android side of the Bridge.

This PR adds a function to the bridge interface to trigger the media library image picker on the parent native app. The function provides a callback for the Bridge to invoke to send the selected image URL back into RN.

Depends on the GB repo PR (needs merge first): WordPress/gutenberg#11511

To test (Android):

  1. Use the feature/integrate-gutenberg-image-set branch from https://github.com/wordpress-mobile/WordPress-Android. PR here.
  2. update all submodules at every level
  3. Run yarn wpandroid at the wpandroid root to compile the native app, run Metro, install and run the mobile app in a single command
  4. Open a GB post in wpandroid and add a new image block
  5. Tap on the "MEDIA LIBRARY" button and select an image from the media library
  6. App should update the block and show the image

* Wire up the "MEDIA LIBRARY" Image block button
* Relay to the parent via the bridge, to launch the media picker
* Listen for parent's response
* Broadcast an action to set the focused image's URL
* Reducer set's the focused image's URL
Which also removes the Store/Reducer action to update the image url.
This now gets us closer to the way Gutenberg-web does the update.
@hypest hypest force-pushed the feature/embedded-in-parent-app-image-set branch from 37497a8 to 2d7a7b6 Compare November 5, 2018 21:09
@hypest
Copy link
Contributor Author

hypest commented Nov 5, 2018

cc @etoledom as you might want to have a peak at the Bridge change proposal here. Check out https://github.com/wordpress-mobile/gutenberg-mobile/pull/220/files#diff-0ae1e2c19a7a43836c4694c61985e963R6

Copy link
Contributor

@pinarol pinarol left a comment

Choose a reason for hiding this comment

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

Tested via WordPress-Android app

  • Open a post
  • Create image block
  • Tap "Media Library"
  • Pick an image from WP media library
  • Verify that image block is updated with the selected image
  • Set a caption for the image
  • Repeat these steps multiple times to see if multiple image blocks can be added&updated

@etoledom
Copy link
Contributor

etoledom commented Nov 6, 2018

Using the JS callback looks like a good approach!

I checked out the Android side to compare with iOS and it seems like the Media Pickers work in a similar way: providing the selected image via "delegate" callback.

So I believe that the WPiOS side implementation will be quite similar too. ✅

@hypest hypest merged commit 9a4c5fc into master Nov 6, 2018
@hypest hypest deleted the feature/embedded-in-parent-app-image-set branch November 6, 2018 16:30
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.

3 participants