Files
hapi/ios/Hapi/Features/Widgets/WidgetSnapshotControlling.swift
T
eb4fa1806f feat(ios): add snapshot-backed home and lock screen widgets
- add the WidgetSnapshot contract, App Group store, status/title builder
- write debounced snapshots from SessionListStore; NSE refreshes them
  from decrypted pushes and reloads widget timelines
- add small/medium/large, accessory, and StandBy widget families with
  attention-first rows and session deep links
- add App Group entitlements for the app, NSE, and widget extension
- document the snapshot data flow and privacy properties
- cover selection, title fallback, store round-trip, and push updates

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-06 20:42:11 +08:00

30 lines
811 B
Swift

import HapiClient
import HapiProtocol
/// Cross-platform seam for the home-screen widget snapshot writer. The real
/// writer is iOS-only (WidgetKit); Catalyst gets a no-op.
@MainActor
protocol WidgetSnapshotControlling: AnyObject {
func update(_ sessions: [SessionSummary], hubUrl: String)
func flush()
func clear()
}
@MainActor
final class NoopWidgetSnapshotController: WidgetSnapshotControlling {
func update(_ sessions: [SessionSummary], hubUrl: String) {}
func flush() {}
func clear() {}
}
enum WidgetSnapshotControllerFactory {
@MainActor
static func make() -> any WidgetSnapshotControlling {
#if os(iOS) && !targetEnvironment(macCatalyst)
return WidgetSnapshotUpdater()
#else
return NoopWidgetSnapshotController()
#endif
}
}