mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Ensure that attachments received during calls are autodownloaded afterwards.
The easiest way to do this is to add the constraint to the job itself, when appropriate, so that we don't even run the job until you're done with the call.
This commit is contained in:
committed by
jeffrey-signal
parent
0b5fa18504
commit
3db8f5a2af
@@ -961,12 +961,12 @@ object DataMessageProcessor {
|
||||
val downloadJobs: List<AttachmentDownloadJob> = insertResult.insertedAttachments.mapNotNull { (attachment, attachmentId) ->
|
||||
if (attachment.isSticker) {
|
||||
if (attachment.transferState != AttachmentTable.TRANSFER_PROGRESS_DONE) {
|
||||
AttachmentDownloadJob(insertResult.messageId, attachmentId, true)
|
||||
AttachmentDownloadJob(messageId = insertResult.messageId, attachmentId = attachmentId, forceDownload = true)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
AttachmentDownloadJob(insertResult.messageId, attachmentId, false)
|
||||
AttachmentDownloadJob(messageId = insertResult.messageId, attachmentId = attachmentId, forceDownload = false)
|
||||
}
|
||||
}
|
||||
AppDependencies.jobManager.addAll(downloadJobs)
|
||||
|
||||
@@ -496,9 +496,8 @@ object SyncMessageProcessor {
|
||||
|
||||
if (syncAttachments.isNotEmpty()) {
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
AppDependencies.jobManager.add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
val downloadJobs: List<AttachmentDownloadJob> = attachments.map { AttachmentDownloadJob(messageId = messageId, attachmentId = it.attachmentId, forceDownload = it.isSticker) }
|
||||
AppDependencies.jobManager.addAll(downloadJobs)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,9 +595,8 @@ object SyncMessageProcessor {
|
||||
}
|
||||
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
AppDependencies.jobManager.add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
val downloadJobs: List<AttachmentDownloadJob> = attachments.map { AttachmentDownloadJob(messageId = messageId, attachmentId = it.attachmentId, forceDownload = false) }
|
||||
AppDependencies.jobManager.addAll(downloadJobs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -893,10 +891,8 @@ object SyncMessageProcessor {
|
||||
}
|
||||
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
val downloadJobs: List<AttachmentDownloadJob> = attachments.map { AttachmentDownloadJob(messageId, it.attachmentId, false) }
|
||||
for (attachment in attachments) {
|
||||
AppDependencies.jobManager.addAll(downloadJobs)
|
||||
}
|
||||
val downloadJobs: List<AttachmentDownloadJob> = attachments.map { AttachmentDownloadJob(messageId = messageId, attachmentId = it.attachmentId, forceDownload = it.isSticker) }
|
||||
AppDependencies.jobManager.addAll(downloadJobs)
|
||||
}
|
||||
|
||||
return threadId
|
||||
|
||||
Reference in New Issue
Block a user