mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-30 19:10:38 +00:00
parent
145a2f1179
commit
91700ce995
13 changed files with 176 additions and 39 deletions
|
@ -20,6 +20,7 @@ record JsonDataMessage(
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSticker sticker,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonRemoteDelete remoteDelete,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonSharedContact> contacts,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonTextStyle> textStyles,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonGroupInfo groupInfo,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonStoryContext storyContext
|
||||
) {
|
||||
|
@ -53,11 +54,15 @@ record JsonDataMessage(
|
|||
.map(JsonAttachment::from)
|
||||
.toList() : null;
|
||||
final var sticker = dataMessage.sticker().isPresent() ? JsonSticker.from(dataMessage.sticker().get()) : null;
|
||||
|
||||
final var contacts = dataMessage.sharedContacts().size() > 0 ? dataMessage.sharedContacts()
|
||||
.stream()
|
||||
.map(JsonSharedContact::from)
|
||||
.toList() : null;
|
||||
final var textStyles = dataMessage.textStyles().size() > 0 ? dataMessage.textStyles()
|
||||
.stream()
|
||||
.map(JsonTextStyle::from)
|
||||
.toList() : null;
|
||||
|
||||
return new JsonDataMessage(timestamp,
|
||||
message,
|
||||
expiresInSeconds,
|
||||
|
@ -71,6 +76,7 @@ record JsonDataMessage(
|
|||
sticker,
|
||||
remoteDelete,
|
||||
contacts,
|
||||
textStyles,
|
||||
groupInfo,
|
||||
storyContext);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ public record JsonQuote(
|
|||
String authorUuid,
|
||||
String text,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonMention> mentions,
|
||||
List<JsonQuotedAttachment> attachments
|
||||
List<JsonQuotedAttachment> attachments,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonTextStyle> textStyles
|
||||
) {
|
||||
|
||||
static JsonQuote from(MessageEnvelope.Data.Quote quote) {
|
||||
|
@ -34,6 +35,11 @@ public record JsonQuote(
|
|||
.map(JsonQuotedAttachment::from)
|
||||
.toList() : List.<JsonQuotedAttachment>of();
|
||||
|
||||
return new JsonQuote(id, author, authorNumber, authorUuid, text, mentions, attachments);
|
||||
final var textStyles = quote.textStyles().size() > 0 ? quote.textStyles()
|
||||
.stream()
|
||||
.map(JsonTextStyle::from)
|
||||
.toList() : null;
|
||||
|
||||
return new JsonQuote(id, author, authorNumber, authorUuid, text, mentions, attachments, textStyles);
|
||||
}
|
||||
}
|
||||
|
|
10
src/main/java/org/asamk/signal/json/JsonTextStyle.java
Normal file
10
src/main/java/org/asamk/signal/json/JsonTextStyle.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import org.asamk.signal.manager.api.TextStyle;
|
||||
|
||||
public record JsonTextStyle(String style, int start, int length) {
|
||||
|
||||
static JsonTextStyle from(TextStyle textStyle) {
|
||||
return new JsonTextStyle(textStyle.style().name(), textStyle.start(), textStyle.length());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue