From db42f61cbb763c6e20ab6dc2fd47ae412b6fe953 Mon Sep 17 00:00:00 2001 From: signals-from-outer-space Date: Sun, 2 Apr 2023 08:34:43 +0200 Subject: [PATCH] Added missing file attachment attributes in JsonAttachment output Closes #1217 Fixes #1216 --- .../org/asamk/signal/json/JsonAttachment.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/asamk/signal/json/JsonAttachment.java b/src/main/java/org/asamk/signal/json/JsonAttachment.java index 1f6e6510..c75b3987 100644 --- a/src/main/java/org/asamk/signal/json/JsonAttachment.java +++ b/src/main/java/org/asamk/signal/json/JsonAttachment.java @@ -2,12 +2,33 @@ package org.asamk.signal.json; import org.asamk.signal.manager.api.MessageEnvelope; -record JsonAttachment(String contentType, String filename, String id, Long size) { +record JsonAttachment( + String contentType, + String filename, + String id, + Long size, + Integer width, + Integer height, + String caption, + Long uploadTimestamp +) { static JsonAttachment from(MessageEnvelope.Data.Attachment attachment) { final var id = attachment.id().orElse(null); final var filename = attachment.fileName().orElse(null); final var size = attachment.size().orElse(null); - return new JsonAttachment(attachment.contentType(), filename, id, size); + final var width = attachment.width().orElse(null); + final var height = attachment.height().orElse(null); + final var caption = attachment.caption().orElse(null); + final var uploadTimestamp = attachment.uploadTimestamp().orElse(null); + + return new JsonAttachment(attachment.contentType(), + filename, + id, + size, + width, + height, + caption, + uploadTimestamp); } }