Link Previews

This commit is contained in:
Scott Nonnenberg 2019-01-15 19:03:56 -08:00
parent 91ef39e482
commit 813924685e
36 changed files with 2298 additions and 134 deletions

View file

@ -795,6 +795,7 @@
readReceipts,
typingIndicators,
unidentifiedDeliveryIndicators,
linkPreviews,
} = configuration;
storage.put('read-receipt-setting', readReceipts);
@ -813,6 +814,10 @@
storage.put('typingIndicators', typingIndicators);
}
if (linkPreviews === true || linkPreviews === false) {
storage.put('linkPreviews', linkPreviews);
}
ev.confirm();
}
@ -1107,7 +1112,9 @@
}
try {
if (queryMessage.get('schemaVersion') < Message.CURRENT_SCHEMA_VERSION) {
if (
queryMessage.get('schemaVersion') < Message.VERSION_NEEDED_FOR_DISPLAY
) {
const upgradedMessage = await upgradeMessageSchema(
queryMessage.attributes
);
@ -1126,15 +1133,23 @@
const queryAttachments = queryMessage.get('attachments') || [];
if (queryAttachments.length === 0) {
return message;
if (queryAttachments.length > 0) {
const queryFirst = queryAttachments[0];
const { thumbnail } = queryFirst;
if (thumbnail && thumbnail.path) {
firstAttachment.thumbnail = thumbnail;
}
}
const queryFirst = queryAttachments[0];
const { thumbnail } = queryFirst;
const queryPreview = queryMessage.get('preview') || [];
if (queryPreview.length > 0) {
const queryFirst = queryPreview[0];
const { image } = queryFirst;
if (thumbnail && thumbnail.path) {
firstAttachment.thumbnail = thumbnail;
if (image && image.path) {
firstAttachment.thumbnail = image;
}
}
return message;