Schedule media downloads after successful transaction.
This commit is contained in:
parent
4a9a07a9ef
commit
0817f113c6
2 changed files with 26 additions and 20 deletions
|
@ -874,13 +874,14 @@ object DataMessageProcessor {
|
|||
}
|
||||
|
||||
return if (insertResult != null) {
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
val allAttachments = SignalDatabase.attachments.getAttachmentsForMessage(insertResult.messageId)
|
||||
val stickerAttachments = allAttachments.filter { it.isSticker }.toList()
|
||||
val attachments = allAttachments.filterNot { it.isSticker }.toList()
|
||||
val otherAttachments = allAttachments.filterNot { it.isSticker }.toList()
|
||||
|
||||
forceStickerDownloadIfNecessary(context, insertResult.messageId, stickerAttachments)
|
||||
|
||||
for (attachment in attachments) {
|
||||
for (attachment in otherAttachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(insertResult.messageId, attachment.attachmentId, false))
|
||||
}
|
||||
|
||||
|
@ -890,6 +891,7 @@ object DataMessageProcessor {
|
|||
if (message.isViewOnce) {
|
||||
ApplicationDependencies.getViewOnceMessageManager().scheduleIfNecessary()
|
||||
}
|
||||
}
|
||||
|
||||
MessageId(insertResult.messageId)
|
||||
} else {
|
||||
|
|
|
@ -404,11 +404,13 @@ object SyncMessageProcessor {
|
|||
SignalDatabase.messages.endTransaction()
|
||||
}
|
||||
if (syncAttachments.isNotEmpty()) {
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(MmsException::class)
|
||||
private fun handleSynchronizeSentStoryMessage(envelope: Envelope, sent: Sent) {
|
||||
|
@ -511,11 +513,12 @@ object SyncMessageProcessor {
|
|||
} finally {
|
||||
SignalDatabase.messages.endTransaction()
|
||||
}
|
||||
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleGroupRecipientUpdate(sent: Sent, envelopeTimestamp: Long) {
|
||||
log(envelopeTimestamp, "Group recipient update.")
|
||||
|
@ -799,12 +802,13 @@ object SyncMessageProcessor {
|
|||
} finally {
|
||||
SignalDatabase.messages.endTransaction()
|
||||
}
|
||||
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
|
||||
DataMessageProcessor.forceStickerDownloadIfNecessary(context, messageId, stickerAttachments)
|
||||
}
|
||||
|
||||
return threadId
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue