From 0438f35539c9713b7f1da35d28b7b26e5afed4c0 Mon Sep 17 00:00:00 2001 From: Arturs Krumins Date: Wed, 21 Aug 2024 17:05:59 +0300 Subject: [PATCH] ios: fix notifying the recipient when hanging up a call in ios15 (#4731) Co-authored-by: Evgeny Poberezkin --- apps/ios/Shared/Views/Call/WebRTCClient.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/ios/Shared/Views/Call/WebRTCClient.swift b/apps/ios/Shared/Views/Call/WebRTCClient.swift index 0b4917c103..79e0dea16c 100644 --- a/apps/ios/Shared/Views/Call/WebRTCClient.swift +++ b/apps/ios/Shared/Views/Call/WebRTCClient.swift @@ -411,6 +411,15 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg } func endCall() { + if #available(iOS 16.0, *) { + _endCall() + } else { + // Fixes `connection.close()` getting locked up in iOS15 + DispatchQueue.global(qos: .utility).async { self._endCall() } + } + } + + private func _endCall() { guard let call = activeCall.wrappedValue else { return } logger.debug("WebRTCClient: ending the call") activeCall.wrappedValue = nil