diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift
index 117285763..52eedd75e 100644
--- a/Mac/AppDelegate.swift
+++ b/Mac/AppDelegate.swift
@@ -13,14 +13,21 @@ import RSTree
import RSWeb
import Account
import RSCore
-#if TEST
+
+// If we're not going to import Sparkle, provide dummy protocols to make it easy
+// for AppDelegate to comply
+#if MAC_APP_STORE || TEST
+protocol SPUStandardUserDriverDelegate {}
+protocol SPUUpdaterDelegate {}
+#else
import Sparkle
#endif
var appDelegate: AppDelegate!
@NSApplicationMain
-class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, UNUserNotificationCenterDelegate, UnreadCountProvider {
+class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, UNUserNotificationCenterDelegate, UnreadCountProvider, SPUStandardUserDriverDelegate, SPUUpdaterDelegate
+{
var userNotificationManager: UserNotificationManager!
var faviconDownloader: FaviconDownloader!
@@ -70,6 +77,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
private let log = Log()
private let appNewsURLString = "https://nnw.ranchero.com/feed.json"
private let appMovementMonitor = RSAppMovementMonitor()
+ #if !MAC_APP_STORE && !TEST
+ private var softwareUpdater: SPUUpdater!
+ #endif
override init() {
NSWindow.allowsAutomaticWindowTabbing = false
@@ -117,16 +127,24 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
func applicationWillFinishLaunching(_ notification: Notification) {
installAppleEventHandlers()
- #if TEST
- // Don't prompt for updates while running automated tests
- SUUpdater.shared()?.automaticallyChecksForUpdates = false
- #endif
}
func applicationDidFinishLaunching(_ note: Notification) {
- #if MAC_APP_STORE
+ #if MAC_APP_STORE || TEST
checkForUpdatesMenuItem.isHidden = true
+ #else
+ // Initialize Sparkle...
+ let hostBundle = Bundle.main
+ let updateDriver = SPUStandardUserDriver(hostBundle: hostBundle, delegate: self)
+ self.softwareUpdater = SPUUpdater(hostBundle: hostBundle, applicationBundle: hostBundle, userDriver: updateDriver, delegate: self)
+
+ do {
+ try self.softwareUpdater.start()
+ }
+ catch {
+ NSLog("Failed to start software updater with error: \(error)")
+ }
#endif
appName = (Bundle.main.infoDictionary!["CFBundleExecutable"]! as! String)
@@ -571,7 +589,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations,
@IBAction func groupByFeedToggled(_ sender: NSMenuItem) {
AppDefaults.timelineGroupByFeed.toggle()
}
-
+
+ @IBAction func checkForUpdates(_ sender: Any?) {
+ #if !MAC_APP_STORE && !TEST
+ self.softwareUpdater.checkForUpdates()
+ #endif
+ }
+
}
// MARK: - Debug Menu
diff --git a/Mac/Base.lproj/Main.storyboard b/Mac/Base.lproj/Main.storyboard
index 498fdd35f..ba4a9a4de 100644
--- a/Mac/Base.lproj/Main.storyboard
+++ b/Mac/Base.lproj/Main.storyboard
@@ -30,7 +30,7 @@
@@ -623,7 +623,6 @@
-
diff --git a/Mac/Base.lproj/Preferences.storyboard b/Mac/Base.lproj/Preferences.storyboard
index 46d049133..6b2ac07d5 100644
--- a/Mac/Base.lproj/Preferences.storyboard
+++ b/Mac/Base.lproj/Preferences.storyboard
@@ -234,17 +234,7 @@
-
-
-
-
-
-
-
-
-
-
-
+
@@ -293,7 +283,7 @@
-
+
@@ -382,8 +372,8 @@
-
+