From 4e7e11cfd56adfa14a557c76e192ff3148cd2842 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Mon, 16 Sep 2024 12:10:02 +0200 Subject: 3.0.0 --- Map/Info.plist | 8 +++++- Map/Map.entitlements | 15 +++++++--- Map/MapApp.swift | 5 ++++ Map/Presentation/Commands/UpdateCommands.swift | 39 ++++++++++++++++++++++++++ Map/Presentation/MapEditor.swift | 1 - 5 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 Map/Presentation/Commands/UpdateCommands.swift (limited to 'Map') diff --git a/Map/Info.plist b/Map/Info.plist index 61150cf..e862423 100644 --- a/Map/Info.plist +++ b/Map/Info.plist @@ -2,6 +2,12 @@ + SUEnableInstallerLauncherService + + SUPublicEDKey + lacD9VFVjJO55y+hEy+ReU4S0xbrnbdhncui1qLsmfI= + SUFeedURL + https://map.tranquil.systems/appcast.xml CFBundleDocumentTypes @@ -25,7 +31,7 @@ public.plain-text UTTypeDescription - Wardley Map written in Map's wmap syntax + Wardley Map written in Map's wmap syntax UTTypeIcons UTTypeIdentifier diff --git a/Map/Map.entitlements b/Map/Map.entitlements index 6d968ed..d363e1c 100644 --- a/Map/Map.entitlements +++ b/Map/Map.entitlements @@ -2,9 +2,16 @@ - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-write - + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.temporary-exception.mach-lookup.global-name + + $(PRODUCT_BUNDLE_IDENTIFIER)-spks + $(PRODUCT_BUNDLE_IDENTIFIER)-spki + diff --git a/Map/MapApp.swift b/Map/MapApp.swift index 9aff010..ef1b119 100644 --- a/Map/MapApp.swift +++ b/Map/MapApp.swift @@ -1,12 +1,17 @@ import SwiftUI +import Sparkle @main struct MapApp: App { + + private let updaterController: SPUStandardUpdaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil) + var body: some Scene { DocumentGroup(newDocument: MapDocument()) { file in MapEditor(document: file.$document, url: file.fileURL) }.commands { MapCommands() + UpdateCommands(updaterController: updaterController) } } } diff --git a/Map/Presentation/Commands/UpdateCommands.swift b/Map/Presentation/Commands/UpdateCommands.swift new file mode 100644 index 0000000..44a4610 --- /dev/null +++ b/Map/Presentation/Commands/UpdateCommands.swift @@ -0,0 +1,39 @@ +import SwiftUI +import Sparkle + +struct UpdateCommands: Commands { + let updaterController: SPUStandardUpdaterController + + var body: some Commands { + CommandGroup(after: .appInfo) { + CheckForUpdatesView(updater: updaterController.updater) + } + } +} + + +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) + } +} + +final class CheckForUpdatesViewModel: ObservableObject { + @Published var canCheckForUpdates = false + + init(updater: SPUUpdater) { + updater.publisher(for: \.canCheckForUpdates) + .assign(to: &$canCheckForUpdates) + } +} diff --git a/Map/Presentation/MapEditor.swift b/Map/Presentation/MapEditor.swift index bf33f75..f9415d3 100644 --- a/Map/Presentation/MapEditor.swift +++ b/Map/Presentation/MapEditor.swift @@ -97,7 +97,6 @@ struct MapEditor: View { } private func onDragVertex(vertex: Vertex, x: CGFloat, y: CGFloat) { - print("Dragging: \(vertex), \(x), \(y)") } private func saveImage() { -- cgit