package org.asamk.signal.json;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import org.asamk.signal.manager.api.MessageEnvelope;
-import org.whispersystems.signalservice.api.messages.shared.SharedContact;
+public record JsonContactAvatar(JsonAttachment attachment, boolean isProfile) {
-public class JsonContactAvatar {
-
- @JsonProperty
- private final JsonAttachment attachment;
-
- @JsonProperty
- private final boolean isProfile;
-
- public JsonContactAvatar(SharedContact.Avatar avatar) {
- attachment = new JsonAttachment(avatar.getAttachment());
- isProfile = avatar.isProfile();
+ static JsonContactAvatar from(MessageEnvelope.Data.SharedContact.Avatar avatar) {
+ return new JsonContactAvatar(JsonAttachment.from(avatar.attachment()), avatar.isProfile());
}
}