From 8a5d8c96ef65abfd7e0dce0f9530849e0afabf34 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 1 Jan 2022 10:44:27 -0500 Subject: [PATCH] Remove explicit option to store downloads in app data folder App data is typically deleted during app uninstallation, which some users are unaware of. The folder is also inaccessible externally by default in Android 11+, which is also annoying to users. --- .../tachiyomi/ui/setting/SettingsDownloadController.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt index af19dfad72..d8111bbdd4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsDownloadController.kt @@ -6,7 +6,6 @@ import android.content.ActivityNotFoundException import android.content.Intent import android.os.Bundle import android.os.Environment -import androidx.core.content.ContextCompat import androidx.core.net.toUri import androidx.core.text.buildSpannedString import androidx.preference.PreferenceScreen @@ -210,7 +209,7 @@ class SettingsDownloadController : SettingsController() { override fun onCreateDialog(savedViewState: Bundle?): Dialog { val activity = activity!! val currentDir = preferences.downloadsDirectory().get() - val externalDirs = (getExternalDirs() + File(activity.getString(R.string.custom_dir))).map(File::toString) + val externalDirs = listOf(getDefaultDownloadDir(), File(activity.getString(R.string.custom_dir))).map(File::toString) var selectedIndex = externalDirs.indexOfFirst { it in currentDir } return MaterialAlertDialogBuilder(activity) @@ -229,13 +228,12 @@ class SettingsDownloadController : SettingsController() { .create() } - private fun getExternalDirs(): List { + private fun getDefaultDownloadDir(): File { val defaultDir = Environment.getExternalStorageDirectory().absolutePath + File.separator + resources?.getString(R.string.app_name) + File.separator + "downloads" - return mutableListOf(File(defaultDir)) + - ContextCompat.getExternalFilesDirs(activity!!, "").filterNotNull() + return File(defaultDir) } }