Watch: waiting-count complication and multi-select questions
A WidgetKit extension (accessoryCircular, Rectangular, Inline, Corner) shows GET /v1/summary. The device token moves to the App Group's Keychain access group on launch so the extension can read it without re-pairing; the app reloads the timeline when its feed counts change and on notifications. Multi-select questions toggle options and send an array of values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
d4d67295c6
commit
0994fd7d5a
18 files changed
+800
-23
No files matched your search
@@ -0,0 +1,22 @@
|
||||
// What the app tells the complication through the App Group's defaults: whether it is in demo mode,
|
||||
// and the last summary it saw, which the complication shows when it cannot reach the gateway.
|
||||
|
||||
import Foundation
|
||||
|
||||
enum SharedState {
|
||||
private static var defaults: UserDefaults { UserDefaults(suiteName: DeviceStore.appGroup) ?? .standard }
|
||||
private static let demoKey = "demo"
|
||||
private static let summaryKey = "summary"
|
||||
|
||||
/// True while the app is in demo mode, so the complication shows the demo counts too.
|
||||
static var demo: Bool {
|
||||
get { defaults.bool(forKey: demoKey) }
|
||||
set { defaults.set(newValue, forKey: demoKey) }
|
||||
}
|
||||
|
||||
/// The last summary the app or the complication saw, or nil after signing out.
|
||||
static var lastSummary: Summary? {
|
||||
get { defaults.data(forKey: summaryKey).flatMap { try? JSON.decoder().decode(Summary.self, from: $0) } }
|
||||
set { defaults.set(newValue.flatMap { try? JSON.encoder().encode($0) }, forKey: summaryKey) }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user