diff --git a/macos/Sources/App/macOS/AppDelegate.swift b/macos/Sources/App/macOS/AppDelegate.swift index a9f72b58b..9e1425062 100644 --- a/macos/Sources/App/macOS/AppDelegate.swift +++ b/macos/Sources/App/macOS/AppDelegate.swift @@ -1008,7 +1008,7 @@ class AppDelegate: NSObject, } @IBAction func checkForUpdates(_ sender: Any?) { - UpdateSimulator.notFound.simulate(with: updateViewModel) + UpdateSimulator.error.simulate(with: updateViewModel) } diff --git a/macos/Sources/Features/Update/UpdateDriver.swift b/macos/Sources/Features/Update/UpdateDriver.swift index 00f74e9ed..6627559e8 100644 --- a/macos/Sources/Features/Update/UpdateDriver.swift +++ b/macos/Sources/Features/Update/UpdateDriver.swift @@ -38,7 +38,9 @@ class UpdateDriver: NSObject, SPUUserDriver { } func showUpdaterError(_ error: any Error, acknowledgement: @escaping () -> Void) { - viewModel.state = .error(.init(error: error, retry: retryHandler)) + viewModel.state = .error(.init(error: error, retry: retryHandler, dismiss: { [weak viewModel] in + viewModel?.state = .idle + })) } func showDownloadInitiated(cancellation: @escaping () -> Void) { diff --git a/macos/Sources/Features/Update/UpdatePopoverView.swift b/macos/Sources/Features/Update/UpdatePopoverView.swift index 39c4ac5c9..cbe517f74 100644 --- a/macos/Sources/Features/Update/UpdatePopoverView.swift +++ b/macos/Sources/Features/Update/UpdatePopoverView.swift @@ -336,6 +336,7 @@ fileprivate struct UpdateErrorView: View { HStack(spacing: 8) { Button("OK") { + error.dismiss() dismiss() } .keyboardShortcut(.cancelAction) diff --git a/macos/Sources/Features/Update/UpdateSimulator.swift b/macos/Sources/Features/Update/UpdateSimulator.swift index 0cf2d221b..96fab4835 100644 --- a/macos/Sources/Features/Update/UpdateSimulator.swift +++ b/macos/Sources/Features/Update/UpdateSimulator.swift @@ -92,6 +92,9 @@ enum UpdateSimulator { ]), retry: { simulateHappyPath(viewModel) + }, + dismiss: { + viewModel.state = .idle } )) } diff --git a/macos/Sources/Features/Update/UpdateViewModel.swift b/macos/Sources/Features/Update/UpdateViewModel.swift index 05f7eef9a..f0b779d60 100644 --- a/macos/Sources/Features/Update/UpdateViewModel.swift +++ b/macos/Sources/Features/Update/UpdateViewModel.swift @@ -172,6 +172,7 @@ enum UpdateState: Equatable { struct Error { let error: any Swift.Error let retry: () -> Void + let dismiss: () -> Void } struct Downloading {