From f17c6783315efeb8e400fc46868e96454b64dbb5 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Sun, 27 Feb 2022 21:27:38 +0000 Subject: [PATCH] Refactor extension fields in Context-storage - Move fields in Context-storage to the top - Move recycleBinPath to commons module --- .../commons/extensions/Context-storage.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt index 2519b986b..5db88f4c0 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt @@ -30,6 +30,13 @@ import java.net.URLDecoder import java.util.* import java.util.regex.Pattern +private const val ANDROID_DATA_DIR = "/Android/data/" +private const val ANDROID_OBB_DIR = "/Android/obb/" +private const val DOWNLOAD_DIR = "Download" +val DIRS_ACCESSIBLE_ONLY_WITH_SAF = listOf(ANDROID_DATA_DIR, ANDROID_OBB_DIR) +val DIRS_INACCESSIBLE_WITH_SAF_SDK_30 = listOf(DOWNLOAD_DIR) +val Context.recycleBinPath: String get() = filesDir.absolutePath + // http://stackoverflow.com/a/40582634/1967672 fun Context.getSDCardPath(): String { val directories = getStorageDirectories().filter { @@ -153,12 +160,6 @@ fun Context.isPathOnOTG(path: String) = otgPath.isNotEmpty() && path.startsWith( fun Context.isPathOnInternalStorage(path: String) = internalStoragePath.isNotEmpty() && path.startsWith(internalStoragePath) -private const val ANDROID_DATA_DIR = "/Android/data/" -private const val ANDROID_OBB_DIR = "/Android/obb/" -private const val DOWNLOAD_DIR = "Download" -val DIRS_ACCESSIBLE_ONLY_WITH_SAF = listOf(ANDROID_DATA_DIR, ANDROID_OBB_DIR) -private val DIRS_INACCESSIBLE_WITH_SAF_SDK_30 = listOf(DOWNLOAD_DIR) - fun Context.getSAFOnlyDirs(): List { return DIRS_ACCESSIBLE_ONLY_WITH_SAF.map { "$internalStoragePath$it" } }