Merge pull request #1514 from Bnyro/master

fix downloads on low sdk
This commit is contained in:
Bnyro 2022-10-07 19:49:20 +02:00 committed by GitHub
commit cf64fa281d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {