Added the recording flow reporting and command listening on the RecordingViewModel view model in the Recording package target.

This commit is contained in:
2026-07-05 22:00:43 +02:00
parent d473504d75
commit cfe6b1b408
6 changed files with 426 additions and 8 deletions
@@ -31,22 +31,26 @@ public struct RecordingView: View {
// MARK: Initializers
/// Creates a recording view in the not-recording state, attached to the given recording and transcribing services.
/// Creates a recording view in the not-recording state, attached to the given recording, transcribing, and reporting services.
///
/// - Parameters:
/// - capturer: The service that captures the audio from a microphone.
/// - transcriber: The service that transcribes the recorded audio into text.
/// - reporter: The service that reports the lifecycle of the recording flow outside the feature's UI, or `nil` to report nowhere.
/// Defaults to `nil`.
/// - locale: The binding to the locale of the spoken language to transcribe.
/// - onTranscription: The closure invoked with the transcription of every processed recording. Defaults to a closure that does nothing.
public init(
capturer: any Capturing,
transcriber: any Transcribing,
reporter: (any Reporting)? = nil,
locale: Binding<Locale>,
onTranscription: @escaping (Transcription) -> Void
) {
self.model = .init(
capturer: capturer,
transcribe: transcriber,
reporter: reporter ?? DummyReporting(),
locale: locale
)
self.onTranscription = onTranscription