diff --git a/Whisky/Views/Updater/UpdateControllerViewModifier.swift b/Whisky/Views/Updater/UpdateControllerViewModifier.swift index 662e78a1..98519dd3 100644 --- a/Whisky/Views/Updater/UpdateControllerViewModifier.swift +++ b/Whisky/Views/Updater/UpdateControllerViewModifier.swift @@ -81,33 +81,37 @@ struct UpdateControllerViewModifier: ViewModifier { UpdateControllerErrorView(updater: updater) }) .onChange(of: updater.state, { _, newValue in - // Dissmiss all old views - sheetCheckingUpdateViewPresented = false - sheetChangeLogViewPresented = false - sheetUpdateInstallingViewPresented = false - sheetUpdateReadyToRelaunchViewPresented = false - sheetUpdateErrorViewPresented = false - sheetUpdateNotFoundViewPresented = false - - // Enable new view - switch newValue { - case .checking: - sheetCheckingUpdateViewPresented = true - case .updateFound: - sheetChangeLogViewPresented = true - case .initializing, .downloading, .extracting, .installing: - sheetUpdateInstallingViewPresented = true - case .readyToRelaunch: - sheetUpdateReadyToRelaunchViewPresented = true - case .error: - sheetUpdateErrorViewPresented = true - case .updateNotFound: - sheetUpdateNotFoundViewPresented = true - case .idle: - break - } + updateViews(newState: newValue) }) } + + func updateViews(newState: SparkleUpdaterEvents.UpdaterState) { + // Dissmiss all old views + sheetCheckingUpdateViewPresented = false + sheetChangeLogViewPresented = false + sheetUpdateInstallingViewPresented = false + sheetUpdateReadyToRelaunchViewPresented = false + sheetUpdateErrorViewPresented = false + sheetUpdateNotFoundViewPresented = false + + // Enable new view + switch newState { + case .checking: + sheetCheckingUpdateViewPresented = true + case .updateFound: + sheetChangeLogViewPresented = true + case .initializing, .downloading, .extracting, .installing: + sheetUpdateInstallingViewPresented = true + case .readyToRelaunch: + sheetUpdateReadyToRelaunchViewPresented = true + case .error: + sheetUpdateErrorViewPresented = true + case .updateNotFound: + sheetUpdateNotFoundViewPresented = true + case .idle: + break + } + } } struct UpdateControllerCheckingForUpdatesView: View { diff --git a/Whisky/Views/Updater/UpdateInstallingView.swift b/Whisky/Views/Updater/UpdateInstallingView.swift index 921e2d31..73db1256 100644 --- a/Whisky/Views/Updater/UpdateInstallingView.swift +++ b/Whisky/Views/Updater/UpdateInstallingView.swift @@ -63,7 +63,8 @@ struct UpdateInstallingView: View { + Text(String(" ")) + (shouldShowEstimate ? Text(String(format: String(localized: "setup.gptk.eta"), - formatRemainingTime(remainingBytes: downloadableBytes - downloadedBytes))) + formatRemainingTime( + remainingBytes: downloadableBytes - downloadedBytes))) : Text(String())) Spacer() }