|
|
@ -2,6 +2,7 @@ import { DataMessage } from './DataMessage';
|
|
|
|
import { SignalService } from '../../../../../protobuf';
|
|
|
|
import { SignalService } from '../../../../../protobuf';
|
|
|
|
import { MessageParams } from '../../Message';
|
|
|
|
import { MessageParams } from '../../Message';
|
|
|
|
import { LokiProfile } from '../../../../../types/Message';
|
|
|
|
import { LokiProfile } from '../../../../../types/Message';
|
|
|
|
|
|
|
|
import ByteBuffer from 'bytebuffer';
|
|
|
|
|
|
|
|
|
|
|
|
export interface AttachmentPointer {
|
|
|
|
export interface AttachmentPointer {
|
|
|
|
id?: number;
|
|
|
|
id?: number;
|
|
|
@ -62,7 +63,12 @@ export class ChatMessage extends DataMessage {
|
|
|
|
this.body = params.body;
|
|
|
|
this.body = params.body;
|
|
|
|
this.quote = params.quote;
|
|
|
|
this.quote = params.quote;
|
|
|
|
this.expireTimer = params.expireTimer;
|
|
|
|
this.expireTimer = params.expireTimer;
|
|
|
|
this.profileKey = params.lokiProfile && params.lokiProfile.profileKey;
|
|
|
|
if (params.lokiProfile && params.lokiProfile.profileKey) {
|
|
|
|
|
|
|
|
this.profileKey = new Uint8Array(
|
|
|
|
|
|
|
|
ByteBuffer.wrap(params.lokiProfile.profileKey).toArrayBuffer()
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.displayName = params.lokiProfile && params.lokiProfile.displayName;
|
|
|
|
this.displayName = params.lokiProfile && params.lokiProfile.displayName;
|
|
|
|
this.avatarPointer = params.lokiProfile && params.lokiProfile.avatarPointer;
|
|
|
|
this.avatarPointer = params.lokiProfile && params.lokiProfile.avatarPointer;
|
|
|
|
this.preview = params.preview;
|
|
|
|
this.preview = params.preview;
|
|
|
@ -85,10 +91,6 @@ export class ChatMessage extends DataMessage {
|
|
|
|
dataMessage.expireTimer = this.expireTimer;
|
|
|
|
dataMessage.expireTimer = this.expireTimer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.profileKey) {
|
|
|
|
|
|
|
|
dataMessage.profileKey = this.profileKey;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.preview) {
|
|
|
|
if (this.preview) {
|
|
|
|
dataMessage.preview = this.preview;
|
|
|
|
dataMessage.preview = this.preview;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -107,9 +109,6 @@ export class ChatMessage extends DataMessage {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.profileKey) {
|
|
|
|
if (this.profileKey) {
|
|
|
|
dataMessage.profileKey = this.profileKey;
|
|
|
|
dataMessage.profileKey = this.profileKey;
|
|
|
|
dataMessage.flags =
|
|
|
|
|
|
|
|
// tslint:disable-next-line: no-bitwise
|
|
|
|
|
|
|
|
dataMessage.flags | SignalService.DataMessage.Flags.PROFILE_KEY_UPDATE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.quote) {
|
|
|
|
if (this.quote) {
|
|
|
|