Archived
The watch receives the phone's payload over WatchConnectivity and writes it into its own App Group container through the same SnapshotStore, so there is one wire format and one reader. The agenda, the detail screen and the filter all read that; the complications read what the app last wrote, since an extension cannot run a WCSession of its own. Complication timelines land on event boundaries rather than a schedule, so the next appointment flips in the exact minute it changes without spending refresh budget. CalendarrWatchShared holds what both watch targets need, attached to each the way Shared/ is attached to the app and the widgets. recommendations() is implemented because watchOS requires it — iOS has a default, the watch does not, since the complication gallery has to be populated. Found by building, not by reading. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
755 B
Swift
24 lines
755 B
Swift
import Foundation
|
|
import CalendarrCore
|
|
|
|
/// Which calendars this watch hides, on top of what the phone already filtered.
|
|
///
|
|
/// The snapshot arrives with hidden and banished calendars already removed, so
|
|
/// this narrows further and can never contradict the phone. It lives in the App
|
|
/// Group so one toggle in the app affects every complication at once.
|
|
enum WatchFilterStore {
|
|
private static let key = "watchHiddenCalendarKeys"
|
|
|
|
private static var defaults: UserDefaults? {
|
|
UserDefaults(suiteName: CalendarrAppGroup.current)
|
|
}
|
|
|
|
static func load() -> Set<String> {
|
|
Set(defaults?.stringArray(forKey: key) ?? [])
|
|
}
|
|
|
|
static func save(_ keys: Set<String>) {
|
|
defaults?.set(keys.sorted(), forKey: key)
|
|
}
|
|
}
|