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:
AmirHossein Abdolmotallebi 2024-11-21 14:39:44 +03:30 committed by GitHub
commit de45c34c35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -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)
}
}
}

View File

@ -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 {