finish adding mediumGroupUpdates

pull/1197/head
Audric Ackermann 5 years ago
parent 23d22622ca
commit 9941c12586
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1621,22 +1621,16 @@
});
if (Whisper.Import.isComplete()) {
// FIXME Audric; Is that needed for us?
// const {
// wrap,
// sendOptions,
// } = ConversationController.prepareForSend(
// textsecure.storage.user.getNumber(),
// { syncMessage: true }
// );
// wrap(
// textsecure.messaging.sendRequestConfigurationSyncMessage(sendOptions)
// ).catch(error => {
// window.log.error(
// 'Import complete, but failed to send sync message',
// error && error.stack ? error.stack : error
// );
// });
const { CONFIGURATION } = textsecure.protobuf.SyncMessage.Request.Type;
const { RequestSyncMessage } = window.libsession.Messages.Outgoing;
const requestConfigurationSyncMessage = new RequestSyncMessage({
timestamp: Date.now(),
reqestType: CONFIGURATION,
});
await libsession
.getMessageQueue()
.sendSyncMessage(requestConfigurationSyncMessage);
}
}

@ -1375,15 +1375,22 @@
}
if (conversationType === Message.GROUP) {
// let dest = destination;
// let numbers = groupNumbers;
if (this.isMediumGroup()) {
// FIXME audric to implement back
// dest = this.id;
// numbers = [destination];
// options.isMediumGroup = true;
throw new Error('To implement back');
const mediumGroupChatMessage = new libsession.Messages.Outgoing.MediumGroupChatMessage(
{
chatMessage,
groupId: destination,
}
);
const members = this.get('members');
await Promise.all(
members.map(async m => {
const memberPubKey = new libsession.Types.PubKey(m);
await libsession
.getMessageQueue()
.sendUsingMultiDevice(memberPubKey, mediumGroupChatMessage);
})
);
} else {
const closedGroupChatMessage = new libsession.Messages.Outgoing.ClosedGroupChatMessage(
{

@ -1,4 +1,4 @@
/* global textsecure, WebAPI, libsignal, window, OutgoingMessage, libloki, _, libsession */
/* global textsecure, WebAPI, libsignal, window, libloki, _, libsession */
/* eslint-disable more/no-then, no-bitwise */
@ -351,7 +351,6 @@ MessageSender.prototype = {
});
},
uploadAvatar(attachment) {
// isRaw is true since the data is already encrypted
// and doesn't need to be encrypted again

@ -0,0 +1,30 @@
import { SignalService } from '../../../../../../protobuf';
import { ChatMessage } from '../ChatMessage';
import { PubKey } from '../../../../../types';
import { MediumGroupMessage } from './MediumGroupMessage';
interface MediumGroupChatMessageParams {
identifier?: string;
groupId: string | PubKey;
chatMessage: ChatMessage;
}
export class MediumGroupChatMessage extends MediumGroupMessage {
private readonly chatMessage: ChatMessage;
constructor(params: MediumGroupChatMessageParams) {
super({
timestamp: params.chatMessage.timestamp,
identifier: params.identifier ?? params.chatMessage.identifier,
groupId: params.groupId,
});
this.chatMessage = params.chatMessage;
}
protected dataProto(): SignalService.DataMessage {
const messageProto = this.chatMessage.dataProto();
messageProto.mediumGroupUpdate = super.dataProto().mediumGroupUpdate;
return messageProto;
}
}

@ -2,3 +2,4 @@ export * from './MediumGroupMessage';
export * from './MediumGroupRequestKeysMessage';
export * from './MediumGroupResponseKeysMessage';
export * from './MediumGroupCreateMessage';
export * from './MediumGroupChatMessage';

Loading…
Cancel
Save