Send group call events to linked devices
This commit is contained in:
parent
496bdec35d
commit
a142cb522e
3 changed files with 27 additions and 13 deletions
|
@ -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(
|
||||||
|
|
|
@ -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,12 +710,18 @@ 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}`,
|
||||||
window.log.error('Failed to send group call update', err);
|
send: sender =>
|
||||||
});
|
sender.sendGroupCallUpdate({ eraId, groupV2, timestamp }, sendOptions),
|
||||||
|
timestamp,
|
||||||
|
}).catch(err => {
|
||||||
|
window.log.error('Failed to send group call update', err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async accept(conversationId: string, asVideoCall: boolean): Promise<void> {
|
async accept(conversationId: string, asVideoCall: boolean): Promise<void> {
|
||||||
|
|
|
@ -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
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue