mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-07 04:48:34 +00:00
Fixes #3134 - Fix answering call not opening app
- we're currently working around the widget not properly aquiring media streams by manually terminating a call before starting the web view - it seems that there's a race condition between that and the system opening the app - as such we need to delay terminating the call until the system gets a chance to handle the redirect
This commit is contained in:
committed by
Stefan Ceriu
parent
398442ff12
commit
9b9f45ea0c
@@ -192,7 +192,11 @@ class ElementCallService: NSObject, ElementCallServiceProtocol, PKPushRegistryDe
|
||||
}
|
||||
|
||||
func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
|
||||
if let incomingCallID {
|
||||
guard let incomingCallID else {
|
||||
MXLog.error("Failed answering incoming call, missing incomingCallID")
|
||||
return
|
||||
}
|
||||
|
||||
// Fixes broken videos on EC web when a CallKit session is established.
|
||||
//
|
||||
// Reporting an ongoing call through `reportNewIncomingCall` + `CXAnswerCallAction`
|
||||
@@ -205,15 +209,19 @@ class ElementCallService: NSObject, ElementCallServiceProtocol, PKPushRegistryDe
|
||||
// https://github.com/element-hq/element-x-ios/issues/3041
|
||||
// https://forums.developer.apple.com/forums/thread/685268
|
||||
// https://stackoverflow.com/questions/71483732/webrtc-running-from-wkwebview-avaudiosession-development-roadblock
|
||||
provider.reportCall(with: incomingCallID.callKitID, endedAt: nil, reason: .answeredElsewhere)
|
||||
|
||||
actionsSubject.send(.startCall(roomID: incomingCallID.roomID))
|
||||
endUnansweredCallTask?.cancel()
|
||||
} else {
|
||||
MXLog.error("Failed answering incoming call, missing incomingCallID")
|
||||
}
|
||||
|
||||
// First fullfill the action
|
||||
action.fulfill()
|
||||
|
||||
// And delay ending the call so that the app has enough time
|
||||
// to get deeplinked into
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||
// Then end the and call rely on `setupCallSession` to create a new one
|
||||
provider.reportCall(with: incomingCallID.callKitID, endedAt: nil, reason: .remoteEnded)
|
||||
|
||||
self.actionsSubject.send(.startCall(roomID: incomingCallID.roomID))
|
||||
self.endUnansweredCallTask?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
|
||||
|
||||
Reference in New Issue
Block a user