Added the recording flow reporting and command listening on the RecordingViewModel view model in the Recording package target.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import Foundation
|
||||
import Recording
|
||||
|
||||
/// A reporting service that records the lifecycle reports it receives, in call order, along with the values of the last report.
|
||||
@MainActor
|
||||
final class ReportingMock: Reporting {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// The names of the reports received by the service, in call order.
|
||||
private(set) var reports: [String] = []
|
||||
|
||||
/// The anchor received with the last started or resumed report, or `nil` when none arrived yet.
|
||||
private(set) var lastAnchor: Date?
|
||||
|
||||
/// The elapsed recording time received with the last paused or processing report, or `nil` when none arrived yet.
|
||||
private(set) var lastElapsed: TimeInterval?
|
||||
|
||||
// MARK: Methods
|
||||
|
||||
func started(
|
||||
at anchor: Date
|
||||
) async {
|
||||
reports.append("started")
|
||||
lastAnchor = anchor
|
||||
}
|
||||
|
||||
func paused(
|
||||
elapsed: TimeInterval
|
||||
) async {
|
||||
reports.append("paused")
|
||||
lastElapsed = elapsed
|
||||
}
|
||||
|
||||
func resumed(
|
||||
anchor: Date
|
||||
) async {
|
||||
reports.append("resumed")
|
||||
lastAnchor = anchor
|
||||
}
|
||||
|
||||
func processing(
|
||||
elapsed: TimeInterval
|
||||
) async {
|
||||
reports.append("processing")
|
||||
lastElapsed = elapsed
|
||||
}
|
||||
|
||||
func ended() async {
|
||||
reports.append("ended")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user