Files
hapi/ios/Packages/HapiKit/Sources/HapiClient/Settings/LiveActivityPrefs.swift
T
b81c6be39b feat(ios): add lock-screen Live Activities for running sessions
Hub:
- add encrypted Live Activity token registry, registration API, and
  update/end pushes over direct APNs
- enable only for HAPI_IOS_PUSH=apns; relay reports remote:false
- keep content-state encrypted with the per-install push key and a
  domain-separated AAD

iOS:
- add ActivityKit coordinator, HapiWidgets extension, lock-screen and
  Dynamic Island UI, encrypted content-state, deep links, and settings toggle
- cap concurrent activities and reconcile across hub switches

Docs/tests:
- native contract, privacy, READMEs, localization catalogs
- cross-language cipher fixture and hub/iOS unit tests

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

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

27 lines
883 B
Swift

import Foundation
/// Install-global Live Activity preference (Settings → Notifications).
///
/// Defaults to enabled; the coordinator also checks the system's
/// `ActivityAuthorizationInfo`, so a user who disabled Live Activities in
/// iOS settings is handled separately. Corrupt/missing storage reads as the
/// default, matching the other prefs stores.
@MainActor @Observable
public final class LiveActivityPrefs {
public private(set) var enabled: Bool
private let defaults: UserDefaults
public static let enabledKey = "settings.liveActivities"
public init(defaults: UserDefaults = .standard) {
self.defaults = defaults
self.enabled = defaults.object(forKey: Self.enabledKey) as? Bool ?? true
}
public func setEnabled(_ enabled: Bool) {
self.enabled = enabled
defaults.set(enabled, forKey: Self.enabledKey)
}
}