Implemented the resumed interrupted recordings and allowed processing discards on the RecordingViewModel view model in the Recording package target.
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user