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
@@ -0,0 +1,36 @@
import Foundation
/// A service that reports the lifecycle of the recording flow to a surface outside the Recording feature's own UI.
///
/// ``RecordingView`` attaches the service to its model at initialization, so the reporting destination can be swapped without touching
/// the feature's state machine for example, with a Live Activity backend in the app, or with a mock in unit tests. The model reports
/// every transition of the flow: the start of a recording, its pauses and resumptions, the processing of its input, and the end of the
/// whole flow.
public protocol Reporting: Sendable {
// MARK: Methods
/// Reports the start of a new recording.
///
/// - Parameter anchor: The instant the elapsed recording time counts from.
func started(at anchor: Date) async
/// Reports the pause of the ongoing recording.
///
/// - Parameter elapsed: The number of seconds spent recording so far, excluding any time spent paused.
func paused(elapsed: TimeInterval) async
/// Reports the resumption of a paused recording.
///
/// - Parameter anchor: The instant the elapsed recording time counts from, moved back by the time already spent recording.
func resumed(anchor: Date) async
/// Reports the processing of the recorded input.
///
/// - Parameter elapsed: The number of seconds spent recording, excluding any time spent paused.
func processing(elapsed: TimeInterval) async
/// Reports the end of the recording flow.
func ended() async
}