Populate dataMessage on CallbackResultType when sending 1:1 messages

This commit is contained in:
Scott Nonnenberg 2022-03-04 17:39:37 -08:00 committed by GitHub
parent 78fd36e880
commit 4be2a33be5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -189,8 +189,16 @@ export default class OutgoingMessage {
numberCompleted(): void {
this.identifiersCompleted += 1;
if (this.identifiersCompleted >= this.identifiers.length) {
const proto = this.message;
const contentProto = this.getContentProtoBytes();
const { timestamp, contentHint, recipients } = this;
let dataMessage: Uint8Array | undefined;
if (proto instanceof Proto.Content && proto.dataMessage) {
dataMessage = Proto.DataMessage.encode(proto.dataMessage).finish();
} else if (proto instanceof Proto.DataMessage) {
dataMessage = Proto.DataMessage.encode(proto).finish();
}
this.callback({
successfulIdentifiers: this.successfulIdentifiers,
@ -199,6 +207,7 @@ export default class OutgoingMessage {
unidentifiedDeliveries: this.unidentifiedDeliveries,
contentHint,
dataMessage,
recipients,
contentProto,
timestamp,