Add support for joining rooms from a space. (#4501)

* Add support for joining rooms from a space.

Doesn't yet handle the Join button 🤔

* Handle the join button for both rooms and spaces.

Also refactor more instances of spaceRoom to spaceRoomProxy.
This commit is contained in:
Doug
2025-09-11 16:41:19 +01:00
committed by GitHub
parent 880f2060f4
commit c2ac60f1e6
30 changed files with 304 additions and 34 deletions
@@ -542,6 +542,17 @@ class ClientProxy: ClientProxyProtocol {
}
}
func canJoinRoom(with rules: [AllowRule]) -> Bool {
for rule in rules {
if case let .roomMembership(roomID) = rule,
let room = try? client.getRoom(roomId: roomID),
room.membership() == .joined {
return true
}
}
return false
}
func uploadMedia(_ media: MediaInfo) async -> Result<String, ClientProxyError> {
guard let mimeType = media.mimeType else {
MXLog.error("Failed uploading media, invalid mime type: \(media)")
@@ -165,6 +165,8 @@ protocol ClientProxyProtocol: AnyObject {
func knockRoomAlias(_ roomAlias: String, message: String?) async -> Result<Void, ClientProxyError>
func canJoinRoom(with rules: [AllowRule]) -> Bool
func uploadMedia(_ media: MediaInfo) async -> Result<String, ClientProxyError>
func roomForIdentifier(_ identifier: String) async -> RoomProxyType?