Files
OSGKeyboard/OSGKeyboardShared/Models/FlowKeepAliveMode.swift
T
Rocky 956331a2af chore(release): bump version to 1.0.1 (build 27)
Release the current PiP reliability, polish style, macOS dictionary, and UI updates.
2026-07-27 00:09:30 +08:00

40 lines
1.3 KiB
Swift

// FlowKeepAliveMode.swift
// OSGKeyboard · Shared
//
// User-selectable Flow session keep-alive strategy (mutually exclusive).
import Foundation
public enum FlowKeepAliveMode: String, CaseIterable, Identifiable, Sendable, Codable {
/// Continuous audio capture + Live Activity.
case liveActivity = "liveActivity"
/// Picture-in-picture waveform keep-alive; mic released between utterances.
case pictureInPicture = "pictureInPicture"
public var id: String { rawValue }
/// Used when no valid keep-alive preference has been stored.
public static let `default`: FlowKeepAliveMode = .pictureInPicture
public var labelKey: String {
switch self {
case .liveActivity: return "settings.flow.keepAlive.liveActivity"
case .pictureInPicture: return "settings.flow.keepAlive.pictureInPicture"
}
}
public var subtitleKey: String {
switch self {
case .liveActivity: return "settings.flow.keepAlive.liveActivity.subtitle"
case .pictureInPicture: return "settings.flow.keepAlive.pictureInPicture.subtitle"
}
}
public static func fromStored(_ raw: String?) -> FlowKeepAliveMode {
guard let raw, let value = FlowKeepAliveMode(rawValue: raw) else {
return .default
}
return value
}
}