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 {
// 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<Long>()
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))

View File

@ -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;
}
}