From 5535d7fb97da0af2e1bdd776c6ded1030e5392ee Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 16 Feb 2021 14:52:11 +0000 Subject: [PATCH] Prepare to encrypt when a call arrives So we're ready to send an answer straight away if the user answers --- src/CallHandler.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index f106d75f8b..2be1c34a9f 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -681,6 +681,12 @@ export default class CallHandler { Analytics.trackEvent('voip', 'receiveCall', 'type', call.type); this.calls.set(mappedRoomId, call) this.setCallListeners(call); + + // get ready to send encrypted events in the room, so if the user does answer + // the call, we'll be ready to send. NB. This is the protocol-level room ID not + // the mapped one: that's where we'll send the events. + const cli = MatrixClientPeg.get(); + cli.prepareToEncrypt(cli.getRoom(call.roomId)); } break; case 'hangup':