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
Add file download support for Android #203
Add file download support for Android #203
Conversation
Hey @smathson, this looks really cool! I'm cloning down your fork and trying it out now. |
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 tested this and it looks/works great.
@andreipfeiffer Would you mind reviewing this ? You spent a lot of time doing the upload so you probably have useful insights on this! 😄 |
Hey guys, Great work @smathson :D I would add in the docs that this permission is required for downloading files. I will also test this in the next days. |
@andreipfeiffer Good idea. Do you think we should add it to https://github.com/react-native-community/react-native-webview/blob/master/docs/Guide.md alongside the File Upload support or somewhere else? |
@smathson you're right, it should definitely go in there. |
Added documentation re: permissions and merged master. |
Hey @smathson, Also, is the |
This reverts commit ecee868.
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.
Looks great to me 👍
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.
Let's ship it.
@Titozzz I'm going to let you push the merge button 😀 |
🎉 This PR is included in version 2.15.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@allcontributors[bot] please add @smathson for code, doc |
I've put up a pull request to add @smathson! 🎉 |
Adds @smathson as a contributor for code, doc. This was requested by Titozzz [in this comment](#203 (comment))
…ative-webview#203) Addresses react-native-webview#80. Caveat: I am not an Android developer. This code comes from a fork of the original RN WebView that we have been using in production for some time, so all credit goes to @Oblongmana: https://github.com/Oblongmana/react-native-webview-file-upload-android. Setting up a DownloadManager for the WebView is pretty straightforward, as is adding any known cookies to the request. Most of the complication comes from the requirement after SDK 23 to ask the user for the WRITE_EXTERNAL_STORAGE permission. Unfortunately there is no mechanism to suspend the download request until permission is resolved so this code stores off the request and sets up a listener that enqueues the download once permissions are resolved so the user experience is really nice. I didn't see anything in the way of tests or documentation that needs to be added for this change, so let me know if I missed anything. Thanks!
# [2.15.0](react-native-webview/react-native-webview@v2.14.3...v2.15.0) (2019-01-07) ### Features * **Android Webview:** Add file download support for Android ([react-native-webview#203](react-native-webview#203)) ([2114a9b](react-native-webview@2114a9b)), closes [react-native-webview#80](react-native-webview#80)
Adds @smathson as a contributor for code, doc. This was requested by Titozzz [in this comment](react-native-webview#203 (comment))
# [2.15.0](react-native-webview/react-native-webview@v2.14.3...v2.15.0) (2019-01-07) ### Features * **Android Webview:** Add file download support for Android ([#203](react-native-webview/react-native-webview#203)) ([2114a9b](react-native-webview/react-native-webview@2114a9b)), closes [#80](react-native-webview/react-native-webview#80)
Adds @smathson as a contributor for code, doc. This was requested by Titozzz [in this comment](react-native-webview/react-native-webview#203 (comment))
Addresses #80.
Caveat: I am not an Android developer. This code comes from a fork of the original RN WebView that we have been using in production for some time, so all credit goes to @Oblongmana: https://github.com/Oblongmana/react-native-webview-file-upload-android.
Setting up a DownloadManager for the WebView is pretty straightforward, as is adding any known cookies to the request. Most of the complication comes from the requirement after SDK 23 to ask the user for the WRITE_EXTERNAL_STORAGE permission. Unfortunately there is no mechanism to suspend the download request until permission is resolved so this code stores off the request and sets up a listener that enqueues the download once permissions are resolved so the user experience is really nice.
I didn't see anything in the way of tests or documentation that needs to be added for this change, so let me know if I missed anything. Thanks!