- watchOS: add WatchSessionManager (WCSession bridge), WatchNotificationHandler (snooze/dismiss actions), recommendations() for AppIntentTimelineProvider - watchOS: WatchTimerStore tick loop with cascade haptics, App Group sync - macOS: CreateTimerSheet (countdown/alarm/pomodoro), launch-at-login toggle - macOS: MenuBarState showCreateSheet, MacSettingsView data tab - Xcode project updated with new file references
44 lines
1.4 KiB
Swift
44 lines
1.4 KiB
Swift
// ── ChronoMind macOS Menu Bar App ─────────────────────────────
|
|
// Native macOS menu bar app sharing 90%+ code with iOS via Shared/
|
|
|
|
import SwiftUI
|
|
|
|
@main
|
|
struct ChronoMindMacApp: App {
|
|
@StateObject private var menuBarState = MenuBarState.shared
|
|
@StateObject private var timerStore = MacTimerStore.shared
|
|
|
|
var body: some Scene {
|
|
// Menu bar extra — always visible
|
|
MenuBarExtra {
|
|
MenuBarPopover()
|
|
.environmentObject(timerStore)
|
|
.environmentObject(menuBarState)
|
|
.sheet(isPresented: $menuBarState.showCreateSheet) {
|
|
CreateTimerSheet()
|
|
.environmentObject(timerStore)
|
|
}
|
|
} label: {
|
|
menuBarLabel
|
|
}
|
|
.menuBarExtraStyle(.window)
|
|
|
|
// Settings window
|
|
Settings {
|
|
MacSettingsView()
|
|
.environmentObject(timerStore)
|
|
}
|
|
}
|
|
|
|
private var menuBarLabel: some View {
|
|
HStack(spacing: 4) {
|
|
Image(systemName: "clock.fill")
|
|
if let next = timerStore.nextFiringTimer {
|
|
let remaining = getRemainingSeconds(next, now: timerStore.now)
|
|
Text(formatDurationCompact(remaining))
|
|
.monospacedDigit()
|
|
}
|
|
}
|
|
}
|
|
}
|