Minor phrasing & indentation adjustments

This commit is contained in:
alansley 2024-05-16 09:42:02 +10:00 committed by Andrew
parent b300b9a743
commit 9cf30dd67e
2 changed files with 8 additions and 6 deletions

View File

@ -299,10 +299,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private val adapter by lazy { private val adapter by lazy {
// To prevent repeated attachment download jobs being spawned we'll keep track of the // To prevent repeated attachment download jobs being spawned for any that fail we'll keep
// attachment Ids we've attempted to download, and only spawn job if we haven't already // track of the attachment Ids we've attempted to download. Without this guard mechanism
// tried. Without this then when the retry limit for a failed job hits another job is // then when the retry limit for a failed job is reached another job is immediately spawned
// immediately spawned (endlessly). // to download the same attachment (endlessly).
val alreadyAttemptedAttachmentDownloads = mutableSetOf<Long>() val alreadyAttemptedAttachmentDownloads = mutableSetOf<Long>()
val cursor = mmsSmsDb.getConversation(viewModel.threadId, reverseMessageList) val cursor = mmsSmsDb.getConversation(viewModel.threadId, reverseMessageList)
@ -333,7 +333,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
}, },
onAttachmentNeedsDownload = { attachmentId, mmsId -> onAttachmentNeedsDownload = { attachmentId, mmsId ->
alreadyAttemptedAttachmentDownloads.takeUnless { attachmentId in alreadyAttemptedAttachmentDownloads }.let { alreadyAttemptedAttachmentDownloads.takeUnless {
attachmentId in alreadyAttemptedAttachmentDownloads
}.let {
alreadyAttemptedAttachmentDownloads += attachmentId alreadyAttemptedAttachmentDownloads += attachmentId
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId)) JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId))

View File

@ -306,7 +306,7 @@ public class MmsSmsDatabase extends Database {
MessageRecord messageRecord; MessageRecord messageRecord;
while ((messageRecord = reader.getNext()) != null) { while ((messageRecord = reader.getNext()) != null) {
// Note: We rely on the message order to get us the most recent outgoing message - so we // 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; if (messageRecord.isOutgoing()) return messageRecord.id;
} }
} }