Add a progress indicator to voice message preview (#1956)

This commit is contained in:
Nicolas Mauri
2023-10-25 12:27:00 +02:00
committed by GitHub
parent 1ba6fb0a60
commit 30b18031a0
7 changed files with 112 additions and 17 deletions
@@ -49,7 +49,7 @@ struct VoiceMessagePreviewComposer: View {
}
var showWaveformCursor: Bool {
playerState.playbackState == .playing || dragState.isDragging
playerState.playbackState == .playing || dragState.isActive
}
var body: some View {
@@ -65,6 +65,11 @@ struct VoiceMessagePreviewComposer: View {
}
waveformView
.waveformDragGesture($dragState)
.progressCursor(progress: playerState.progress) {
WaveformCursorView(color: .compound.iconAccentTertiary)
.opacity(showWaveformCursor ? 1 : 0)
.frame(width: waveformLineWidth)
}
.onChange(of: dragState) { dragState in
switch dragState {
case .inactive: