Implement receive handling for story messages

This commit is contained in:
AsamK 2022-08-08 18:12:30 +02:00
parent 81e36d4f9b
commit a593051512
12 changed files with 443 additions and 47 deletions

View file

@ -20,13 +20,17 @@ 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) JsonGroupInfo groupInfo
@JsonInclude(JsonInclude.Include.NON_NULL) JsonGroupInfo groupInfo,
@JsonInclude(JsonInclude.Include.NON_NULL) JsonStoryContext storyContext
) {
static JsonDataMessage from(MessageEnvelope.Data dataMessage) {
final var timestamp = dataMessage.timestamp();
final var groupInfo = dataMessage.groupContext().isPresent() ? JsonGroupInfo.from(dataMessage.groupContext()
.get()) : null;
final var storyContext = dataMessage.storyContext().isPresent()
? JsonStoryContext.from(dataMessage.storyContext().get())
: null;
final var message = dataMessage.body().orElse(null);
final var expiresInSeconds = dataMessage.expiresInSeconds();
final var viewOnce = dataMessage.isViewOnce();
@ -67,6 +71,7 @@ record JsonDataMessage(
sticker,
remoteDelete,
contacts,
groupInfo);
groupInfo,
storyContext);
}
}