Fix: Showing install and update at once

This commit is contained in:
machiav3lli 2022-07-01 01:55:59 +02:00
parent a64afc3d6a
commit a5449afe9b

View File

@ -65,9 +65,9 @@ class AppViewModelX(val db: DatabaseX, val packageName: String) : ViewModel() {
val bookmarked = extras.value?.favorite ?: false val bookmarked = extras.value?.favorite ?: false
val actions = mutableSetOf<ActionState>() val actions = mutableSetOf<ActionState>()
launch { synchronized(actions) {
if (canInstall) actions += ActionState.Install
if (canUpdate) actions += ActionState.Update if (canUpdate) actions += ActionState.Update
if (canInstall && !canUpdate) actions += ActionState.Install
if (canLaunch) actions += ActionState.Launch if (canLaunch) actions += ActionState.Launch
if (installed != null) actions += ActionState.Details if (installed != null) actions += ActionState.Details
if (canUninstall) actions += ActionState.Uninstall if (canUninstall) actions += ActionState.Uninstall
@ -85,7 +85,7 @@ class AppViewModelX(val db: DatabaseX, val packageName: String) : ViewModel() {
} }
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
this@AppViewModelX.actions.value = actions synchronized(actions) { this@AppViewModelX.actions.value = actions }
if (downloadState.value != null && mainAction.value?.textId != downloadState.value?.textId) if (downloadState.value != null && mainAction.value?.textId != downloadState.value?.textId)
downloadState.value?.let { downloadState.value?.let {