mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
add JsonPayment (#808)
This commit is contained in:
parent
d13d150fe1
commit
5cd5697aea
5 changed files with 59 additions and 0 deletions
|
@ -680,6 +680,7 @@ public class DbusManagerImpl implements Manager {
|
|||
false,
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
getAttachments(extras),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
|
@ -749,6 +750,7 @@ public class DbusManagerImpl implements Manager {
|
|||
false,
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
getAttachments(extras),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
|
|
|
@ -15,6 +15,7 @@ record JsonDataMessage(
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL) Boolean viewOnce,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonReaction reaction,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonQuote quote,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonPayment payment,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonMention> mentions,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) List<JsonAttachment> attachments,
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSticker sticker,
|
||||
|
@ -32,6 +33,7 @@ record JsonDataMessage(
|
|||
final var viewOnce = dataMessage.isViewOnce();
|
||||
final var reaction = dataMessage.reaction().map(JsonReaction::from).orElse(null);
|
||||
final var quote = dataMessage.quote().isPresent() ? JsonQuote.from(dataMessage.quote().get()) : null;
|
||||
final var payment = dataMessage.payment().isPresent() ? JsonPayment.from(dataMessage.payment().get()) : null;
|
||||
final var mentions = dataMessage.mentions().size() > 0 ? dataMessage.mentions()
|
||||
.stream()
|
||||
.map(JsonMention::from)
|
||||
|
@ -55,6 +57,7 @@ record JsonDataMessage(
|
|||
viewOnce,
|
||||
reaction,
|
||||
quote,
|
||||
payment,
|
||||
mentions,
|
||||
attachments,
|
||||
sticker,
|
||||
|
@ -72,6 +75,7 @@ record JsonDataMessage(
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messageReceived.getAttachments().stream().map(JsonAttachment::from).collect(Collectors.toList()),
|
||||
null,
|
||||
null,
|
||||
|
@ -88,6 +92,7 @@ record JsonDataMessage(
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
messageReceived.getAttachments().stream().map(JsonAttachment::from).collect(Collectors.toList()),
|
||||
null,
|
||||
null,
|
||||
|
|
9
src/main/java/org/asamk/signal/json/JsonPayment.java
Normal file
9
src/main/java/org/asamk/signal/json/JsonPayment.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
|
||||
public record JsonPayment(String note, byte[] receipt) {
|
||||
static JsonPayment from(MessageEnvelope.Data.Payment payment) {
|
||||
return new JsonPayment(payment.note(), payment.receipt());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue