From 51839829bdc8e9f070490f1ff4858ed36748e86f Mon Sep 17 00:00:00 2001 From: Eugene Date: Sun, 26 Jul 2026 00:27:38 +0300 Subject: [PATCH] add getUpdates by not user --- .../updater/presentation/UpdateComponent.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/updater/updater-client/src/commonMain/kotlin/ru/shadowsparky/updater/presentation/UpdateComponent.kt b/libs/updater/updater-client/src/commonMain/kotlin/ru/shadowsparky/updater/presentation/UpdateComponent.kt index c4bc5a5..17bc7b7 100644 --- a/libs/updater/updater-client/src/commonMain/kotlin/ru/shadowsparky/updater/presentation/UpdateComponent.kt +++ b/libs/updater/updater-client/src/commonMain/kotlin/ru/shadowsparky/updater/presentation/UpdateComponent.kt @@ -45,11 +45,21 @@ class UpdateComponent( } } - fun checkUpdates() { + fun checkUpdates(byUser: Boolean = true) { + if (!hasSupport) return scope.launch { interactor.checkUpdate().collect { isForceUpdate = (it as? UpdateState.UpdateAvailable)?.isForceUpdate ?: false - _state.value = it + _state.value = if (byUser) { + it + } else { + when (it) { + UpdateState.Checking, + UpdateState.UpToDate, + is UpdateState.Error -> UpdateState.Idle + else -> it + } + } } } }