delete voice files on failuer
This commit is contained in:
+3
-2
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user