fix: Refactoring database actions

This commit is contained in:
J-Jamet 2023-05-14 23:38:08 +02:00
parent 939b319563
commit 4bd12b8a95
16 changed files with 215 additions and 194 deletions

View file

@ -21,7 +21,9 @@ package com.kunzisoft.keepass.utils
import android.annotation.SuppressLint
import android.content.ContentResolver
import android.content.Context
import android.net.Uri
import android.os.Build
import android.util.Log
import java.io.*
import java.util.*
@ -37,6 +39,14 @@ object UriHelper {
return Uri.decode(this) ?: ""
}
fun Context.getBinaryDir(): File {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.applicationContext.noBackupFilesDir
} else {
this.applicationContext.filesDir
}
}
@Throws(FileNotFoundException::class)
fun ContentResolver.getUriInputStream(fileUri: Uri?): InputStream? {
if (fileUri == null)