mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-17 21:47:28 +00:00
Attachment download job re-start preventer removed
This commit is contained in:
parent
34ae58da8d
commit
f6fb4ab78c
@ -298,13 +298,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
private val reverseMessageList = false
|
private val reverseMessageList = false
|
||||||
|
|
||||||
private val adapter by lazy {
|
private val adapter by lazy {
|
||||||
|
|
||||||
// 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)
|
val cursor = mmsSmsDb.getConversation(viewModel.threadId, reverseMessageList)
|
||||||
val adapter = ConversationAdapter(
|
val adapter = ConversationAdapter(
|
||||||
this,
|
this,
|
||||||
@ -332,14 +325,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAttachmentNeedsDownload = { attachmentId, mmsId ->
|
onAttachmentNeedsDownload = { attachmentId, mmsId ->
|
||||||
alreadyAttemptedAttachmentDownloads.takeUnless {
|
|
||||||
attachmentId in it
|
|
||||||
}?.let {
|
|
||||||
it += attachmentId
|
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId))
|
JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
glide = glide,
|
glide = glide,
|
||||||
lifecycleCoroutineScope = lifecycleScope
|
lifecycleCoroutineScope = lifecycleScope
|
||||||
|
Loading…
x
Reference in New Issue
Block a user