diff --git a/native/app/Source/AppDelegate.swift b/native/app/Source/AppDelegate.swift index 6df4459..9a97d02 100644 --- a/native/app/Source/AppDelegate.swift +++ b/native/app/Source/AppDelegate.swift @@ -9,11 +9,28 @@ import Cocoa import SwiftyJSON import ServiceManagement +import Sparkle +import EmitterKit @NSApplicationMain -class AppDelegate: NSObject, NSApplicationDelegate { +class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate { + var updater = SUUpdater(for: Bundle.main)! + var updateFound = Event() + var updateNotFound = Event() + var updateCanceled = Event() + func applicationDidFinishLaunching(_ aNotification: Notification) { - Application.start() + updater.delegate = self + updateFound.once { _ in + self.updateCanceled.once { _ in + Application.start() + } + } + + updateNotFound.once { _ in + Application.start() + } + updater.checkForUpdatesInBackground() } func applicationWillTerminate(_ aNotification: Notification) { @@ -32,6 +49,30 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidBecomeActive(_ notification: Notification) { } + + func updaterDidNotFindUpdate(_ updater: SUUpdater) { + updateNotFound.emit() + } + + func updater(_ updater: SUUpdater, didFindValidUpdate item: SUAppcastItem) { + updateFound.emit() + } + + func updater(_ updater: SUUpdater, userDidSkipThisVersion item: SUAppcastItem) { + updateCanceled.emit() + } + + func updater(_ updater: SUUpdater, didCancelInstallUpdateOnQuit item: SUAppcastItem) { + updateCanceled.emit() + } + + func updater(_ updater: SUUpdater, didDismissUpdateAlertPermanently permanently: Bool, for item: SUAppcastItem) { +// updateCanceled.emit() + } + + func userDidCancelDownload(_ updater: SUUpdater) { + updateCanceled.emit() + } } diff --git a/native/app/Source/Audio/Engine.swift b/native/app/Source/Audio/Engine.swift index 291fb40..2f4b960 100644 --- a/native/app/Source/Audio/Engine.swift +++ b/native/app/Source/Audio/Engine.swift @@ -8,9 +8,8 @@ import Cocoa import AMCoreAudio -import EventKit +//import EventKit import AVFoundation -//import AudioKit import Foundation class Engine { diff --git a/native/app/eqMac.xcodeproj/project.pbxproj b/native/app/eqMac.xcodeproj/project.pbxproj index 029608e..3f6821e 100644 --- a/native/app/eqMac.xcodeproj/project.pbxproj +++ b/native/app/eqMac.xcodeproj/project.pbxproj @@ -1042,7 +1042,7 @@ CODE_SIGN_IDENTITY = "Developer ID Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 0.1.1; + CURRENT_PROJECT_VERSION = 0.1.0; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = JZA6C97KJA; ENABLE_HARDENED_RUNTIME = YES; @@ -1102,7 +1102,7 @@ CODE_SIGN_IDENTITY = "Developer ID Application"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 0.1.1; + CURRENT_PROJECT_VERSION = 0.1.0; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = JZA6C97KJA; ENABLE_HARDENED_RUNTIME = YES;