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,15 +71,17 @@ fun PatcherScreen(
val patchesProgress by vm.patchesProgress.collectAsStateWithLifecycle()
val progress = remember(vm.steps, patchesProgress) {
val current = vm.steps.filter {
val progress by remember {
derivedStateOf {
val current = vm.steps.count {
it.state == State.COMPLETED && it.category != StepCategory.PATCHING
}.size + patchesProgress.first
} + patchesProgress.first
val total = vm.steps.size - 1 + patchesProgress.second
current.toFloat() / total.toFloat()
}
}
if (showInstallPicker)
InstallPickerDialog(