Allow resetting to default download location
This commit is contained in:
1 parent
7a96feb049
commit
1ace248121
5 files changed
+32
-1
No files matched your search
@@ -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<RootGraph>
|
||||
@@ -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(
|
||||
|
||||
@@ -138,6 +138,7 @@
|
||||
<string name="toplist_pastyear">Forrige år</string>
|
||||
<string name="toplist_yesterday">I går</string>
|
||||
<string name="action_add_tag">Legg til etikett</string>
|
||||
<string name="reset_download_location">Tilbakestill til forvalg</string>
|
||||
<string name="dont_show_again">Ikke vis igjen</string>
|
||||
<string name="comment_user_uploader">%s (opplaster)</string>
|
||||
<string name="copy_trans">Kopier oversettelse</string>
|
||||
|
||||
@@ -476,6 +476,9 @@
|
||||
<string name="settings_eh_request_news">定时请求新闻页面</string>
|
||||
<string name="settings_eh_hide_hv_events">隐藏 HV 事件通知</string>
|
||||
<string name="copy_trans">复制翻译</string>
|
||||
<string name="default_download_dir_not_empty">默认下载目录非空!</string>
|
||||
<string name="reset_download_location">恢复默认路径</string>
|
||||
<string name="pick_new_download_location">选择新路径</string>
|
||||
<string name="dont_show_again">不再显示</string>
|
||||
<string name="open_settings">打开设置</string>
|
||||
<string name="app_link_not_verified_message">对于 Android 12 及更新的版本,您需要手动添加链接到已验证链接才能在 EhViewer 中打开 E-Hentai 链接。</string>
|
||||
|
||||
@@ -469,6 +469,8 @@
|
||||
<string name="settings_eh_request_news">啟動時請求新聞頁面</string>
|
||||
<string name="settings_eh_hide_hv_events">隱藏 HV 事件通知</string>
|
||||
<string name="copy_trans">複製翻譯</string>
|
||||
<string name="reset_download_location">恢復預設路徑</string>
|
||||
<string name="pick_new_download_location">選擇新路徑</string>
|
||||
<string name="dont_show_again">不再顯示</string>
|
||||
<string name="open_settings">開啟設定</string>
|
||||
<string name="app_link_not_verified_message">對於 Android 12 及更新的版本,您需要手動增加連結到已驗證連結才能在 EhViewer 中開啟 E-Hentai 連結。</string>
|
||||
|
||||
@@ -493,6 +493,9 @@
|
||||
<string name="settings_eh_request_news">Timed request news page</string>
|
||||
<string name="settings_eh_hide_hv_events">Hide HV event Notifications</string>
|
||||
<string name="copy_trans">Copy translation</string>
|
||||
<string name="default_download_dir_not_empty">The default download directory is not empty!</string>
|
||||
<string name="reset_download_location">Reset to default</string>
|
||||
<string name="pick_new_download_location">Pick a new location</string>
|
||||
<string name="dont_show_again">Don\'t show again</string>
|
||||
<string name="open_settings">Open settings</string>
|
||||
<string name="app_link_not_verified_message">For Android 12 and newer, you need to manually add link to verified links in order to open E-Hentai links in EhViewer.</string>
|
||||
|
||||
Reference in new issue
Block a user