diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt index 875937d25..0a1b7e90a 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Activity.kt @@ -606,16 +606,6 @@ fun BaseSimpleActivity.deleteFile(fileDirItem: FileDirItem, allowDeleteFolder: B } fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder: Boolean = false, callback: ((wasSuccess: Boolean) -> Unit)? = null) { - if (isRPlus()) { - val fileUris = getFileUrisFromFileDirItems(arrayListOf(fileDirItem)) - deleteSDK30Uris(fileUris) { success -> - runOnUiThread { - callback?.invoke(success) - } - } - return - } - val path = fileDirItem.path val file = File(path) if (file.absolutePath.startsWith(internalStoragePath) && !file.canWrite()) { @@ -639,6 +629,16 @@ fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder: } } } else { + if (isRPlus()) { + val fileUris = getFileUrisFromFileDirItems(arrayListOf(fileDirItem)) + deleteSDK30Uris(fileUris) { success -> + runOnUiThread { + callback?.invoke(success) + } + } + return + } + if (getIsPathDirectory(file.absolutePath) && allowDeleteFolder) { fileDeleted = deleteRecursively(file) }