fix profileKey sharing and avatar

pull/1205/head
Audric Ackermann 5 years ago
parent f3ae798b12
commit 0474e84b19
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1315,6 +1315,7 @@
expireTimer,
preview: uploads.preview,
quote: uploads.quote,
lokiProfile: this.getOurProfile(),
});
if (this.isMe()) {

@ -1094,6 +1094,7 @@
attachments,
preview,
quote,
lokiProfile: this.getOurProfile(),
});
// Special-case the self-send case - we send only a sync message

@ -2,6 +2,7 @@ import { DataMessage } from './DataMessage';
import { SignalService } from '../../../../../protobuf';
import { MessageParams } from '../../Message';
import { LokiProfile } from '../../../../../types/Message';
import ByteBuffer from 'bytebuffer';
export interface AttachmentPointer {
id?: number;
@ -62,7 +63,12 @@ export class ChatMessage extends DataMessage {
this.body = params.body;
this.quote = params.quote;
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.avatarPointer = params.lokiProfile && params.lokiProfile.avatarPointer;
this.preview = params.preview;
@ -85,10 +91,6 @@ export class ChatMessage extends DataMessage {
dataMessage.expireTimer = this.expireTimer;
}
if (this.profileKey) {
dataMessage.profileKey = this.profileKey;
}
if (this.preview) {
dataMessage.preview = this.preview;
}
@ -107,9 +109,6 @@ export class ChatMessage extends DataMessage {
}
if (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) {

Loading…
Cancel
Save