Implemented the resumed interrupted recordings and allowed processing discards on the RecordingViewModel view model in the Recording package target.

This commit is contained in:
2026-07-05 16:16:53 +02:00
parent 8576d6bac6
commit c2ac476257
14 changed files with 563 additions and 309 deletions
@@ -5,6 +5,8 @@ import Recording
/// configured to fail.
@MainActor
final class CapturingMock: Capturing {
// MARK: Properties
/// The stream of events the service emits outside its method calls.
let events: AsyncStream<CapturingEvent>
@@ -20,16 +22,29 @@ final class CapturingMock: Capturing {
/// The continuation that feeds ``events``.
private let continuation: AsyncStream<CapturingEvent>.Continuation
// MARK: Initializers
init() {
(events, continuation) = AsyncStream.makeStream(of: CapturingEvent.self)
}
// MARK: Methods
/// Emits an interruption of the ongoing capture through ``events``.
func interrupt() {
continuation.yield(.interrupted)
}
/// Emits the end of an interruption of the capture through ``events``.
///
/// - Parameter shouldResume: Whether the capture may resume right away.
func endInterruption(
shouldResume: Bool
) {
continuation.yield(.interruptionEnded(shouldResume: shouldResume))
}
func start() async throws {
try await called("start")
}