- Real Settings (Cmd+,) window via PreferencesView, hosting the pure @AppStorage-backed defaults that used to live in the main window's "General Settings" panel. Both windows share the same live values since they're backed by the same UserDefaults keys. - Menu bar icon reflects idle/syncing/error state; dropdown shows last-sync time/result and whether auto-sync is armed, sourced from the same lastRunAtISO/lastRunOK/lastRunSummary keys --status reads. - ContentView.swift split from ~2000 lines into CalendarsSectionView, RoutesSectionView, ScheduleSectionView, LogSectionView + a small shared CalendarDisplay.swift. View-layer extraction only — state ownership and settings persistence deliberately left alone. - Fixed a latent revert-on-relaunch bug caught while building the Settings window: moving preference controls out of ContentView meant they no longer re-triggered saveSettingsToDefaults(), so settings.v2 could go stale and the next launch would silently revert a just-changed preference via the shared applySnapshot path. Split launch-time restore (routes + selection only) from Import's full restore. All 47 unit tests pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
22 lines
540 B
Swift
22 lines
540 B
Swift
import SwiftUI
|
|
import EventKit
|
|
|
|
// Small calendar display helpers shared by ContentView, RoutesSectionView,
|
|
// and CalendarsSectionView.
|
|
|
|
func calColor(_ cal: EKCalendar) -> Color {
|
|
#if os(macOS)
|
|
return Color(cal.cgColor ?? NSColor.systemGray.cgColor)
|
|
#else
|
|
return Color(cgColor: cal.cgColor ?? UIColor.systemGray.cgColor)
|
|
#endif
|
|
}
|
|
|
|
@ViewBuilder
|
|
func calChip(_ cal: EKCalendar) -> some View {
|
|
HStack(spacing: 6) {
|
|
Circle().fill(calColor(cal)).frame(width: 10, height: 10)
|
|
Text(calLabel(cal))
|
|
}
|
|
}
|