diff --git a/app/src/main/java/app/revanced/manager/ui/component/patcher/Steps.kt b/app/src/main/java/app/revanced/manager/ui/component/patcher/Steps.kt index 4385700c..6840837b 100644 --- a/app/src/main/java/app/revanced/manager/ui/component/patcher/Steps.kt +++ b/app/src/main/java/app/revanced/manager/ui/component/patcher/Steps.kt @@ -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}" } diff --git a/app/src/main/java/app/revanced/manager/ui/screen/PatcherScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/PatcherScreen.kt index 7f13425a..882d8cfe 100644 --- a/app/src/main/java/app/revanced/manager/ui/screen/PatcherScreen.kt +++ b/app/src/main/java/app/revanced/manager/ui/screen/PatcherScreen.kt @@ -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)