From 9cf30dd67e5e98916f2a22db835d61967e7f078c Mon Sep 17 00:00:00 2001 From: alansley Date: Thu, 16 May 2024 09:42:02 +1000 Subject: [PATCH] Minor phrasing & indentation adjustments --- .../conversation/v2/ConversationActivityV2.kt | 12 +++++++----- .../securesms/database/MmsSmsDatabase.java | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 06681f75cf..508aebdef2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -299,10 +299,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe private val adapter by lazy { - // To prevent repeated attachment download jobs being spawned we'll keep track of the - // attachment Ids we've attempted to download, and only spawn job if we haven't already - // tried. Without this then when the retry limit for a failed job hits another job is - // immediately spawned (endlessly). + // To prevent repeated attachment download jobs being spawned for any that fail we'll keep + // track of the attachment Ids we've attempted to download. Without this guard mechanism + // then when the retry limit for a failed job is reached another job is immediately spawned + // to download the same attachment (endlessly). val alreadyAttemptedAttachmentDownloads = mutableSetOf() val cursor = mmsSmsDb.getConversation(viewModel.threadId, reverseMessageList) @@ -333,7 +333,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe }, onAttachmentNeedsDownload = { attachmentId, mmsId -> - alreadyAttemptedAttachmentDownloads.takeUnless { attachmentId in alreadyAttemptedAttachmentDownloads }.let { + alreadyAttemptedAttachmentDownloads.takeUnless { + attachmentId in alreadyAttemptedAttachmentDownloads + }.let { alreadyAttemptedAttachmentDownloads += attachmentId lifecycleScope.launch(Dispatchers.IO) { JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId)) diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java b/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java index 54141311d4..7dfbf3dcde 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/MmsSmsDatabase.java @@ -306,7 +306,7 @@ public class MmsSmsDatabase extends Database { MessageRecord messageRecord; while ((messageRecord = reader.getNext()) != null) { // Note: We rely on the message order to get us the most recent outgoing message - so we - // take the first outgoing message we find. + // take the first outgoing message we find as the last outgoing message. if (messageRecord.isOutgoing()) return messageRecord.id; } }