Refactor(ToolStore): Auto refresh status after install or upgrade tool

This commit is contained in:
2024-08-18 14:46:27 +08:00
parent 21264d8ff7
commit 5839f1d394
2 changed files with 9 additions and 5 deletions

View File

@@ -57,13 +57,17 @@ class ToolStoreViewModel @Inject constructor(
is Result.Success -> {
when (installInfo.value.type) {
ToolStoreUiState.InstallInfo.Type.Install -> toolRepository.saveTool(
result.data
)
ToolStoreUiState.InstallInfo.Type.Install -> {
toolRepository.saveTool(
result.data
)
toolEntity.isInstalled = true
}
ToolStoreUiState.InstallInfo.Type.Upgrade -> {
toolRepository.removeTool(toolEntity)
toolRepository.saveTool(result.data)
toolEntity.upgrade = null
}
}