DOE for stories

This commit is contained in:
Josh Perez 2022-07-13 19:09:18 -04:00 committed by GitHub
parent d7307934bc
commit 5639c1adea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 381 additions and 15 deletions

View file

@ -1232,8 +1232,9 @@ export default class MessageSender {
isUpdate,
urgent,
options,
storyMessageRecipients,
}: Readonly<{
encodedDataMessage: Uint8Array;
encodedDataMessage?: Uint8Array;
timestamp: number;
destination: string | undefined;
destinationUuid: string | null | undefined;
@ -1243,13 +1244,21 @@ export default class MessageSender {
isUpdate?: boolean;
urgent: boolean;
options?: SendOptionsType;
storyMessageRecipients?: Array<{
destinationUuid: string;
distributionListIds: Array<string>;
isAllowedToReply: boolean;
}>;
}>): Promise<CallbackResultType> {
const myUuid = window.textsecure.storage.user.getCheckedUuid();
const dataMessage = Proto.DataMessage.decode(encodedDataMessage);
const sentMessage = new Proto.SyncMessage.Sent();
sentMessage.timestamp = Long.fromNumber(timestamp);
sentMessage.message = dataMessage;
if (encodedDataMessage) {
const dataMessage = Proto.DataMessage.decode(encodedDataMessage);
sentMessage.message = dataMessage;
}
if (destination) {
sentMessage.destination = destination;
}
@ -1261,6 +1270,19 @@ export default class MessageSender {
expirationStartTimestamp
);
}
if (storyMessageRecipients) {
sentMessage.storyMessageRecipients = storyMessageRecipients.map(
recipient => {
const storyMessageRecipient =
new Proto.SyncMessage.Sent.StoryMessageRecipient();
storyMessageRecipient.destinationUuid = recipient.destinationUuid;
storyMessageRecipient.distributionListIds =
recipient.distributionListIds;
storyMessageRecipient.isAllowedToReply = recipient.isAllowedToReply;
return storyMessageRecipient;
}
);
}
if (isUpdate) {
sentMessage.isRecipientUpdate = true;