-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[RNMobile] File block basics #26278
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
[RNMobile] File block basics #26278
Conversation
|
Size Change: 0 B Total Size: 1.19 MB ℹ️ View Unchanged
|
|
@marecar3 - Could you please check the JS side changes? 🙏 Thank you all! |
|
I will be looking into this tomorrow 👍 |
jd-alexander
left a comment
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.
I did a first pass and the changes look good. I am going to be doing a more detailed run-through on Monday and I will share my findings then 🙏
| func presentPicker(origin: UIViewController, filters: [Gutenberg.MediaType], multipleSelection: Bool, callback: @escaping MediaPickerDidPickMediaCallback) { | ||
| let uttypeFilters = filters.compactMap { $0.typeIdentifier } | ||
| mediaPickerCallback = callback | ||
| let docPicker = UIDocumentPickerViewController(documentTypes: uttypeFilters, in: .import) |
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.
This initializer looks like it was recently deprecated in iOS 14: https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller
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.
Nice catch!
We will need to update WPiOS too at some point 🤔
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 something best left out of here? Maybe we can create an issue for it and come back later, wdyt?
guarani
left a comment
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.
New block! 😀
Left some comments regarding the iOS side of things, will return once the bundles are added here to give it a test on iOS.
|
Uploading a file from WPiOS is working well ✅ I have some comments and questions:
|
|
Thank you for the detailed review @guarani ! This PR is meant to implement the very basics of the block, most of the points mentioned (and anything outside the bullets to test) are being currently worked on a next PR, or are planed for later: 1 and 4: are design details to be handled later. Will probably find and implement fixed for 2 and 7 in the following up PRs. If uploads work as expected, I'd prefer to go ahead with the next set of PR if possible :) |
|
Hey, 👋 @guarani @jd-alexander would you be able to test WPAndroid PR? Thanks. |
Yes of course. I will get it another test 🙏🏾 |
@etoledom thanks for clarifying. It's hard to gauge what are known issues and what might have slipped through, so I defaulted to reporting anything I noticed that seemed out of place while testing the basic flow. |
jd-alexander
left a comment
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.
| */ | ||
| import styles from './style.scss'; | ||
|
|
||
| export default class FileEdit extends Component { |
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.
@etoledom :) not sure if this was asked elsewhere but I am just checking on the reason we are using a class component instead of a function component since function components lessen the amount of code in a component primarily with the use of hooks.
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.
This was my starting point as I based it on another block. But I agree we should have this as a function component.
I had this planned after merging the second round of PR (that was when I noticed we should do this). Luckily the rewrites to functions are not complex.
guarani
left a comment
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.
- Add a File block.
- Upload a file from the device.
- Check that you are able to upload images, videos, audio, pdf... but not allowed to upload txt files.
- On the example app, since we can't upload a file, the HREF will remind as local after the fake upload finishes.
- Check that you can edit the file name and the Download button text.
- Check on preview that you can download the uploaded file.
Tested images (HDR photos don't work, but I noticed they're not allowed on the web, so that's probably OK — JPEGs worked), tested video and MOV was greyed out, tested audio (WAV and AIFF) but both appeared greyed out in the iOS file picker, tested PDFs and they worked fine.
Could you please clarify @etoledom if this is expected?
|
@guarani - The allowed file types depend on the kind of site.
For a premium site, these are the allowed filetypes:
We now have |
guarani
left a comment
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.
Thanks for the info @etoledom, looks good to me then.
8bf08a3 to
bfceb2c
Compare


Description
Gutenberg Mobile PR: wordpress-mobile/gutenberg-mobile#2743
WPiOS PR: wordpress-mobile/WordPress-iOS#15122
WPAndroid PR: wordpress-mobile/WordPress-Android#13178
This is a first step on implementing File Block.
This implementation only considers the basics:
The rest of features will be implemented in future PRs
EDIT:

PICK A FILEhas been changed toCHOOSE A FILE.To test:
Checklist: