delete voice files on failuer

This commit is contained in:
davotoula
2026-03-25 17:42:05 +01:00
parent 42db03790a
commit aa5dad9fac
@@ -697,6 +697,8 @@ open class ShortNotePostViewModel :
// Abort if upload failed - don't post without voice data // Abort if upload failed - don't post without voice data
if (voiceMetadata == null) { if (voiceMetadata == null) {
Log.w("ShortNotePostViewModel", "Voice upload failed, aborting post") Log.w("ShortNotePostViewModel", "Voice upload failed, aborting post")
deleteVoiceLocalFile()
voiceAnonymization.deleteDistortedFiles()
return return
} }
// Update default server if voice message was successfully uploaded // Update default server if voice message was successfully uploaded
@@ -1274,8 +1276,7 @@ open class ShortNotePostViewModel :
private fun deleteVoiceLocalFile() { private fun deleteVoiceLocalFile() {
voiceLocalFile?.let { file -> voiceLocalFile?.let { file ->
try { try {
if (file.exists()) { if (file.delete()) {
file.delete()
Log.d("ShortNotePostViewModel", "Deleted voice file: ${file.absolutePath}") Log.d("ShortNotePostViewModel", "Deleted voice file: ${file.absolutePath}")
} }
} catch (e: Exception) { } catch (e: Exception) {