mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
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>
31 lines
1008 B
Swift
31 lines
1008 B
Swift
import Foundation
|
|
import HapiClient
|
|
import Testing
|
|
|
|
@MainActor
|
|
@Suite("Live Activity prefs")
|
|
struct LiveActivityPrefsTests {
|
|
private func makeDefaults() throws -> (UserDefaults, String) {
|
|
let suiteName = "LiveActivityPrefsTests-\(UUID().uuidString)"
|
|
let defaults = try #require(UserDefaults(suiteName: suiteName))
|
|
return (defaults, suiteName)
|
|
}
|
|
|
|
@Test func defaultsToEnabledAndRoundTrips() throws {
|
|
let (defaults, suiteName) = try makeDefaults()
|
|
defer { defaults.removePersistentDomain(forName: suiteName) }
|
|
|
|
#expect(LiveActivityPrefs(defaults: defaults).enabled)
|
|
|
|
LiveActivityPrefs(defaults: defaults).setEnabled(false)
|
|
#expect(!LiveActivityPrefs(defaults: defaults).enabled)
|
|
|
|
LiveActivityPrefs(defaults: defaults).setEnabled(true)
|
|
#expect(LiveActivityPrefs(defaults: defaults).enabled)
|
|
}
|
|
|
|
@Test func storageKeyIsStable() {
|
|
#expect(LiveActivityPrefs.enabledKey == "settings.liveActivities")
|
|
}
|
|
}
|