aboutsummaryrefslogtreecommitdiff
path: root/Map/Presentation/Commands/UpdateCommands.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Map/Presentation/Commands/UpdateCommands.swift')
-rw-r--r--Map/Presentation/Commands/UpdateCommands.swift43
1 files changed, 21 insertions, 22 deletions
diff --git a/Map/Presentation/Commands/UpdateCommands.swift b/Map/Presentation/Commands/UpdateCommands.swift
index 51d2b0a..3a019cc 100644
--- a/Map/Presentation/Commands/UpdateCommands.swift
+++ b/Map/Presentation/Commands/UpdateCommands.swift
@@ -1,3 +1,4 @@
+import Sparkle
/*
Copyright (C) 2024 Rubén Beltrán del Río
@@ -15,11 +16,10 @@
along with this program. If not, see https://map.tranquil.systems.
*/
import SwiftUI
-import Sparkle
struct UpdateCommands: Commands {
let updaterController: SPUStandardUpdaterController
-
+
var body: some Commands {
CommandGroup(after: .appInfo) {
CheckForUpdatesView(updater: updaterController.updater)
@@ -27,29 +27,28 @@ struct UpdateCommands: Commands {
}
}
-
struct CheckForUpdatesView: View {
- @ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
- private let updater: SPUUpdater
-
- init(updater: SPUUpdater) {
- self.updater = updater
-
- // Create our view model for our CheckForUpdatesView
- self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
- }
-
- var body: some View {
- Button("Check for Updates…", action: updater.checkForUpdates)
- .disabled(!checkForUpdatesViewModel.canCheckForUpdates)
- }
+ @ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
+ private let updater: SPUUpdater
+
+ init(updater: SPUUpdater) {
+ self.updater = updater
+
+ // Create our view model for our CheckForUpdatesView
+ self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
+ }
+
+ var body: some View {
+ Button("Check for Updates…", action: updater.checkForUpdates)
+ .disabled(!checkForUpdatesViewModel.canCheckForUpdates)
+ }
}
final class CheckForUpdatesViewModel: ObservableObject {
- @Published var canCheckForUpdates = false
+ @Published var canCheckForUpdates = false
- init(updater: SPUUpdater) {
- updater.publisher(for: \.canCheckForUpdates)
- .assign(to: &$canCheckForUpdates)
- }
+ init(updater: SPUUpdater) {
+ updater.publisher(for: \.canCheckForUpdates)
+ .assign(to: &$canCheckForUpdates)
+ }
}