Fix Rooms that user has knocked not displaying the request sent screen (#3513)

* fix knocked state

* pr suggestion

* code improvement
This commit is contained in:
Mauro
2024-11-14 13:43:40 +01:00
committed by GitHub
parent 9746da78a2
commit 2cb7faca88
7 changed files with 79 additions and 44 deletions
@@ -11,26 +11,27 @@ import UIKit
class KnockedRoomProxy: KnockedRoomProxyProtocol {
private let roomListItem: RoomListItemProtocol
private let room: RoomProtocol
private let roomPreview: RoomPreviewProtocol
let info: BaseRoomInfoProxyProtocol
// A room identifier is constant and lazy stops it from being fetched
// multiple times over FFI
lazy var id: String = room.id()
lazy var id = info.id
var ownUserID: String { room.ownUserId() }
let info: RoomInfoProxy
let ownUserID: String
init(roomListItem: RoomListItemProtocol,
room: RoomProtocol) async throws {
roomPreview: RoomPreviewProtocol,
ownUserID: String) async throws {
self.roomListItem = roomListItem
self.room = room
info = try await RoomInfoProxy(roomInfo: room.roomInfo())
self.roomPreview = roomPreview
self.ownUserID = ownUserID
info = try RoomPreviewInfoProxy(roomPreviewInfo: roomPreview.info())
}
func cancelKnock() async -> Result<Void, RoomProxyError> {
do {
return try await .success(room.leave())
return try await .success(roomPreview.leave())
} catch {
MXLog.error("Failed cancelling the knock with error: \(error)")
return .failure(.sdkError(error))