From 4c1311c11ba5b163db84558bb9886fd6cac522b9 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 27 May 2024 12:56:46 +0300 Subject: [PATCH] Delay seting up a "new" call session until after accepting the incoming call. --- .../Sources/Services/ElementCall/ElementCallService.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ElementX/Sources/Services/ElementCall/ElementCallService.swift b/ElementX/Sources/Services/ElementCall/ElementCallService.swift index 6b38178cb..7a8faa0fb 100644 --- a/ElementX/Sources/Services/ElementCall/ElementCallService.swift +++ b/ElementX/Sources/Services/ElementCall/ElementCallService.swift @@ -141,7 +141,10 @@ class ElementCallService: NSObject, ElementCallServiceProtocol, PKPushRegistryDe func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) { if let incomingCallRoomID { - actionsSubject.send(.answerCall(roomID: incomingCallRoomID)) + Task { + // Dispatch to next run loop so it doesn't conflict with `setupCallSession` + actionsSubject.send(.answerCall(roomID: incomingCallRoomID)) + } self.incomingCallRoomID = nil } else { MXLog.error("Failed answering incoming call, missing room ID")