diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/DownloadScreen.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/DownloadScreen.kt index 48bdd5442..b90d1844d 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/DownloadScreen.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/settings/DownloadScreen.kt @@ -51,6 +51,7 @@ import com.hippo.ehviewer.ui.composing import com.hippo.ehviewer.ui.keepNoMediaFileStatus import com.hippo.ehviewer.ui.tools.observed import com.hippo.ehviewer.ui.tools.rememberedAccessor +import com.hippo.ehviewer.util.AppConfig import com.hippo.ehviewer.util.displayPath import com.hippo.ehviewer.util.displayString import com.hippo.files.delete @@ -68,6 +69,7 @@ import eu.kanade.tachiyomi.util.system.logcat import kotlinx.coroutines.launch import moe.tarsin.coroutines.runSuspendCatching import okio.Path +import okio.Path.Companion.toOkioPath import splitties.init.appCtx @Destination @@ -111,7 +113,27 @@ fun AnimatedVisibilityScope.DownloadScreen(navigator: DestinationsNavigator) = c title = stringResource(id = R.string.settings_download_download_location), summary = downloadLocationState.toUri().displayPath, ) { - selectDownloadDirLauncher.launch(null) + launchIO { + val defaultDownloadDir = AppConfig.defaultDownloadDir + if (defaultDownloadDir?.delete() == false) { + val path = defaultDownloadDir.toOkioPath() + awaitConfirmationOrCancel( + confirmText = R.string.pick_new_download_location, + dismissText = if (downloadLocationState != path) { + R.string.reset_download_location + } else { + android.R.string.cancel + }, + title = R.string.waring, + onCancelButtonClick = { + downloadLocationState = path + }, + ) { + Text(stringResource(id = R.string.default_download_dir_not_empty)) + } + } + selectDownloadDirLauncher.launch(null) + } } val mediaScan = Settings::mediaScan.observed SwitchPreference( diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 067b2f568..f61b4051a 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -138,6 +138,7 @@ Forrige år I går Legg til etikett + Tilbakestill til forvalg Ikke vis igjen %s (opplaster) Kopier oversettelse diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index e1c96ca5b..97367a764 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -476,6 +476,9 @@ 定时请求新闻页面 隐藏 HV 事件通知 复制翻译 + 默认下载目录非空! + 恢复默认路径 + 选择新路径 不再显示 打开设置 对于 Android 12 及更新的版本,您需要手动添加链接到已验证链接才能在 EhViewer 中打开 E-Hentai 链接。 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 1bbe54f11..ab318758f 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -469,6 +469,8 @@ 啟動時請求新聞頁面 隱藏 HV 事件通知 複製翻譯 + 恢復預設路徑 + 選擇新路徑 不再顯示 開啟設定 對於 Android 12 及更新的版本,您需要手動增加連結到已驗證連結才能在 EhViewer 中開啟 E-Hentai 連結。 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 114282d40..1dac21430 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -493,6 +493,9 @@ Timed request news page Hide HV event Notifications Copy translation + The default download directory is not empty! + Reset to default + Pick a new location Don\'t show again Open settings For Android 12 and newer, you need to manually add link to verified links in order to open E-Hentai links in EhViewer.