fix: progress bar not updating

This commit is contained in:
Robert 2024-01-07 13:29:09 +01:00
parent 3232bb10e6
commit f38b31a591
No known key found for this signature in database
GPG Key ID: C58ED617AEA8CB68
2 changed files with 9 additions and 7 deletions

View File

@ -97,7 +97,7 @@ fun Steps(
Spacer(modifier = Modifier.weight(1f))
val stepProgress = remember(stepCount, steps) {
stepCount?.let { (current, total) -> "$current/$total}" }
stepCount?.let { (current, total) -> "$current/$total" }
?: "${steps.count { it.state == State.COMPLETED }}/${steps.size}"
}

View File

@ -71,14 +71,16 @@ fun PatcherScreen(
val patchesProgress by vm.patchesProgress.collectAsStateWithLifecycle()
val progress = remember(vm.steps, patchesProgress) {
val current = vm.steps.filter {
it.state == State.COMPLETED && it.category != StepCategory.PATCHING
}.size + patchesProgress.first
val progress by remember {
derivedStateOf {
val current = vm.steps.count {
it.state == State.COMPLETED && it.category != StepCategory.PATCHING
} + patchesProgress.first
val total = vm.steps.size - 1 + patchesProgress.second
val total = vm.steps.size - 1 + patchesProgress.second
current.toFloat() / total.toFloat()
current.toFloat() / total.toFloat()
}
}
if (showInstallPicker)