rename showDownloadProgressDialog and autoShowDownloadProgressDialog

This commit is contained in:
AmirHossein Abdolmotallebi 2024-11-21 15:04:56 +03:30
parent c4e608fb6f
commit 8bc36fce23
4 changed files with 18 additions and 18 deletions

View File

@ -530,12 +530,12 @@ class AppComponent(
description = Res.string.finished.asStringSource(), description = Res.string.finished.asStringSource(),
type = NotificationType.Success, type = NotificationType.Success,
) )
if (appSettings.showCompletionDialog.value) { if (appSettings.showDownloadCompletionDialog.value) {
openDownloadDialog(it.downloadItem.id) openDownloadDialog(it.downloadItem.id)
} }
} }
if (it is DownloadManagerEvents.OnJobStarting) { if (it is DownloadManagerEvents.OnJobStarting) {
if (appSettings.autoShowDownloadProgressDialog.value) { if (appSettings.showDownloadProgressDialog.value) {
openDownloadDialog(it.downloadItem.id) openDownloadDialog(it.downloadItem.id)
} }
} }

View File

@ -110,7 +110,7 @@ fun showDownloadFinishWindow(settingsStorage: AppSettingsStorage): BooleanConfig
return BooleanConfigurable( return BooleanConfigurable(
title = Res.string.settings_show_completion_dialog.asStringSource(), title = Res.string.settings_show_completion_dialog.asStringSource(),
description = Res.string.settings_show_completion_dialog_description.asStringSource(), description = Res.string.settings_show_completion_dialog_description.asStringSource(),
backedBy = settingsStorage.showCompletionDialog, backedBy = settingsStorage.showDownloadCompletionDialog,
describe = { describe = {
(if (it) Res.string.enabled else Res.string.disabled).asStringSource() (if (it) Res.string.enabled else Res.string.disabled).asStringSource()
}, },
@ -121,7 +121,7 @@ fun autoShowDownloadProgressWindow(settingsStorage: AppSettingsStorage): Boolean
return BooleanConfigurable( return BooleanConfigurable(
title = Res.string.settings_show_download_progress_dialog.asStringSource(), title = Res.string.settings_show_download_progress_dialog.asStringSource(),
description = Res.string.settings_show_download_progress_dialog_description.asStringSource(), description = Res.string.settings_show_download_progress_dialog_description.asStringSource(),
backedBy = settingsStorage.autoShowDownloadProgressDialog, backedBy = settingsStorage.showDownloadProgressDialog,
describe = { describe = {
(if (it) Res.string.enabled else Res.string.disabled).asStringSource() (if (it) Res.string.enabled else Res.string.disabled).asStringSource()
}, },

View File

@ -63,7 +63,7 @@ class SingleDownloadComponent(
private val downloadManager: DownloadManager = downloadSystem.downloadManager private val downloadManager: DownloadManager = downloadSystem.downloadManager
val itemStateFlow = MutableStateFlow<IDownloadItemState?>(null) val itemStateFlow = MutableStateFlow<IDownloadItemState?>(null)
private val globalShowCompletionDialog: StateFlow<Boolean> = appSettings.showCompletionDialog private val globalShowCompletionDialog: StateFlow<Boolean> = appSettings.showDownloadCompletionDialog
private val itemShouldShowCompletionDialog: MutableStateFlow<Boolean?> = MutableStateFlow(null as Boolean?) private val itemShouldShowCompletionDialog: MutableStateFlow<Boolean?> = MutableStateFlow(null as Boolean?)
private val shouldShowCompletionDialog = combineStateFlows( private val shouldShowCompletionDialog = combineStateFlows(
globalShowCompletionDialog, globalShowCompletionDialog,
@ -91,7 +91,7 @@ class SingleDownloadComponent(
itemStateFlow.value = null itemStateFlow.value = null
// app component tries to create this component if user want to auto open completion dialog and this component is not created yet // app component tries to create this component if user want to auto open completion dialog and this component is not created yet
// so we keep this component active a while to prevent create new component // so we keep this component active a while to prevent create new component
// this prevents opening this window if global [appSettings.showCompletionDialog] is true but user explicitly tells that he don't want to open completion dialog for this item // this prevents opening this window if global [appSettings.showDownloadCompletionDialog] is true but user explicitly tells that he don't want to open completion dialog for this item
delay(100) delay(100)
close() close()
} }

View File

@ -21,8 +21,8 @@ data class AppSettingsModel(
val useServerLastModifiedTime: Boolean = false, val useServerLastModifiedTime: Boolean = false,
val useSparseFileAllocation: Boolean = true, val useSparseFileAllocation: Boolean = true,
val useAverageSpeed: Boolean = true, val useAverageSpeed: Boolean = true,
val autoShowDownloadProgressDialog: Boolean = true, val showDownloadProgressDialog: Boolean = true,
val showCompletionDialog: Boolean = true, val showDownloadCompletionDialog: Boolean = true,
val speedLimit: Long = 0, val speedLimit: Long = 0,
val autoStartOnBoot: Boolean = true, val autoStartOnBoot: Boolean = true,
val notificationSound: Boolean = true, val notificationSound: Boolean = true,
@ -46,8 +46,8 @@ data class AppSettingsModel(
val useServerLastModifiedTime = booleanKeyOf("useServerLastModifiedTime") val useServerLastModifiedTime = booleanKeyOf("useServerLastModifiedTime")
val useSparseFileAllocation = booleanKeyOf("useSparseFileAllocation") val useSparseFileAllocation = booleanKeyOf("useSparseFileAllocation")
val useAverageSpeed = booleanKeyOf("useAverageSpeed") val useAverageSpeed = booleanKeyOf("useAverageSpeed")
val autoShowDownloadProgressDialog = booleanKeyOf("autoShowDownloadProgressDialog") val showDownloadProgressDialog = booleanKeyOf("showDownloadProgressDialog")
val showCompletionDialog = booleanKeyOf("showCompletionDialog") val showDownloadCompletionDialog = booleanKeyOf("showDownloadCompletionDialog")
val speedLimit = longKeyOf("speedLimit") val speedLimit = longKeyOf("speedLimit")
val autoStartOnBoot = booleanKeyOf("autoStartOnBoot") val autoStartOnBoot = booleanKeyOf("autoStartOnBoot")
val notificationSound = booleanKeyOf("notificationSound") val notificationSound = booleanKeyOf("notificationSound")
@ -70,10 +70,10 @@ data class AppSettingsModel(
?: default.useServerLastModifiedTime, ?: default.useServerLastModifiedTime,
useSparseFileAllocation = source.get(Keys.useSparseFileAllocation) ?: default.useSparseFileAllocation, useSparseFileAllocation = source.get(Keys.useSparseFileAllocation) ?: default.useSparseFileAllocation,
useAverageSpeed = source.get(Keys.useAverageSpeed) ?: default.useAverageSpeed, useAverageSpeed = source.get(Keys.useAverageSpeed) ?: default.useAverageSpeed,
autoShowDownloadProgressDialog = source.get(Keys.autoShowDownloadProgressDialog) showDownloadProgressDialog = source.get(Keys.showDownloadProgressDialog)
?: default.autoShowDownloadProgressDialog, ?: default.showDownloadProgressDialog,
showCompletionDialog = source.get(Keys.showCompletionDialog) showDownloadCompletionDialog = source.get(Keys.showDownloadCompletionDialog)
?: default.showCompletionDialog, ?: default.showDownloadCompletionDialog,
speedLimit = source.get(Keys.speedLimit) ?: default.speedLimit, speedLimit = source.get(Keys.speedLimit) ?: default.speedLimit,
autoStartOnBoot = source.get(Keys.autoStartOnBoot) ?: default.autoStartOnBoot, autoStartOnBoot = source.get(Keys.autoStartOnBoot) ?: default.autoStartOnBoot,
notificationSound = source.get(Keys.notificationSound) ?: default.notificationSound, notificationSound = source.get(Keys.notificationSound) ?: default.notificationSound,
@ -94,8 +94,8 @@ data class AppSettingsModel(
put(Keys.useServerLastModifiedTime, focus.useServerLastModifiedTime) put(Keys.useServerLastModifiedTime, focus.useServerLastModifiedTime)
put(Keys.useSparseFileAllocation, focus.useSparseFileAllocation) put(Keys.useSparseFileAllocation, focus.useSparseFileAllocation)
put(Keys.useAverageSpeed, focus.useAverageSpeed) put(Keys.useAverageSpeed, focus.useAverageSpeed)
put(Keys.autoShowDownloadProgressDialog, focus.autoShowDownloadProgressDialog) put(Keys.showDownloadProgressDialog, focus.showDownloadProgressDialog)
put(Keys.showCompletionDialog, focus.showCompletionDialog) put(Keys.showDownloadCompletionDialog, focus.showDownloadCompletionDialog)
put(Keys.speedLimit, focus.speedLimit) put(Keys.speedLimit, focus.speedLimit)
put(Keys.autoStartOnBoot, focus.autoStartOnBoot) put(Keys.autoStartOnBoot, focus.autoStartOnBoot)
put(Keys.notificationSound, focus.notificationSound) put(Keys.notificationSound, focus.notificationSound)
@ -120,8 +120,8 @@ class AppSettingsStorage(
val useServerLastModifiedTime = from(AppSettingsModel.useServerLastModifiedTime) val useServerLastModifiedTime = from(AppSettingsModel.useServerLastModifiedTime)
val useSparseFileAllocation = from(AppSettingsModel.useSparseFileAllocation) val useSparseFileAllocation = from(AppSettingsModel.useSparseFileAllocation)
val useAverageSpeed = from(AppSettingsModel.useAverageSpeed) val useAverageSpeed = from(AppSettingsModel.useAverageSpeed)
val autoShowDownloadProgressDialog = from(AppSettingsModel.autoShowDownloadProgressDialog) val showDownloadProgressDialog = from(AppSettingsModel.showDownloadProgressDialog)
val showCompletionDialog = from(AppSettingsModel.showCompletionDialog) val showDownloadCompletionDialog = from(AppSettingsModel.showDownloadCompletionDialog)
val speedLimit = from(AppSettingsModel.speedLimit) val speedLimit = from(AppSettingsModel.speedLimit)
val autoStartOnBoot = from(AppSettingsModel.autoStartOnBoot) val autoStartOnBoot = from(AppSettingsModel.autoStartOnBoot)
val notificationSound = from(AppSettingsModel.notificationSound) val notificationSound = from(AppSettingsModel.notificationSound)