Group together voice message and poll actions (#2054)

* Group together voice message and poll actions

* Extract nested switches into separate methods
This commit is contained in:
Stefan Ceriu
2023-11-09 19:16:42 +02:00
committed by GitHub
parent 4b26a798dc
commit 019ca625ab
8 changed files with 125 additions and 87 deletions
@@ -40,22 +40,22 @@ struct VoiceMessageRoomTimelineView: View {
}
private func onPlaybackPlayPause() {
context.send(viewAction: .playPauseAudio(itemID: timelineItem.id))
context.send(viewAction: .audio(.playPause(itemID: timelineItem.id)))
}
private func onPlaybackSeek(_ progress: Double) {
context.send(viewAction: .seekAudio(itemID: timelineItem.id, progress: progress))
context.send(viewAction: .audio(.seek(itemID: timelineItem.id, progress: progress)))
}
private func onPlaybackScrubbing(_ dragging: Bool) {
if dragging {
if playerState.playbackState == .playing {
resumePlaybackAfterScrubbing = true
context.send(viewAction: .playPauseAudio(itemID: timelineItem.id))
context.send(viewAction: .audio(.playPause(itemID: timelineItem.id)))
}
} else {
if resumePlaybackAfterScrubbing {
context.send(viewAction: .playPauseAudio(itemID: timelineItem.id))
context.send(viewAction: .audio(.playPause(itemID: timelineItem.id)))
resumePlaybackAfterScrubbing = false
}
}