From a7cac06cab58e7780b4e35de9ab2479de34441ee Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 25 Mar 2025 13:04:45 -0500 Subject: [PATCH] Do not clear message box after upload but before final upload --- .../eu/siacs/conversations/ui/ConversationFragment.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 8226c6e81e72261d856e851960b0282ef5c708ae..6ef1357bc02a305990ace43cac421fb62cbfc2b4 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1261,6 +1261,7 @@ public class ConversationFragment extends XmppFragment @Override public void run() { try { + if (!i.hasNext()) return; final Attachment attachment = i.next(); if (attachment.getType() == Attachment.Type.LOCATION) { attachLocationToConversation(conversation, attachment.getUri()); @@ -1269,14 +1270,15 @@ public class ConversationFragment extends XmppFragment Log.d( Config.LOGTAG, "ConversationsActivity.commitAttachments() - attaching image to conversations. CHOOSE_IMAGE"); - attachImageToConversation(conversation, attachment.getUri(), attachment.getMime(), i.hasNext() ? this : null); + attachImageToConversation(conversation, attachment.getUri(), attachment.getMime(), this); } else { Log.d( Config.LOGTAG, "ConversationsActivity.commitAttachments() - attaching file to conversations. CHOOSE_FILE/RECORD_VOICE/RECORD_VIDEO"); - attachFileToConversation(conversation, attachment.getUri(), attachment.getMime(), i.hasNext() ? this : null); + attachFileToConversation(conversation, attachment.getUri(), attachment.getMime(), this); } i.remove(); + if (!i.hasNext()) messageSent(); } catch (final java.util.ConcurrentModificationException e) { // Abort, leave any unsent attachments alone for the user to try again Toast.makeText(activity, "Sometimes went wrong with some attachments. Try again?", Toast.LENGTH_SHORT).show();