From b2c6a5229bcc74944d9fd97a6a0fd37074e25b0b Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 22 Feb 2021 14:23:15 +1100 Subject: [PATCH] Fix voice message resetting bug --- .../Message Cells/Content Views/VoiceMessageView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift b/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift index 4e655853f..aca5e4c43 100644 --- a/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift +++ b/Session/Conversations/Message Cells/Content Views/VoiceMessageView.swift @@ -136,6 +136,7 @@ public final class VoiceMessageView : UIView { private func handleIsPlayingChanged() { toggleImageView.image = isPlaying ? UIImage(named: "Pause") : UIImage(named: "Play") + if !isPlaying { progress = 0 } } private func handleProgressChanged() { @@ -144,7 +145,9 @@ public final class VoiceMessageView : UIView { if isDownloaded { loader.stopAnimating() } else if !loader.isAnimating { loader.startAnimating() } guard isDownloaded else { return } countdownLabel.text = OWSFormat.formatDurationSeconds(duration - progress) - guard viewItem.audioProgressSeconds > 0 && viewItem.audioDurationSeconds > 0 else { return } + guard viewItem.audioProgressSeconds > 0 && viewItem.audioDurationSeconds > 0 else { + return progressViewRightConstraint.constant = -VoiceMessageView.width + } let fraction = viewItem.audioProgressSeconds / viewItem.audioDurationSeconds progressViewRightConstraint.constant = -(VoiceMessageView.width * (1 - fraction)) }