mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user