feat(updates): 使用 Sparkle 从发布 ZIP 下载并重启更新

This commit is contained in:
2026-11-16 16:17:31 +08:00
parent 451d31682d
commit ec37b8e3f9
23 changed files with 716 additions and 219 deletions
+3 -3
View File
@@ -19,6 +19,7 @@ import notify
private let awake = KeepAwakeService()
private let presentation = SettingsPresentation()
private let updates = ReleaseUpdates()
private lazy var updater = SparkleUpdater(updates: updates)
private let appearance = AppearancePreferences()
private let menuBarPreferences = MenuBarPreferences()
private let language = LanguagePreferences()
@@ -75,7 +76,7 @@ import notify
MenuPanelView(metrics: self.metrics, preferences: self.appearance, keepAwake: self.awake, updates: self.updates,
presentation: panel, onOpenSettings: { [weak self] in
self?.settingsCommand()
}, onOpenAbout: { [weak self] in self?.aboutCommand() }, onPreferredHeight: { [weak self] height in
}, onPreferredHeight: { [weak self] height in
self?.menuBar?.setPreferredContentHeight(height)
})
}
@@ -110,7 +111,7 @@ import notify
NSApp.mainMenu = root
}
func applicationDidFinishLaunching(_ notification: Notification) { updates.start() }
func applicationDidFinishLaunching(_ notification: Notification) { updater.start() }
@objc private func settingsCommand() { showSettings() }
@objc private func aboutCommand() { showSettings(.about) }
@@ -127,7 +128,6 @@ import notify
workspaceTokens.forEach(NSWorkspace.shared.notificationCenter.removeObserver)
workspaceTokens.removeAll()
menuBar?.shutdown()
updates.stop()
awake.disable()
menuBar = nil
openSettingsAction = nil