Skip to content

Commit

Permalink
fix: progress bar not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
CnC-Robert committed Jan 7, 2024
1 parent 3232bb1 commit f38b31a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f38b31a

Please sign in to comment.