Fixes #2878 - Retain cycles on the ElementCall webView and correctly tear down the call on dismissal.

This commit is contained in:
Stefan Ceriu
2024-05-24 13:09:52 +03:00
committed by Stefan Ceriu
parent 8bfd802793
commit f8d094516d
11 changed files with 77 additions and 21 deletions
@@ -41,6 +41,7 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
private let room: RoomProtocol
private var widgetDriver: WidgetDriverAndHandle?
let widgetID = UUID().uuidString
let messagePublisher = PassthroughSubject<String, Never>()
private let actionsSubject: PassthroughSubject<ElementCallWidgetDriverAction, Never> = .init()
@@ -60,7 +61,7 @@ class ElementCallWidgetDriver: WidgetCapabilitiesProvider, ElementCallWidgetDriv
let useEncryption = (try? room.isEncrypted()) ?? false
guard let widgetSettings = try? newVirtualElementCallWidget(props: .init(elementCallUrl: baseURL.absoluteString,
widgetId: UUID().uuidString,
widgetId: widgetID,
parentUrl: nil,
hideHeader: nil,
preload: nil,
@@ -32,6 +32,8 @@ enum ElementCallWidgetDriverAction {
// sourcery: AutoMockable
protocol ElementCallWidgetDriverProtocol {
var widgetID: String { get }
var messagePublisher: PassthroughSubject<String, Never> { get }
var actions: AnyPublisher<ElementCallWidgetDriverAction, Never> { get }