mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 14:40:22 +00:00
Schedule media downloads after successful transaction.
This commit is contained in:
@@ -874,21 +874,23 @@ object DataMessageProcessor {
|
||||
}
|
||||
|
||||
return if (insertResult != null) {
|
||||
val allAttachments = SignalDatabase.attachments.getAttachmentsForMessage(insertResult.messageId)
|
||||
val stickerAttachments = allAttachments.filter { it.isSticker }.toList()
|
||||
val attachments = allAttachments.filterNot { it.isSticker }.toList()
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
val allAttachments = SignalDatabase.attachments.getAttachmentsForMessage(insertResult.messageId)
|
||||
val stickerAttachments = allAttachments.filter { it.isSticker }.toList()
|
||||
val otherAttachments = allAttachments.filterNot { it.isSticker }.toList()
|
||||
|
||||
forceStickerDownloadIfNecessary(context, insertResult.messageId, stickerAttachments)
|
||||
forceStickerDownloadIfNecessary(context, insertResult.messageId, stickerAttachments)
|
||||
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(insertResult.messageId, attachment.attachmentId, false))
|
||||
}
|
||||
for (attachment in otherAttachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(insertResult.messageId, attachment.attachmentId, false))
|
||||
}
|
||||
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, ConversationId.forConversation(insertResult.threadId))
|
||||
TrimThreadJob.enqueueAsync(insertResult.threadId)
|
||||
ApplicationDependencies.getMessageNotifier().updateNotification(context, ConversationId.forConversation(insertResult.threadId))
|
||||
TrimThreadJob.enqueueAsync(insertResult.threadId)
|
||||
|
||||
if (message.isViewOnce) {
|
||||
ApplicationDependencies.getViewOnceMessageManager().scheduleIfNecessary()
|
||||
if (message.isViewOnce) {
|
||||
ApplicationDependencies.getViewOnceMessageManager().scheduleIfNecessary()
|
||||
}
|
||||
}
|
||||
|
||||
MessageId(insertResult.messageId)
|
||||
|
||||
@@ -404,8 +404,10 @@ object SyncMessageProcessor {
|
||||
SignalDatabase.messages.endTransaction()
|
||||
}
|
||||
if (syncAttachments.isNotEmpty()) {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,9 +513,10 @@ object SyncMessageProcessor {
|
||||
} finally {
|
||||
SignalDatabase.messages.endTransaction()
|
||||
}
|
||||
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,13 +802,14 @@ object SyncMessageProcessor {
|
||||
} finally {
|
||||
SignalDatabase.messages.endTransaction()
|
||||
}
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
}
|
||||
|
||||
for (attachment in attachments) {
|
||||
ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(messageId, attachment.attachmentId, false))
|
||||
DataMessageProcessor.forceStickerDownloadIfNecessary(context, messageId, stickerAttachments)
|
||||
}
|
||||
|
||||
DataMessageProcessor.forceStickerDownloadIfNecessary(context, messageId, stickerAttachments)
|
||||
|
||||
return threadId
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user