Fixes #2840 - Use both the room list room and the room preview details to populate the join room screen

- the room summary API is indeed enabled on matrix.org and working fine for most rooms
- it is not however capable of giving us data about non-joined + private rooms
- the SDK addresses that by first trying to use known rooms before resorting to the preview endpoint
- that fails if it's a brand new room that the client doesn't know about yet i.e. a sync hasn't ran, which is exactly what's happening here
- the ClientProxy instead does wait for the room list to go into the first loaded before returning the room
This commit is contained in:
Stefan Ceriu
2024-07-18 16:49:04 +03:00
committed by Stefan Ceriu
parent 86ce3def13
commit f1de42a1f3
4 changed files with 49 additions and 13 deletions
@@ -29,11 +29,19 @@ enum JoinRoomScreenInteractionMode {
case knock
}
struct JoinRoomScreenRoomDetails {
let name: String?
let topic: String?
let canonicalAlias: String?
let avatar: RoomAvatar
let memberCount: UInt
}
struct JoinRoomScreenViewState: BindableState {
// Maybe use room summary details or similar here??
let roomID: String
var roomDetails: RoomPreviewDetails?
var roomDetails: JoinRoomScreenRoomDetails?
var mode: JoinRoomScreenInteractionMode = .loading
@@ -52,7 +60,7 @@ struct JoinRoomScreenViewState: BindableState {
}
var avatar: RoomAvatar {
.room(id: roomID, name: title, avatarURL: roomDetails?.avatarURL)
roomDetails?.avatar ?? .room(id: roomID, name: title, avatarURL: nil)
}
}