mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
- Group the large widget into running/active sections, show up to nine sessions, and use the last human prompt as the subtitle. - Show compact status icons plus web-style relative times, right-aligned. - Mirror the per-install push key into the protected App Group container so the Live Activity extension and NSE can decrypt while the data-protection Keychain is unavailable on the Lock Screen. - Redesign the Lock Screen card and Dynamic Island compact/expanded/minimal states; Live Activities are now opt-in and recovered activities are ended when disabled. - Rename the app and widget display name to Happy Coding; bump the local build to 10. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com>
44 lines
1.7 KiB
Swift
44 lines
1.7 KiB
Swift
import Foundation
|
|
import HapiProtocol
|
|
import Testing
|
|
|
|
@Suite("Live Activity key store")
|
|
struct LiveActivityKeyStoreTests {
|
|
private func temporaryDirectory() -> URL {
|
|
FileManager.default.temporaryDirectory
|
|
.appendingPathComponent("LiveActivityKeyStore-\(UUID().uuidString)", isDirectory: true)
|
|
}
|
|
|
|
@Test func roundTripsATwoHundredFiftySixBitKey() {
|
|
let directory = temporaryDirectory()
|
|
defer { try? FileManager.default.removeItem(at: directory) }
|
|
let key = Data((0..<32).map(UInt8.init))
|
|
|
|
#expect(LiveActivityKeyStore.save(key, to: directory))
|
|
#expect(LiveActivityKeyStore.load(from: directory) == key)
|
|
}
|
|
|
|
@Test func replacesAnExistingMirror() {
|
|
let directory = temporaryDirectory()
|
|
defer { try? FileManager.default.removeItem(at: directory) }
|
|
let first = Data(repeating: 1, count: 32)
|
|
let second = Data(repeating: 2, count: 32)
|
|
|
|
#expect(LiveActivityKeyStore.save(first, to: directory))
|
|
#expect(LiveActivityKeyStore.save(second, to: directory))
|
|
#expect(LiveActivityKeyStore.load(from: directory) == second)
|
|
}
|
|
|
|
@Test func rejectsNonThirtyTwoByteValues() throws {
|
|
let directory = temporaryDirectory()
|
|
defer { try? FileManager.default.removeItem(at: directory) }
|
|
try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
|
|
try Data([1, 2, 3]).write(
|
|
to: directory.appendingPathComponent(LiveActivityKeyStore.fileName)
|
|
)
|
|
|
|
#expect(!LiveActivityKeyStore.save(Data([1, 2, 3]), to: directory))
|
|
#expect(LiveActivityKeyStore.load(from: directory) == nil)
|
|
}
|
|
}
|