mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 05:08:06 +00:00
Add a backup media download progress bar
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
AttachmentDownloadManager,
|
||||
AttachmentDownloadUrgency,
|
||||
} from '../jobs/AttachmentDownloadManager';
|
||||
import { AttachmentDownloadSource } from '../sql/Interface';
|
||||
|
||||
export type MessageAttachmentsDownloadedType = {
|
||||
bodyAttachment?: AttachmentType;
|
||||
@@ -62,7 +63,13 @@ function getAttachmentSignatureSafe(
|
||||
// count then you'll also have to modify ./hasAttachmentsDownloads
|
||||
export async function queueAttachmentDownloads(
|
||||
message: MessageAttributesType,
|
||||
urgency: AttachmentDownloadUrgency = AttachmentDownloadUrgency.STANDARD
|
||||
{
|
||||
urgency = AttachmentDownloadUrgency.STANDARD,
|
||||
source = AttachmentDownloadSource.STANDARD,
|
||||
}: {
|
||||
urgency?: AttachmentDownloadUrgency;
|
||||
source?: AttachmentDownloadSource;
|
||||
} = {}
|
||||
): Promise<MessageAttachmentsDownloadedType | undefined> {
|
||||
const attachmentsToQueue = message.attachments || [];
|
||||
const messageId = message.id;
|
||||
@@ -109,6 +116,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,6 +134,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
}
|
||||
);
|
||||
count += attachmentsCount;
|
||||
@@ -144,6 +153,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
count += previewCount;
|
||||
|
||||
@@ -162,6 +172,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
count += thumbnailCount;
|
||||
|
||||
@@ -194,6 +205,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
}),
|
||||
},
|
||||
};
|
||||
@@ -230,6 +242,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
} else {
|
||||
log.error(`${idLog}: Sticker data was missing`);
|
||||
@@ -267,6 +280,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
count += editAttachmentsCount;
|
||||
if (editAttachmentsCount !== 0) {
|
||||
@@ -285,6 +299,7 @@ export async function queueAttachmentDownloads(
|
||||
receivedAt: message.received_at,
|
||||
sentAt: message.sent_at,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
count += editPreviewCount;
|
||||
if (editPreviewCount !== 0) {
|
||||
@@ -328,6 +343,7 @@ async function queueNormalAttachments({
|
||||
receivedAt,
|
||||
sentAt,
|
||||
urgency,
|
||||
source,
|
||||
}: {
|
||||
idLog: string;
|
||||
messageId: string;
|
||||
@@ -336,6 +352,7 @@ async function queueNormalAttachments({
|
||||
receivedAt: number;
|
||||
sentAt: number;
|
||||
urgency: AttachmentDownloadUrgency;
|
||||
source: AttachmentDownloadSource;
|
||||
}): Promise<{
|
||||
attachments: Array<AttachmentType>;
|
||||
count: number;
|
||||
@@ -393,6 +410,7 @@ async function queueNormalAttachments({
|
||||
receivedAt,
|
||||
sentAt,
|
||||
urgency,
|
||||
source,
|
||||
});
|
||||
})
|
||||
);
|
||||
@@ -426,6 +444,7 @@ async function queuePreviews({
|
||||
receivedAt,
|
||||
sentAt,
|
||||
urgency,
|
||||
source,
|
||||
}: {
|
||||
idLog: string;
|
||||
messageId: string;
|
||||
@@ -434,6 +453,7 @@ async function queuePreviews({
|
||||
receivedAt: number;
|
||||
sentAt: number;
|
||||
urgency: AttachmentDownloadUrgency;
|
||||
source: AttachmentDownloadSource;
|
||||
}): Promise<{ preview: Array<LinkPreviewType>; count: number }> {
|
||||
// Similar to queueNormalAttachments' logic for detecting same attachments
|
||||
// except here we also pick by link preview URL.
|
||||
@@ -485,6 +505,7 @@ async function queuePreviews({
|
||||
receivedAt,
|
||||
sentAt,
|
||||
urgency,
|
||||
source,
|
||||
}),
|
||||
};
|
||||
})
|
||||
@@ -518,6 +539,7 @@ async function queueQuoteAttachments({
|
||||
receivedAt,
|
||||
sentAt,
|
||||
urgency,
|
||||
source,
|
||||
}: {
|
||||
idLog: string;
|
||||
messageId: string;
|
||||
@@ -526,6 +548,7 @@ async function queueQuoteAttachments({
|
||||
receivedAt: number;
|
||||
sentAt: number;
|
||||
urgency: AttachmentDownloadUrgency;
|
||||
source: AttachmentDownloadSource;
|
||||
}): Promise<{ quote?: QuotedMessageType; count: number }> {
|
||||
let count = 0;
|
||||
if (!quote) {
|
||||
@@ -600,6 +623,7 @@ async function queueQuoteAttachments({
|
||||
receivedAt,
|
||||
sentAt,
|
||||
urgency,
|
||||
source,
|
||||
}),
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user