{"action":"created","issue":{"url":"https://api.github.com/repos/Elyx0/react-native-document-picker/issues/69","repository_url":"https://api.github.com/repos/Elyx0/react-native-document-picker","labels_url":"https://api.github.com/repos/Elyx0/react-native-document-picker/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/Elyx0/react-native-document-picker/issues/69/comments","events_url":"https://api.github.com/repos/Elyx0/react-native-document-picker/issues/69/events","html_url":"https://github.com/Elyx0/react-native-document-picker/issues/69","id":259312819,"number":69,"title":"[RFC] 3.0.0","user":{"login":"dantman","id":53399,"avatar_url":"https://avatars2.githubusercontent.com/u/53399?v=4","gravatar_id":"","url":"https://api.github.com/users/dantman","html_url":"https://github.com/dantman","followers_url":"https://api.github.com/users/dantman/followers","following_url":"https://api.github.com/users/dantman/following{/other_user}","gists_url":"https://api.github.com/users/dantman/gists{/gist_id}","starred_url":"https://api.github.com/users/dantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantman/subscriptions","organizations_url":"https://api.github.com/users/dantman/orgs","repos_url":"https://api.github.com/users/dantman/repos","events_url":"https://api.github.com/users/dantman/events{/privacy}","received_events_url":"https://api.github.com/users/dantman/received_events","type":"User","site_admin":false},"labels":[{"id":704051412,"url":"https://api.github.com/repos/Elyx0/react-native-document-picker/labels/next%20version","name":"next version","color":"c5def5","default":false},{"id":704051209,"url":"https://api.github.com/repos/Elyx0/react-native-document-picker/labels/v3","name":"v3","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":24,"created_at":"2017-09-20T21:50:10Z","updated_at":"2018-05-16T07:50:10Z","closed_at":null,"author_association":"COLLABORATOR","body":"I had a number of issues with the implementation of this library, enough that I ditched it and started working on my own document picker implementation internally to fit my needs.\r\n\r\nI'd be willing to instead help overhaul this library if the community and package owner are willing to accept the changes I want to make.\r\n\r\n- [x] *iOS* idea: <s>The `hfsTypeCode` should be used to attempt to return a mime type. (hfsTypeCode doesn't seem to return anything)</s> Use Apple's UTI handling to implicitly get a mime type from a file extension.\r\n- [x] *iOS* bug: A callback should be called with an error instead of exiting and never responding.\r\n- [x] *iOS* bug: Migrate from the deprecated [`UIDocumentMenuViewController`](https://developer.apple.com/documentation/uikit/uidocumentmenuviewcontroller) to [`UIDocumentPickerViewController`](https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller).\r\n- [x] *Android*: `ACTION_PICK` should never be used, it is intended for choosing data from a media provider, not choosing any document of a mime type.\r\n- [x] *Android*: `ACTION_GET_CONTENT` should be used by default instead of `ACTION_OPEN_DOCUMENT` to match the intent of the iOS behavior: iOS declares the mode as `import` rather than `open`, which matches the semantics of `ACTION_GET_CONTENT` (just reading/importing data) rather than `ACTION_OPEN_DOCUMENT` (long term persistent access to a document/editing of it).\r\n  - [ ] *Optional:* We could provide an option to allow the user to choose between import/get_content mode and persistent open mode. Maybe a `mode`, `forOpen: true`, or `persistent` option.\r\n- [x] *Android*: Intent handler should guard against nonexistent current activity and failure to show the document picker due to a throw.\r\n- [x] Support multiple document selection: Do this with a second method that always returns a promise for an array to keep the possibility of supporting flow types (rename `show` -> `pick` and add `pickMultiple`). I already have code for this on Android. On iOS support for this is [coming in iOS 11](https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller/2902365-allowsmultipleselection).\r\n- [x] Return a Promise instead of using a callback: RN's native documentation recommends using promises for async js/native handling instead of callbacks (callbacks to native on iOS are marked as experimental). And almost all of react-navigation's own public APIs now use Promises instead of callbacks.\r\n- [x] Errors returned by the library should include a string error code that makes it possible to identify the error.\r\n- [x] Add a `.isCancel(err)` method to check if an error is due to the user canceling the document picking and actually bother to check for `Activity.RESULT_CANCELED`.\r\n- [x] `filetype` is poorly named, refactor this to just `type`.\r\n- [x] *Android*: A document picker should **not** implicitly download a file if it gets a network URL.\r\n- [x] *Android*: Use `getInt(sizeIndex)` to get the file size, it should not be [converted to a string and than parsed back into an int](https://github.com/Elyx0/react-native-document-picker/blob/master/android/src/main/java/com/reactnativedocumentpicker/DocumentPicker.java#L167-L169).\r\n- [x] *Android*: Drop all file path and http handling from the document picker. Both [`ACTION_GET_CONTENT`](https://web.archive.org/web/20120520065829/http://developer.android.com:80/reference/android/content/Intent.html#ACTION_GET_CONTENT) and [`ACTION_OPEN_DOCUMENT`](https://developer.android.com/reference/android/content/Intent.html#ACTION_OPEN_DOCUMENT) explicitly state that the URI returned by the intent must be a `content:` URI that can be used with a content provider.\r\n- [x] *Android*: Update content resolver handler to use `DocumentsContract.Document.COLUMN_MIME_TYPE` on KitKat+ instead of just `getType` to get the mime type.\r\n- [x] Change `fileName` to `name`: The DISPLAY_NAME on Android is not guaranteed to be a file name.\r\n- [x] `DocumentPickerUtil` should use `Platform.OS === 'ios'` instead of `Platform.OS === 'android'`.\r\n- [x] Default to an `*/*`/`allFiles` when type is not defined.\r\n- [x] Cleanup the public API: `DocumentPicker` should be the default export. And types selection should not be named \"*Util\" or require a verbose extra import. I recommend `DocumentPicker.types.images`. The function invocation can safely be dropped while still avoiding `{type: DocumentPicker.types.somethingThatDoesNotExist}` bugs and supporting \"allFiles by default\" by checking for types that are undefined but are present (ie: `'type' in opts` is true but `opts.type === undefined`) and a similar test for arrays.\r\n- [x] *Android*: Rename `DocumentPicker.java` to `DocumentPickerModule.java` and `ReactNativeDocumentPicker.java` to `DocumentPickerPackage.java`.\r\n- [x] `com.reactnativedocumentpicker` is a poor namespace name that's a reverse domain that this project does not own, refactor the library to use a github repo based namespace.\r\n- [x] Add a warning when native code is not available\r\n- [x] Make sure a chooser is used on Android API level 18 where the new DocumentProvider picker is not available\r\n- [x] #50 Fix make `type` option with more than 1 types work on Android"},"comment":{"url":"https://api.github.com/repos/Elyx0/react-native-document-picker/issues/comments/389427722","html_url":"https://github.com/Elyx0/react-native-document-picker/issues/69#issuecomment-389427722","issue_url":"https://api.github.com/repos/Elyx0/react-native-document-picker/issues/69","id":389427722,"user":{"login":"piranna","id":532414,"avatar_url":"https://avatars1.githubusercontent.com/u/532414?v=4","gravatar_id":"","url":"https://api.github.com/users/piranna","html_url":"https://github.com/piranna","followers_url":"https://api.github.com/users/piranna/followers","following_url":"https://api.github.com/users/piranna/following{/other_user}","gists_url":"https://api.github.com/users/piranna/gists{/gist_id}","starred_url":"https://api.github.com/users/piranna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piranna/subscriptions","organizations_url":"https://api.github.com/users/piranna/orgs","repos_url":"https://api.github.com/users/piranna/repos","events_url":"https://api.github.com/users/piranna/events{/privacy}","received_events_url":"https://api.github.com/users/piranna/received_events","type":"User","site_admin":false},"created_at":"2018-05-16T07:50:10Z","updated_at":"2018-05-16T07:50:10Z","author_association":"NONE","body":"In my company we have extended `react-native-document-picker` to add option to pick images from the camera both for Android and iOS, and maybe we would extend it to also pick videos and audios, at least for Android. Web platform already does it in mobile due to how the `input` tag works (nobody has implemented this in desktop, I'm thinking if I should do a polyfill...) but didn't add this feature on Windows because that platform was not a requeriment of our client. Would this feature make the cut to be included in 3.0.0 if we do a pull-request?"}}
{"actor":{"display_login":"piranna"}}