From b3dbb1af45d33ccf2439fe4cac65648ec51031e5 Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Tue, 19 Jan 2021 19:32:38 -0700 Subject: [PATCH] Initialize SUUpdater and add check for updates menu item --- Xcodes/Resources/Info.plist | 2 ++ Xcodes/XcodesApp.swift | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Xcodes/Resources/Info.plist b/Xcodes/Resources/Info.plist index 0a907aa..f39533c 100644 --- a/Xcodes/Resources/Info.plist +++ b/Xcodes/Resources/Info.plist @@ -37,5 +37,7 @@ com.robotsandpencils.XcodesApp.Helper identifier "com.robotsandpencils.XcodesApp.Helper" and info [CFBundleShortVersionString] >= "1.0.0" and anchor apple generic and certificate leaf[subject.OU] = "$(CODE_SIGNING_SUBJECT_ORGANIZATIONAL_UNIT)" + SUFeedURL + https://robotsandpencils.github.io/XcodesApp/appcast.xml diff --git a/Xcodes/XcodesApp.swift b/Xcodes/XcodesApp.swift index 4fb73bc..2ef0d76 100644 --- a/Xcodes/XcodesApp.swift +++ b/Xcodes/XcodesApp.swift @@ -1,5 +1,6 @@ -import SwiftUI import AppKit +import Sparkle +import SwiftUI @main struct XcodesApp: App { @@ -28,6 +29,11 @@ struct XcodesApp: App { appDelegate.showAboutWindow() } } + CommandGroup(after: .appInfo) { + Button("Check for Updates...") { + appDelegate.checkForUpdates() + } + } CommandGroup(after: CommandGroupPlacement.newItem) { Button("Refresh") { appState.update() @@ -83,4 +89,13 @@ class AppDelegate: NSObject, NSApplicationDelegate { acknowledgementsWindow.center() acknowledgementsWindow.makeKeyAndOrderFront(nil) } + + func checkForUpdates() { + SUUpdater.shared()?.checkForUpdates(self) + } + + func applicationDidFinishLaunching(_ notification: Notification) { + // Initialize manually + SUUpdater.shared() + } }