mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
Merge pull request #208 from amir1376/fix/auto-show-completion-dialog
fix auto show completion dialog not working when progress is not open
This commit is contained in:
commit
de45c34c35
@ -48,6 +48,7 @@ import ir.amirab.util.compose.asStringSource
|
||||
import ir.amirab.util.compose.combineStringSources
|
||||
import ir.amirab.util.flow.mapStateFlow
|
||||
import ir.amirab.util.osfileutil.FileUtils
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.serialization.Serializable
|
||||
@ -529,6 +530,9 @@ class AppComponent(
|
||||
description = Res.string.finished.asStringSource(),
|
||||
type = NotificationType.Success,
|
||||
)
|
||||
if (appSettings.showCompletionDialog.value) {
|
||||
openDownloadDialog(it.downloadItem.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import ir.amirab.util.compose.asStringSourceWithARgs
|
||||
import ir.amirab.util.flow.combineStateFlows
|
||||
import ir.amirab.util.flow.mapStateFlow
|
||||
import ir.amirab.util.flow.mapTwoWayStateFlow
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
@ -88,6 +89,10 @@ class SingleDownloadComponent(
|
||||
itemStateFlow.value = item
|
||||
} else {
|
||||
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
|
||||
delay(100)
|
||||
close()
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user