fix merge issues

This commit is contained in:
Ax333l 2024-12-20 17:51:44 +01:00
parent 2f1426408a
commit 536a24169c
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23
4 changed files with 6 additions and 16 deletions

View File

@ -223,12 +223,6 @@ class PatcherWorker(
args.selectedPatches, args.selectedPatches,
args.options, args.options,
args.logger, args.logger,
/*
onPatchCompleted = {
args.patchesProgress.update { (completed, total) ->
completed + 1 to total
}
},*/
args.onPatchCompleted, args.onPatchCompleted,
args.onProgress args.onProgress
) )

View File

@ -120,7 +120,10 @@ fun Steps(
steps.forEach { step -> steps.forEach { step ->
val (progress, progressText) = when (step.progressKey) { val (progress, progressText) = when (step.progressKey) {
null -> null null -> null
ProgressKey.DOWNLOAD -> stepProgressProvider.downloadProgress?.let { (downloaded, total) -> downloaded / total to "$downloaded/$total MB" } ProgressKey.DOWNLOAD -> stepProgressProvider.downloadProgress?.let { (downloaded, total) ->
if (total != null) downloaded.toFloat() / total.toFloat() to "${downloaded.megaBytes}/${total.megaBytes} MB"
else null to "${downloaded.megaBytes} MB"
}
} ?: (null to null) } ?: (null to null)
SubStep( SubStep(
@ -239,13 +242,6 @@ fun StepIcon(state: State, progress: Float? = null, size: Dp) {
contentDescription = description contentDescription = description
} }
}, },
/*
progress = {
progress?.let { (current, total) ->
if (total == null) return@let null
current / total
}?.toFloat()
},*/
progress = { progress }, progress = { progress },
strokeWidth = strokeWidth strokeWidth = strokeWidth
) )

View File

@ -20,7 +20,7 @@ enum class ProgressKey {
} }
interface StepProgressProvider { interface StepProgressProvider {
val downloadProgress: Pair<Float, Float>? val downloadProgress: Pair<Long, Long?>?
} }
@Parcelize @Parcelize

View File

@ -147,7 +147,7 @@ class PatcherViewModel(
key = "downloadProgress", key = "downloadProgress",
stateSaver = autoSaver() stateSaver = autoSaver()
) { ) {
mutableStateOf<Pair<Float, Float>?>(null) mutableStateOf<Pair<Long, Long?>?>(null)
} }
private set private set
val steps by savedStateHandle.saveable(saver = snapshotStateListSaver()) { val steps by savedStateHandle.saveable(saver = snapshotStateListSaver()) {