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>
28 lines
922 B
Swift
28 lines
922 B
Swift
import Foundation
|
|
|
|
/// Install-global Live Activity preference (Settings → Notifications).
|
|
///
|
|
/// Defaults to disabled; Live Activities are opt-in here. 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 ?? false
|
|
}
|
|
|
|
public func setEnabled(_ enabled: Bool) {
|
|
self.enabled = enabled
|
|
defaults.set(enabled, forKey: Self.enabledKey)
|
|
}
|
|
}
|