mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add support for showing media playback controls on the lock screen
This commit is contained in:
committed by
Stefan Ceriu
parent
d0d24e2d09
commit
a4166de502
@@ -28,6 +28,7 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
audioPlayerMock.underlyingActions = audioPlayerActions
|
||||
audioPlayerMock.state = .stopped
|
||||
audioPlayerMock.currentTime = 0.0
|
||||
audioPlayerMock.duration = 0.0
|
||||
audioPlayerMock.seekToClosure = { [audioPlayerSeekCallsSubject] progress in
|
||||
audioPlayerSeekCallsSubject?.send(progress)
|
||||
}
|
||||
@@ -37,7 +38,7 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
override func setUp() async throws {
|
||||
audioPlayerActionsSubject = .init()
|
||||
audioPlayerSeekCallsSubject = .init()
|
||||
audioPlayerState = AudioPlayerState(id: .timelineItemIdentifier(.random), duration: Self.audioDuration)
|
||||
audioPlayerState = AudioPlayerState(id: .timelineItemIdentifier(.random), title: "", duration: Self.audioDuration)
|
||||
audioPlayerMock = buildAudioPlayerMock()
|
||||
audioPlayerMock.seekToClosure = { [weak self] progress in
|
||||
self?.audioPlayerMock.currentTime = Self.audioDuration * progress
|
||||
@@ -161,7 +162,7 @@ class AudioPlayerStateTests: XCTestCase {
|
||||
func testHandlingAudioPlayerActionDidFinishLoading() async throws {
|
||||
audioPlayerMock.duration = 10.0
|
||||
|
||||
audioPlayerState = AudioPlayerState(id: .timelineItemIdentifier(.random), duration: 0)
|
||||
audioPlayerState = AudioPlayerState(id: .timelineItemIdentifier(.random), title: "", duration: 0)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayerMock)
|
||||
|
||||
let deferred = deferFulfillment(audioPlayerState.$playbackState) { action in
|
||||
|
||||
@@ -323,7 +323,9 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
viewModel.context.composerFormattingEnabled = false
|
||||
let waveformData: [Float] = Array(repeating: 1.0, count: 1000)
|
||||
viewModel.context.plainComposerText = .init(string: "Hello world!")
|
||||
viewModel.process(timelineAction: .setMode(mode: .previewVoiceMessage(state: AudioPlayerState(id: .recorderPreview, duration: 10.0), waveform: .data(waveformData), isUploading: false)))
|
||||
viewModel.process(timelineAction: .setMode(mode: .previewVoiceMessage(state: AudioPlayerState(id: .recorderPreview, title: "", duration: 10.0),
|
||||
waveform: .data(waveformData),
|
||||
isUploading: false)))
|
||||
viewModel.saveDraft()
|
||||
|
||||
await fulfillment(of: [expectation], timeout: 10)
|
||||
|
||||
@@ -64,7 +64,7 @@ class MediaPlayerProviderTests: XCTestCase {
|
||||
// By default, there should be no player state
|
||||
XCTAssertNil(mediaPlayerProvider.playerState(for: audioPlayerStateId))
|
||||
|
||||
let audioPlayerState = AudioPlayerState(id: audioPlayerStateId, duration: 10.0)
|
||||
let audioPlayerState = AudioPlayerState(id: audioPlayerStateId, title: "", duration: 10.0)
|
||||
mediaPlayerProvider.register(audioPlayerState: audioPlayerState)
|
||||
XCTAssertEqual(audioPlayerState, mediaPlayerProvider.playerState(for: audioPlayerStateId))
|
||||
|
||||
@@ -76,7 +76,7 @@ class MediaPlayerProviderTests: XCTestCase {
|
||||
let audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = PassthroughSubject<AudioPlayerAction, Never>().eraseToAnyPublisher()
|
||||
|
||||
let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.random), duration: 0), count: 10)
|
||||
let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.random), title: "", duration: 0), count: 10)
|
||||
for audioPlayerState in audioPlayerStates {
|
||||
mediaPlayerProvider.register(audioPlayerState: audioPlayerState)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayer)
|
||||
@@ -95,7 +95,7 @@ class MediaPlayerProviderTests: XCTestCase {
|
||||
let audioPlayer = AudioPlayerMock()
|
||||
audioPlayer.actions = PassthroughSubject<AudioPlayerAction, Never>().eraseToAnyPublisher()
|
||||
|
||||
let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.random), duration: 0), count: 10)
|
||||
let audioPlayerStates = Array(repeating: AudioPlayerState(id: .timelineItemIdentifier(.random), title: "", duration: 0), count: 10)
|
||||
for audioPlayerState in audioPlayerStates {
|
||||
mediaPlayerProvider.register(audioPlayerState: audioPlayerState)
|
||||
audioPlayerState.attachAudioPlayer(audioPlayer)
|
||||
|
||||
Reference in New Issue
Block a user