feat(settings): 新增关于菜单和基于正式发布的更新检测

This commit is contained in:
2026-11-16 11:26:18 +08:00
parent b9abb970d9
commit 0442398407
16 changed files with 540 additions and 31 deletions
+10 -6
View File
@@ -5,9 +5,10 @@ struct MenuPanelView: View {
let metrics: MetricsStore
let preferences: AppearancePreferences
let keepAwake: KeepAwakeService
let settingsPresentation: SettingsPresentation
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))
@@ -205,11 +206,14 @@ struct MenuPanelView: View {
}
.help(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
.accessibilityLabel(metrics.isPaused ? Text("action.resume") : Text("action.pause"))
Button {
NSApp.setActivationPolicy(.regular)
settingsPresentation.request()
onOpenSettings()
} label: {
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)
}
.help(Text("action.settings")).accessibilityLabel(Text("action.settings"))