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

@ -1375,15 +1375,22 @@
} }
if (conversationType === Message.GROUP) { if (conversationType === Message.GROUP) {
// let dest = destination;
// let numbers = groupNumbers;
if (this.isMediumGroup()) { if (this.isMediumGroup()) {
// FIXME audric to implement back const mediumGroupChatMessage = new libsession.Messages.Outgoing.MediumGroupChatMessage(
{
// dest = this.id; chatMessage,
// numbers = [destination]; groupId: destination,
// options.isMediumGroup = true; }
throw new Error('To implement back'); );
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 { } else {
const closedGroupChatMessage = new libsession.Messages.Outgoing.ClosedGroupChatMessage( 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 */ /* eslint-disable more/no-then, no-bitwise */
@ -351,7 +351,6 @@ MessageSender.prototype = {
}); });
}, },
uploadAvatar(attachment) { uploadAvatar(attachment) {
// isRaw is true since the data is already encrypted // isRaw is true since the data is already encrypted
// and doesn't need to be encrypted again // 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 './MediumGroupRequestKeysMessage';
export * from './MediumGroupResponseKeysMessage'; export * from './MediumGroupResponseKeysMessage';
export * from './MediumGroupCreateMessage'; export * from './MediumGroupCreateMessage';
export * from './MediumGroupChatMessage';

Loading…
Cancel
Save