Send group call events to linked devices

This commit is contained in:
Evan Hahn 2020-12-09 16:02:50 -06:00 committed by GitHub
parent 496bdec35d
commit a142cb522e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 13 deletions

View file

@ -1084,7 +1084,7 @@ export async function initiateMigrationToGroupV2(
}); });
} }
async function wrapWithSyncMessageSend({ export async function wrapWithSyncMessageSend({
conversation, conversation,
logId, logId,
send, send,
@ -1094,7 +1094,7 @@ async function wrapWithSyncMessageSend({
logId: string; logId: string;
send: (sender: MessageSender) => Promise<CallbackResultType | undefined>; send: (sender: MessageSender) => Promise<CallbackResultType | undefined>;
timestamp: number; timestamp: number;
}) { }): Promise<void> {
const sender = window.textsecure.messaging; const sender = window.textsecure.messaging;
if (!sender) { if (!sender) {
throw new Error( throw new Error(

View file

@ -51,7 +51,11 @@ import {
arrayBufferToUuid, arrayBufferToUuid,
} from '../Crypto'; } from '../Crypto';
import { getOwn } from '../util/getOwn'; import { getOwn } from '../util/getOwn';
import { fetchMembershipProof, getMembershipList } from '../groups'; import {
fetchMembershipProof,
getMembershipList,
wrapWithSyncMessageSend,
} from '../groups';
import { missingCaseError } from '../util/missingCaseError'; import { missingCaseError } from '../util/missingCaseError';
import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp'; import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp';
@ -706,10 +710,16 @@ export class CallingClass {
return; return;
} }
const timestamp = Date.now();
// We "fire and forget" because sending this message is non-essential. // We "fire and forget" because sending this message is non-essential.
window.textsecure.messaging wrapWithSyncMessageSend({
.sendGroupCallUpdate({ eraId, groupV2 }, sendOptions) conversation,
.catch(err => { logId: `sendGroupCallUpdateMessage/${conversationId}-${eraId}`,
send: sender =>
sender.sendGroupCallUpdate({ eraId, groupV2, timestamp }, sendOptions),
timestamp,
}).catch(err => {
window.log.error('Failed to send group call update', err); window.log.error('Failed to send group call update', err);
}); });
} }

View file

@ -1143,15 +1143,19 @@ export default class MessageSender {
); );
} }
async sendGroupCallUpdate( sendGroupCallUpdate(
{ groupV2, eraId }: { groupV2: GroupV2InfoType; eraId: string }, {
groupV2,
eraId,
timestamp,
}: { groupV2: GroupV2InfoType; eraId: string; timestamp: number },
options?: SendOptionsType options?: SendOptionsType
): Promise<void> { ): Promise<CallbackResultType> {
await this.sendMessageToGroup( return this.sendMessageToGroup(
{ {
groupV2, groupV2,
groupCallUpdate: { eraId }, groupCallUpdate: { eraId },
timestamp: Date.now(), timestamp,
}, },
options options
); );