fix downloads on low sdk

This commit is contained in:
Bnyro 2022-10-07 19:48:55 +02:00
parent e718937dd6
commit abdb5e3a85

View File

@ -1,13 +1,21 @@
package com.github.libretube.util
import android.content.Context
import android.os.Build
import com.github.libretube.BuildConfig
import com.github.libretube.constants.DownloadType
import com.github.libretube.obj.DownloadedFile
import java.io.File
object DownloadHelper {
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 {