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 + } + } } } }