-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Fix filter multiple MIME types not work in android #50
Conversation
Eg: DocumentPicker.show({ filetype: [DocumentPickerUtil.plainText(), DocumentPickerUtil.pdf(), docIdentifier, docxIdentifier, xlsIdentifier, xlsxIdentifier], }, (error, url) => { alert(url); });
If I can get another look at it by an android dev that'd be nice |
I'm not an android dev but after taking a look at the code and testing it I can say it looks pretty good and works like a charm. The only thing I'm not sure is the replacing of ACTION_OPEN_DOCUMENT by ACTION_GET_CONTENT. The documentation states this:
In this case I don't really know which one is better. ACTION_OPEN_DOCUMENT is not supported before KitKat but neither is react native anyway. @fschai89 could you please explain? |
Remove Android version checking since Intent.ACTION_GET_CONTENT work for Android 16 and above. And also fix for library not work for Android 18 and below.
My 2 cents. I'm importing rather than opening documents, so personally this library not using ACTION_OPEN_DOCUMENT is one of the two reasons I discarded this library and wrote my own internal one. Though given that iOS also has its own |
Actually the current usage of ACTION_OPEN_DOCUMENT/ACTION_PICK is wrong. The iOS side of this library currently only uses Falling back to ACTION_PICK is also wrong since it's intended to be used with a media provider URI, not just a type. You use ACTION_GET_CONTENT when you want to get something of a type. |
I rather have 100% certainty of nothing breaking before merging :/ |
Thanks for your work @fschai89 However the code has changed a fair bit and this PR actually has some issues, namely unused imports presumably leftover from earlier drafts of your code being added and no handling for older versions of Android (EXTRA_MIME_TYPES was added in API level 19, react-native supports all the way back to API level 18). So I went ahead and just wrote a fix myself with fallbacks: 73e2d0a |
@dantman what is the proper solution for this issue ? |
@bhatti-waqas Use v3 |
The filter multiple MIME types work in IOS but not work in android, so I fix it.
Example: