Implement replying to stories

This commit is contained in:
AsamK 2022-10-30 18:18:21 +01:00
parent fea19c9e20
commit 5ed9db4f08
8 changed files with 54 additions and 6 deletions

View file

@ -624,6 +624,14 @@ class ManagerImpl implements Manager {
}
messageBuilder.withPreviews(previews);
}
if (message.storyReply().isPresent()) {
final var storyReply = message.storyReply().get();
final var authorServiceId = context.getRecipientHelper()
.resolveSignalServiceAddress(context.getRecipientHelper().resolveRecipient(storyReply.author()))
.getServiceId();
messageBuilder.withStoryContext(new SignalServiceDataMessage.StoryContext(authorServiceId,
storyReply.timestamp()));
}
}
private ArrayList<SignalServiceDataMessage.Mention> resolveMentions(final List<Message.Mention> mentionList) throws UnregisteredRecipientException {

View file

@ -9,7 +9,8 @@ public record Message(
List<Mention> mentions,
Optional<Quote> quote,
Optional<Sticker> sticker,
List<Preview> previews
List<Preview> previews,
Optional<StoryReply> storyReply
) {
public record Mention(RecipientIdentifier.Single recipient, int start, int length) {}
@ -19,4 +20,6 @@ public record Message(
public record Sticker(byte[] packId, int stickerId) {}
public record Preview(String url, String title, String description, Optional<String> image) {}
public record StoryReply(long timestamp, RecipientIdentifier.Single author) {}
}