From a53a7a301ee47d3f5b738cb6d764ec58db9aa511 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 17 May 2022 16:33:09 +0300 Subject: [PATCH] Fixes #6160 - Stop deleting audio recording when sending fails and allow it to be retried through the normal mechanism --- .../Room/VoiceMessages/VoiceMessageController.swift | 8 +++++++- changelog.d/6160.bugfix | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog.d/6160.bugfix diff --git a/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift b/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift index 01a57e742..1ee5288d1 100644 --- a/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift +++ b/Riot/Modules/Room/VoiceMessages/VoiceMessageController.swift @@ -352,7 +352,13 @@ public class VoiceMessageController: NSObject, VoiceMessageToolbarViewDelegate, samples: invertedSamples) { [weak self] success in UINotificationFeedbackGenerator().notificationOccurred((success ? .success : .error)) self?.deleteRecordingAtURL(sourceURL) - self?.deleteRecordingAtURL(destinationURL) + + // Do not delete the file to be sent if request failed, the retry flow will need it + // There's no manual mechanism to clean it up afterwards but the tmp folder + // they live in will eventually be deleted by the system + if success { + self?.deleteRecordingAtURL(destinationURL) + } } } } diff --git a/changelog.d/6160.bugfix b/changelog.d/6160.bugfix new file mode 100644 index 000000000..9e35700d6 --- /dev/null +++ b/changelog.d/6160.bugfix @@ -0,0 +1 @@ +Stop deleting audio recording when sending fails. \ No newline at end of file