Implement support for ElementCall through Rust side widgets (#1906)

* Implement support for ElementCall through Rust side widgets

* Add Element Call feature flag

* Fix the unit tests

* Address PR comments
This commit is contained in:
Stefan Ceriu
2023-10-17 12:41:56 +03:00
committed by GitHub
parent 524e4b3f1e
commit 6e8dff2ef6
25 changed files with 1059 additions and 18 deletions
+13 -3
View File
@@ -151,6 +151,10 @@ class RoomProxy: RoomProxyProtocol {
room.isTombstoned()
}
var isCallOngoing: Bool {
false
}
var canonicalAlias: String? {
room.canonicalAlias()
}
@@ -252,7 +256,7 @@ class RoomProxy: RoomProxyProtocol {
return .success(())
}
}
func sendMessage(_ message: String, html: String?, inReplyTo eventID: String? = nil) async -> Result<Void, RoomProxyError> {
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
@@ -430,13 +434,13 @@ class RoomProxy: RoomProxyProtocol {
self.room.cancelSend(txnId: transactionID)
}
}
func editMessage(_ message: String, html: String?, original eventID: String) async -> Result<Void, RoomProxyError> {
sendMessageBackgroundTask = await backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
sendMessageBackgroundTask?.stop()
}
let messageContent = buildMessageContentFor(message, html: html)
return await Task.dispatch(on: messageSendingDispatchQueue) {
@@ -705,6 +709,12 @@ class RoomProxy: RoomProxyProtocol {
}
}
}
// MARK: - Element Call
func elementCallWidgetDriver() -> ElementCallWidgetDriverProtocol {
ElementCallWidgetDriver(room: room)
}
// MARK: - Private
@@ -55,6 +55,7 @@ protocol RoomProxyProtocol {
var isSpace: Bool { get }
var isEncrypted: Bool { get }
var isTombstoned: Bool { get }
var isCallOngoing: Bool { get }
var canonicalAlias: String? { get }
var alternativeAliases: [String] { get }
var hasUnreadNotifications: Bool { get }
@@ -176,6 +177,10 @@ protocol RoomProxyProtocol {
func sendPollResponse(pollStartID: String, answers: [String]) async -> Result<Void, RoomProxyError>
func endPoll(pollStartID: String, text: String) async -> Result<Void, RoomProxyError>
// MARK: - Element Call
func elementCallWidgetDriver() -> ElementCallWidgetDriverProtocol
}
extension RoomProxyProtocol {