mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 03:48:27 +00:00
Add unit tests for voice messages (#1869)
This commit is contained in:
@@ -30,3 +30,6 @@ enum AudioPlayerAction {
|
||||
protocol AudioPlayerProtocol: MediaPlayerProtocol {
|
||||
var actions: AnyPublisher<AudioPlayerAction, Never> { get }
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
extension AudioPlayerProtocol { }
|
||||
|
||||
@@ -40,6 +40,10 @@ class AudioPlayerState: ObservableObject {
|
||||
var isAttached: Bool {
|
||||
audioPlayer != nil
|
||||
}
|
||||
|
||||
var isPublishingProgress: Bool {
|
||||
cancellableTimer != nil
|
||||
}
|
||||
|
||||
init(duration: Double, waveform: Waveform? = nil, progress: Double = 0.0) {
|
||||
self.duration = duration
|
||||
@@ -133,6 +137,7 @@ class AudioPlayerState: ObservableObject {
|
||||
|
||||
private func stopPublishProgress() {
|
||||
cancellableTimer?.cancel()
|
||||
cancellableTimer = nil
|
||||
}
|
||||
|
||||
private func restoreAudioPlayerState(audioPlayer: AudioPlayerProtocol) async {
|
||||
|
||||
@@ -37,3 +37,6 @@ protocol MediaPlayerProtocol {
|
||||
func stop()
|
||||
func seek(to progress: Double) async
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
extension MediaPlayerProtocol { }
|
||||
|
||||
@@ -19,3 +19,6 @@ import Foundation
|
||||
protocol VoiceMessageMediaManagerProtocol {
|
||||
func loadVoiceMessageFromSource(_ source: MediaSourceProxy, body: String?) async throws -> URL
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
extension VoiceMessageMediaManagerProtocol { }
|
||||
|
||||
Reference in New Issue
Block a user