Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
import Foundation
/// The in-app meeting as the controller tracks it.
public struct MeetingSnapshot: Equatable {
public enum Phase: Equatable {
case recording
case processing(recordedSeconds: Int)
}
public var title: String?
public var startedAt: Date
public var phase: Phase
public init(title: String?, startedAt: Date, phase: Phase) {
self.title = title
self.startedAt = startedAt
self.phase = phase
}
}
/// Decides what the single recording Live Activity shows. A meeting always wins so
/// keyboard/dictation-mode events can never overwrite or end it mid-meeting; when the
/// meeting clears, the activity falls back to the dictation session (or ends).
public enum LiveActivityResolver {
/// `appAwake`: the app is foreground, or the warm mic keeps it running in the
/// background. Otherwise it is about to suspend, and iOS can kill a suspended app
/// without a willTerminate, so an idle session card would outlive it.
public static func resolve(
meeting: MeetingSnapshot?,
keyboardRecording: Bool,
dictationMode: Bool,
appAwake: Bool,
now: Date
) -> RecordingActivityContentState? {
if let meeting {
switch meeting.phase {
case .recording:
return RecordingActivityContentState(
mode: .meeting, phase: .recording, startedAt: meeting.startedAt, title: meeting.title)
case .processing(let recordedSeconds):
return RecordingActivityContentState(
mode: .meeting, phase: .processing, startedAt: meeting.startedAt, title: meeting.title,
recordedSeconds: recordedSeconds)
}
}
if keyboardRecording {
return RecordingActivityContentState(phase: .recording, startedAt: now)
}
if dictationMode && appAwake {
return RecordingActivityContentState(phase: .idle, startedAt: now)
}
return nil
}
/// Without push updates the stale date can never move later, so a meeting is
/// stale only at ActivityKit's cap.
public static func staleDate(for state: RecordingActivityContentState, now: Date) -> Date {
state.mode == .meeting
? state.startedAt.addingTimeInterval(RecordingActivityContentState.maxActivityDuration)
: now.addingTimeInterval(60 * 60)
}
}