add getUpdates by not user
This commit is contained in:
+12
-2
@@ -45,11 +45,21 @@ class UpdateComponent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkUpdates() {
|
fun checkUpdates(byUser: Boolean = true) {
|
||||||
|
if (!hasSupport) return
|
||||||
scope.launch {
|
scope.launch {
|
||||||
interactor.checkUpdate().collect {
|
interactor.checkUpdate().collect {
|
||||||
isForceUpdate = (it as? UpdateState.UpdateAvailable)?.isForceUpdate ?: false
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user