Slightly change update UI logic

This commit is contained in:
topjohnwu
2022-01-21 05:37:37 -08:00
parent a73acfb9c2
commit 761a8dde65
4 changed files with 25 additions and 14 deletions
@@ -54,12 +54,18 @@ class LocalModuleRvItem(
}
@get:Bindable
var updateReady: Boolean
get() = item.updateInfo != null && !isRemoved && isEnabled
set(_) = notifyPropertyChanged(BR.updateReady)
val showUpdate get() = item.updateInfo != null
@get:Bindable
val updateReady get() = item.outdated && !isRemoved && isEnabled
val isUpdated = item.updated
fun fetchedUpdateInfo() {
notifyPropertyChanged(BR.showUpdate)
notifyPropertyChanged(BR.updateReady)
}
fun delete() {
isRemoved = !isRemoved
}
@@ -59,7 +59,8 @@ class ModuleViewModel : BaseViewModel() {
private suspend fun loadUpdateInfo() {
withContext(Dispatchers.IO) {
itemsInstalled.forEach {
it.updateReady = it.item.load()
if (it.item.fetch())
it.fetchedUpdateInfo()
}
}
}