mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
31 lines
1 KiB
Java
31 lines
1 KiB
Java
package org.asamk.signal.json;
|
|
|
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
|
|
|
import java.util.UUID;
|
|
|
|
public record JsonReaction(
|
|
String emoji,
|
|
@Deprecated String targetAuthor,
|
|
String targetAuthorNumber,
|
|
String targetAuthorUuid,
|
|
long targetSentTimestamp,
|
|
boolean isRemove
|
|
) {
|
|
|
|
static JsonReaction from(MessageEnvelope.Data.Reaction reaction) {
|
|
final var emoji = reaction.emoji();
|
|
final var address = reaction.targetAuthor();
|
|
final var targetAuthor = address.getLegacyIdentifier();
|
|
final var targetAuthorNumber = address.number().orElse(null);
|
|
final var targetAuthorUuid = address.uuid().map(UUID::toString).orElse(null);
|
|
final var targetSentTimestamp = reaction.targetSentTimestamp();
|
|
final var isRemove = reaction.isRemove();
|
|
return new JsonReaction(emoji,
|
|
targetAuthor,
|
|
targetAuthorNumber,
|
|
targetAuthorUuid,
|
|
targetSentTimestamp,
|
|
isRemove);
|
|
}
|
|
}
|