feat(flow): add Picture in Picture keep-alive mode
- Add FlowKeepAliveMode (Dynamic Island vs PiP) with iCloud sync - Settings: keep-alive picker; inactivity timeout only for Live Activity - PiP: waveform sample-buffer controller, mic released between utterances - PiP sessions have no idle expiry; user closing PiP ends the session - FlowSessionManager branches hostReady, session start, and utterance paths - UIBackgroundModes picture-in-picture; bilingual strings and tests Co-authored-by: Rocky <hkgood@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,18 @@ public enum FlowSessionPolicy {
|
||||
inactivityDuration(defaults: defaults).timeInterval
|
||||
}
|
||||
|
||||
public static func keepAliveMode(defaults: UserDefaults? = nil) -> FlowKeepAliveMode {
|
||||
let store = resolvedDefaults(defaults)
|
||||
return FlowKeepAliveMode.fromStored(
|
||||
store.string(forKey: AppGroupConfiguration.Keys.flowKeepAliveMode)
|
||||
)
|
||||
}
|
||||
|
||||
/// PiP sessions have no inactivity expiry; only the Live Activity path times out.
|
||||
public static func usesInactivityExpiry(defaults: UserDefaults? = nil) -> Bool {
|
||||
keepAliveMode(defaults: defaults) == .liveActivity
|
||||
}
|
||||
|
||||
private static func resolvedDefaults(_ defaults: UserDefaults?) -> UserDefaults {
|
||||
if let defaults { return defaults }
|
||||
guard let available = AppGroup.defaultsIfAvailable else {
|
||||
|
||||
Reference in New Issue
Block a user