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, expireTimer,
preview: uploads.preview, preview: uploads.preview,
quote: uploads.quote, quote: uploads.quote,
lokiProfile: this.getOurProfile(),
}); });
if (this.isMe()) { if (this.isMe()) {

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

Loading…
Cancel
Save