mirror of
https://github.com/bitgapp/eqMac.git
synced 2024-12-04 16:31:13 +03:00
started working on ability for user to update the app before it starts
This commit is contained in:
parent
3f61b0d8ea
commit
c59eaa8fe4
@ -9,12 +9,29 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
import SwiftyJSON
|
import SwiftyJSON
|
||||||
import ServiceManagement
|
import ServiceManagement
|
||||||
|
import Sparkle
|
||||||
|
import EmitterKit
|
||||||
|
|
||||||
@NSApplicationMain
|
@NSApplicationMain
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate {
|
||||||
|
var updater = SUUpdater(for: Bundle.main)!
|
||||||
|
var updateFound = Event<Void>()
|
||||||
|
var updateNotFound = Event<Void>()
|
||||||
|
var updateCanceled = Event<Void>()
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
|
updater.delegate = self
|
||||||
|
updateFound.once { _ in
|
||||||
|
self.updateCanceled.once { _ in
|
||||||
Application.start()
|
Application.start()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateNotFound.once { _ in
|
||||||
|
Application.start()
|
||||||
|
}
|
||||||
|
updater.checkForUpdatesInBackground()
|
||||||
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
Application.quit()
|
Application.quit()
|
||||||
@ -33,6 +50,30 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,9 +8,8 @@
|
|||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
import AMCoreAudio
|
import AMCoreAudio
|
||||||
import EventKit
|
//import EventKit
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
//import AudioKit
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
|
@ -1042,7 +1042,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Developer ID Application";
|
CODE_SIGN_IDENTITY = "Developer ID Application";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 0.1.1;
|
CURRENT_PROJECT_VERSION = 0.1.0;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = JZA6C97KJA;
|
DEVELOPMENT_TEAM = JZA6C97KJA;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
@ -1102,7 +1102,7 @@
|
|||||||
CODE_SIGN_IDENTITY = "Developer ID Application";
|
CODE_SIGN_IDENTITY = "Developer ID Application";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 0.1.1;
|
CURRENT_PROJECT_VERSION = 0.1.0;
|
||||||
DEFINES_MODULE = YES;
|
DEFINES_MODULE = YES;
|
||||||
DEVELOPMENT_TEAM = JZA6C97KJA;
|
DEVELOPMENT_TEAM = JZA6C97KJA;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
|
Loading…
Reference in New Issue
Block a user