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
@@ -2987,6 +2987,76 @@ class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
return knockRoomAliasMessageReturnValue
}
}
//MARK: - canJoinRoom
var canJoinRoomWithUnderlyingCallsCount = 0
var canJoinRoomWithCallsCount: Int {
get {
if Thread.isMainThread {
return canJoinRoomWithUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = canJoinRoomWithUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
canJoinRoomWithUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
canJoinRoomWithUnderlyingCallsCount = newValue
}
}
}
}
var canJoinRoomWithCalled: Bool {
return canJoinRoomWithCallsCount > 0
}
var canJoinRoomWithReceivedRules: [AllowRule]?
var canJoinRoomWithReceivedInvocations: [[AllowRule]] = []
var canJoinRoomWithUnderlyingReturnValue: Bool!
var canJoinRoomWithReturnValue: Bool! {
get {
if Thread.isMainThread {
return canJoinRoomWithUnderlyingReturnValue
} else {
var returnValue: Bool? = nil
DispatchQueue.main.sync {
returnValue = canJoinRoomWithUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
canJoinRoomWithUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
canJoinRoomWithUnderlyingReturnValue = newValue
}
}
}
}
var canJoinRoomWithClosure: (([AllowRule]) -> Bool)?
func canJoinRoom(with rules: [AllowRule]) -> Bool {
canJoinRoomWithCallsCount += 1
canJoinRoomWithReceivedRules = rules
DispatchQueue.main.async {
self.canJoinRoomWithReceivedInvocations.append(rules)
}
if let canJoinRoomWithClosure = canJoinRoomWithClosure {
return canJoinRoomWithClosure(rules)
} else {
return canJoinRoomWithReturnValue
}
}
//MARK: - uploadMedia
var uploadMediaUnderlyingCallsCount = 0