Add Tonuino Manager website and Sparkle updates
This commit is contained in:
commit
1cac427ff2
44 files changed
+5861
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import SwiftUI
|
||||
import Sparkle
|
||||
import AppKit
|
||||
|
||||
final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
static var updater: SPUStandardUpdaterController?
|
||||
func applicationDidFinishLaunching(_ notification: Notification) {
|
||||
guard let feed = Bundle.main.object(forInfoDictionaryKey: "SUFeedURL") as? String,
|
||||
URL(string: feed)?.scheme != nil,
|
||||
let key = Bundle.main.object(forInfoDictionaryKey: "SUPublicEDKey") as? String,
|
||||
!key.isEmpty else { return }
|
||||
Self.updater = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@main
|
||||
struct TonuinoManagerApp: App {
|
||||
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
||||
@StateObject private var model = AppModel()
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.environmentObject(model)
|
||||
.frame(minWidth: 980, minHeight: 640)
|
||||
}
|
||||
.commands {
|
||||
CommandGroup(replacing: .newItem) { }
|
||||
CommandGroup(after: .appInfo) {
|
||||
Button("Auf Updates prüfen…") { AppDelegate.updater?.checkForUpdates(nil) }
|
||||
.disabled(AppDelegate.updater?.updater.canCheckForUpdates != true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user