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(),
type = NotificationType.Success,
)
if (appSettings.showCompletionDialog.value) {
if (appSettings.showDownloadCompletionDialog.value) {
openDownloadDialog(it.downloadItem.id)
}
}
if (it is DownloadManagerEvents.OnJobStarting) {
if (appSettings.autoShowDownloadProgressDialog.value) {
if (appSettings.showDownloadProgressDialog.value) {
openDownloadDialog(it.downloadItem.id)
}
}

View File

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

View File

@ -63,7 +63,7 @@ class SingleDownloadComponent(
private val downloadManager: DownloadManager = downloadSystem.downloadManager
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 shouldShowCompletionDialog = combineStateFlows(
globalShowCompletionDialog,
@ -91,7 +91,7 @@ class SingleDownloadComponent(
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
// 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)
close()
}

View File

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