mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
fix downloads on low sdk
This commit is contained in:
parent
e718937dd6
commit
abdb5e3a85
@ -1,13 +1,21 @@
|
|||||||
package com.github.libretube.util
|
package com.github.libretube.util
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import com.github.libretube.BuildConfig
|
||||||
import com.github.libretube.constants.DownloadType
|
import com.github.libretube.constants.DownloadType
|
||||||
import com.github.libretube.obj.DownloadedFile
|
import com.github.libretube.obj.DownloadedFile
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
object DownloadHelper {
|
object DownloadHelper {
|
||||||
private fun getOfflineStorageDir(context: Context): File {
|
private fun getOfflineStorageDir(context: Context): File {
|
||||||
return context.getExternalFilesDir(null)!!
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return context.filesDir
|
||||||
|
|
||||||
|
return try {
|
||||||
|
context.getExternalFilesDir(null)!!
|
||||||
|
} catch (e: Exception) {
|
||||||
|
context.filesDir
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVideoDir(context: Context): File {
|
fun getVideoDir(context: Context): File {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user