@mentions receive support

This commit is contained in:
Josh Perez 2020-09-16 18:42:48 -04:00 committed by Josh Perez
parent c126a71864
commit 9657c38987
18 changed files with 555 additions and 23 deletions

View file

@ -30,6 +30,7 @@ import {
StorageServiceCredentials,
} from '../textsecure.d';
import { MessageError, SignedPreKeyRotationError } from './Errors';
import { BodyRangesType } from '../types/Util';
function stringToArrayBuffer(str: string): ArrayBuffer {
if (typeof str !== 'string') {
@ -258,7 +259,7 @@ class Message {
}
if (this.quote) {
const { QuotedAttachment } = window.textsecure.protobuf.DataMessage.Quote;
const { Quote } = window.textsecure.protobuf.DataMessage;
const { BodyRange, Quote } = window.textsecure.protobuf.DataMessage;
proto.quote = new Quote();
const { quote } = proto;
@ -279,6 +280,14 @@ class Message {
return quotedAttachment;
}
);
const bodyRanges: BodyRangesType = this.quote.bodyRanges || [];
quote.bodyRanges = bodyRanges.map(range => {
const bodyRange = new BodyRange();
bodyRange.start = range.start;
bodyRange.length = range.length;
bodyRange.mentionUuid = range.mentionUuid;
return bodyRange;
});
}
if (this.expireTimer) {
proto.expireTimer = this.expireTimer;