Add support for link preview descriptions.

This commit is contained in:
Greyson Parrelli
2020-08-25 16:05:39 -04:00
committed by GitHub
parent a3438c4f8d
commit c78e098cb4
19 changed files with 151 additions and 58 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(), attachment));
previews.add(new LinkPreview(preview.getUrl(), preview.getTitle(), preview.getDescription(), 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(), attachmentId);
LinkPreview updatedPreview = new LinkPreview(preview.getUrl(), preview.getTitle(), preview.getDescription(), attachmentId);
linkPreviewJson.put(new JSONObject(updatedPreview.serialize()));
} catch (JSONException | IOException e) {
Log.w(TAG, "Failed to serialize shared contact. Skipping it.", e);