diff options
author | Allan Wang <me@allanwang.ca> | 2017-10-13 20:32:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-13 20:32:00 -0400 |
commit | 4ad2d23ceccc23f8b11b0a5e712a1f08722611df (patch) | |
tree | 3cd9cb8217ac7125db56160ff20ba2c6cebe5e91 /app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt | |
parent | 32ff6c3269abb81289160aa6f9f55c14369c99a3 (diff) | |
download | frost-4ad2d23ceccc23f8b11b0a5e712a1f08722611df.tar.gz frost-4ad2d23ceccc23f8b11b0a5e712a1f08722611df.tar.bz2 frost-4ad2d23ceccc23f8b11b0a5e712a1f08722611df.zip |
Revert/mediapicker (#407)
* Remove kau mediapicker
* Allow cancellation and clean up
* Fix up downloader
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt index 64fb130f..ac9745f9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Downloader.kt @@ -8,6 +8,8 @@ import android.os.Environment import android.webkit.URLUtil import ca.allanwang.kau.permissions.PERMISSION_WRITE_EXTERNAL_STORAGE import ca.allanwang.kau.permissions.kauRequestPermissions +import ca.allanwang.kau.utils.string +import com.pitchedapps.frost.R import com.pitchedapps.frost.dbflow.loadFbCookie @@ -20,14 +22,12 @@ fun Context.frostDownload(url: String, userAgent: String, contentDisposition: St L.d("Received download request", "Download $url") kauRequestPermissions(PERMISSION_WRITE_EXTERNAL_STORAGE) { granted, _ -> if (!granted) return@kauRequestPermissions - val request = DownloadManager.Request(Uri.parse(url)) - request.setMimeType(mimeType) val cookie = loadFbCookie(Prefs.userId) ?: return@kauRequestPermissions request.addRequestHeader("cookie", cookie.cookie) request.addRequestHeader("User-Agent", userAgent) - request.setDescription("Downloading file...") + request.setDescription(string(R.string.downloading)) request.setTitle(URLUtil.guessFileName(url, contentDisposition, mimeType)) request.allowScanningByMediaScanner() request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) |