mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user