-
Notifications
You must be signed in to change notification settings - Fork 58
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
Cross Platform MediaUpload component #1298
Comments
Please also check the MediaUpload usage on gallery block(gutenberg/packages/block-library/src/gallery/edit.js). At the end of this work we expect it will work for mobile without changing it. |
Hey @pinarol, thanks for a great description 🥇
We have a free plan on wordpress.com so probably we would need that :) |
I invited you to my test site. After accepting the invitation you should be able to see it under 'My Sites' in the mobile app. |
We can go with 2 iterations: First we can just focus on video, image blocks. They both allow selecting a single file at once and they are both available for testing. For the second iteration we can focus on the usage on gallery which allows multiple selection. |
Hey :) I'm looking at possibilities of adding multiple images/videos with However, the implementation of iOS is different. We don't have the possibility to select more than one media at one time as on Android. The suggested change will work on iOS as well but also would require changes in native client I think that with the current implementation, we are not able to handle |
@dratwas correct, |
It seems automation couldn't close this one, I'll do it. |
We already have MediaUpload for mobile and web but they have different props. We need to refactor the mobile implementation(gutenberg/packages/block-editor/src/components/media-upload/index.native.js) to work with same props with web.
Note that some props might be web specific and not needed by mobile.
We'll also need to update the unittests: gutenberg/packages/block-editor/src/components/media-upload/test/index.native.js
MediaUpload component is currently used by image, video blocks
Here are the mobile side edit implementations for them:
gutenberg/packages/block-library/src/image/edit.native.js
gutenberg/packages/block-library/src/video/edit.native.js
MediaUpload component opens the media options picker on mobile. And then it calls the media picker from the main apps:
To investigate/debug the web part:
cd to gutenberg
npm install
npm run dev
At another terminal:
docker-compose up
This page has more detailed instructions in case you might need.
Keep in mind that mobile unit-tests(
yarn test
) might fail if gutenberg-mobile/gutenberg/node_modules has modules in it. So the ideal way is checking out another gutenberg repo and running the code from there.To test
Testing prerequisites
Media upload isn't supported by free sites so if you only have a free site let us know your WordPress.com user names and we can arrange a test site for you.
For WPiOS
Checkout the PRs branch to any arbitrary folder and cd .. to it
run yarn install, yarn start
Open XCode WPiOS on the latest develop
Clean build folder on Xcode, and then run the app
For WPAndroid
open grade.properties at WordPress-Android folder
add wp.BUILD_GUTENBERG_FROM_SOURCE = true to grade.properties
checkout the PRs branch in the subrepo of WordPress-Android repo
cd to WordPress-Android/libs/gutenberg-mobile
run yarn install, yarn start
yarn wpandroid on a separate terminal in the same directory
Make sure nothing is broken by running these test cases on WPiOS and WPAndroid main apps:
https://wordpress-mobile.testquality.com/project/6587/plan/11494/run/110694/result/1362089
You can use example app on ios by
yarn ios
for quick testing, there's a fake upload and upload fail mechanisms available there. If you long press on the ongoing upload it'll turn into a failed upload.To run unittests simply run 'yarn test'
The text was updated successfully, but these errors were encountered: