Replace the old RoomInfoUpdateListener with the SDKListener
This commit is contained in:
committed by
Stefan Ceriu
parent
8d1fab245b
commit
16f16b488f
@@ -170,18 +170,19 @@ class NotificationHandler {
|
||||
// Check to see if a call is still ongoing
|
||||
if let room = userSession.roomForIdentifier(roomID) { // Try to get call details from the room info
|
||||
if !room.hasActiveRoomCall() { // If I don't have an active call wait a bit and make sure
|
||||
let runner = ExpiringTaskRunner {
|
||||
let expiringTask = ExpiringTaskRunner {
|
||||
await withCheckedContinuation { [weak self] continuation in
|
||||
self?.roomInfoObservationToken = room.subscribeToRoomInfoUpdates(listener: RoomInfoUpdateListener { _ in
|
||||
self?.roomInfoObservationToken = room.subscribeToRoomInfoUpdates(listener: SDKListener { _ in
|
||||
MXLog.info("Received room info update")
|
||||
continuation.resume()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
try? await runner.run(timeout: .seconds(5)) // Wait 5 seconds or just use whatever is available
|
||||
try? await expiringTask.run(timeout: .seconds(5)) // Wait 5 seconds or just use whatever is available
|
||||
|
||||
guard room.hasActiveRoomCall() else {
|
||||
MXLog.info("The room no longer has an ongoing call, handling as push notification")
|
||||
return .shouldDisplay
|
||||
}
|
||||
}
|
||||
@@ -214,15 +215,3 @@ class NotificationHandler {
|
||||
case unsupportedShouldDiscard
|
||||
}
|
||||
}
|
||||
|
||||
private final class RoomInfoUpdateListener: RoomInfoListener {
|
||||
private let onUpdateClosure: (RoomInfo) -> Void
|
||||
|
||||
init(_ onUpdateClosure: @escaping (RoomInfo) -> Void) {
|
||||
self.onUpdateClosure = onUpdateClosure
|
||||
}
|
||||
|
||||
func call(roomInfo: RoomInfo) {
|
||||
onUpdateClosure(roomInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ targets:
|
||||
- path: ../../ElementX/Sources/Other/NetworkMonitor
|
||||
- path: ../../ElementX/Sources/Other/Pills/PillUtilities.swift
|
||||
- path: ../../ElementX/Sources/Other/Pills/PlainMentionBuilder.swift
|
||||
- path: ../../ElementX/Sources/Other/SDKListener.swift
|
||||
- path: ../../ElementX/Sources/Other/SwiftUI/Views/PlaceholderAvatarImage.swift
|
||||
- path: ../../ElementX/Sources/Other/TestablePreview.swift
|
||||
- path: ../../ElementX/Sources/Other/UserAgentBuilder.swift
|
||||
|
||||
Reference in New Issue
Block a user