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
+9 -9
View File
@@ -8,7 +8,6 @@ struct MenuPanelView: View {
let updates: ReleaseUpdates
var presentation = PanelPresentation()
var onOpenSettings: () -> Void = {}
var onOpenAbout: () -> Void = {}
var onPreferredHeight: (CGFloat) -> Void = { _ in }
@Environment(\.locale) var locale
@State private var panelSize = PanelLayout.contentSize(visible: NSScreen.main?.visibleFrame ?? CGRect(x: 0, y: 0, width: 1000, height: 760))
@@ -137,7 +136,15 @@ struct MenuPanelView: View {
.frame(width: 22, height: 22)
HStack(alignment: .top, spacing: 3) {
Text("Kymo").font(.system(size: 17, weight: .semibold))
if let version = Self.version {
if updates.version != nil {
UpdateAction(phase: updates.phase, version: updates.version, compact: true, action: updates.performAction)
.buttonStyle(.plain)
.font(.system(size: 10, weight: .semibold))
.foregroundStyle(Color.accentColor)
.padding(.horizontal, 5).padding(.vertical, 2)
.background(Color.accentColor.opacity(0.12), in: Capsule())
.offset(y: -2)
} else if let version = Self.version {
Text(verbatim: "v" + version)
.font(.system(size: 9, weight: .semibold)).monospacedDigit()
.padding(.horizontal, 5).padding(.vertical, 1)
@@ -206,13 +213,6 @@ struct MenuPanelView: View {
}
.help(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
.accessibilityLabel(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
if updates.available != nil {
Button(action: onOpenAbout) {
Image(systemName: "arrow.down.circle.fill").frame(width: 20, height: 20)
.foregroundStyle(Color.accentColor)
}
.help(Text("updates.available")).accessibilityLabel(Text("updates.available"))
}
Button(action: onOpenSettings) {
Image(systemName: "gearshape").frame(width: 20, height: 20)
}