13cd7b30f9
- Scheme A: on-demand session start, inactivity-based expiry, handoff auto-recording - Scheme B: cold-start overlay with swipe guidance and return alert - Scheme C+D: HostAppURLRegistry (20 apps) and sourceApplication capture - Settings: skip app switch toggle and inactivity duration picker - Add LSApplicationQueriesSchemes for canOpenURL checks Co-authored-by: Rocky <hkgood@users.noreply.github.com>
47 lines
1.5 KiB
Swift
47 lines
1.5 KiB
Swift
// FlowInactivityDuration.swift
|
|
// OSGKeyboard · Shared
|
|
//
|
|
// User-selectable Flow session inactivity timeout. The timer resets after
|
|
// each completed utterance (and on session start).
|
|
|
|
import Foundation
|
|
|
|
public enum FlowInactivityDuration: String, CaseIterable, Identifiable, Sendable, Codable {
|
|
case tenMinutes = "10m"
|
|
case thirtyMinutes = "30m"
|
|
case threeHours = "3h"
|
|
case twelveHours = "12h"
|
|
case twentyFourHours = "24h"
|
|
|
|
public var id: String { rawValue }
|
|
|
|
public static let `default`: FlowInactivityDuration = .twelveHours
|
|
|
|
public var timeInterval: TimeInterval {
|
|
switch self {
|
|
case .tenMinutes: return 10 * 60
|
|
case .thirtyMinutes: return 30 * 60
|
|
case .threeHours: return 3 * 60 * 60
|
|
case .twelveHours: return 12 * 60 * 60
|
|
case .twentyFourHours: return 24 * 60 * 60
|
|
}
|
|
}
|
|
|
|
public var labelKey: String {
|
|
switch self {
|
|
case .tenMinutes: return "settings.flow.inactivity.10m"
|
|
case .thirtyMinutes: return "settings.flow.inactivity.30m"
|
|
case .threeHours: return "settings.flow.inactivity.3h"
|
|
case .twelveHours: return "settings.flow.inactivity.12h"
|
|
case .twentyFourHours: return "settings.flow.inactivity.24h"
|
|
}
|
|
}
|
|
|
|
public static func fromStored(_ raw: String?) -> FlowInactivityDuration {
|
|
guard let raw, let value = FlowInactivityDuration(rawValue: raw) else {
|
|
return .default
|
|
}
|
|
return value
|
|
}
|
|
}
|