Add support for article dates in link previews.

This commit is contained in:
Greyson Parrelli
2020-08-26 16:03:52 -04:00
committed by Alan Evans
parent bfed03b7b5
commit dd8b9ff8fb
13 changed files with 124 additions and 23 deletions

View File

@@ -1118,7 +1118,7 @@ public class MmsDatabase extends MessageDatabase {
if (preview.getAttachmentId() != null) {
DatabaseAttachment attachment = attachmentIdMap.get(preview.getAttachmentId());
if (attachment != null) {
previews.add(new LinkPreview(preview.getUrl(), preview.getTitle(), preview.getDescription(), attachment));
previews.add(new LinkPreview(preview.getUrl(), preview.getTitle(), preview.getDescription(), preview.getDate(), attachment));
}
} else {
previews.add(preview);
@@ -1526,7 +1526,7 @@ public class MmsDatabase extends MessageDatabase {
attachmentId = insertedAttachmentIds.get(preview.getThumbnail().get());
}
LinkPreview updatedPreview = new LinkPreview(preview.getUrl(), preview.getTitle(), preview.getDescription(), attachmentId);
LinkPreview updatedPreview = new LinkPreview(preview.getUrl(), preview.getTitle(), preview.getDescription(), preview.getDate(), attachmentId);
linkPreviewJson.put(new JSONObject(updatedPreview.serialize()));
} catch (JSONException | IOException e) {
Log.w(TAG, "Failed to serialize shared contact. Skipping it.", e);