handle the case where a non parent joined space is already available in the existing restricted join rule

This commit is contained in:
Mauro Romito
2025-12-11 16:53:13 +01:00
committed by Mauro
parent 00b2895e25
commit 55e88245f5
13 changed files with 266 additions and 42 deletions
@@ -16568,6 +16568,76 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
return spaceRoomListSpaceIDReturnValue
}
}
//MARK: - spaceForIdentifier
var spaceForIdentifierSpaceIDUnderlyingCallsCount = 0
var spaceForIdentifierSpaceIDCallsCount: Int {
get {
if Thread.isMainThread {
return spaceForIdentifierSpaceIDUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = spaceForIdentifierSpaceIDUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
spaceForIdentifierSpaceIDUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
spaceForIdentifierSpaceIDUnderlyingCallsCount = newValue
}
}
}
}
var spaceForIdentifierSpaceIDCalled: Bool {
return spaceForIdentifierSpaceIDCallsCount > 0
}
var spaceForIdentifierSpaceIDReceivedSpaceID: String?
var spaceForIdentifierSpaceIDReceivedInvocations: [String] = []
var spaceForIdentifierSpaceIDUnderlyingReturnValue: Result<SpaceRoomProxyProtocol?, SpaceServiceProxyError>!
var spaceForIdentifierSpaceIDReturnValue: Result<SpaceRoomProxyProtocol?, SpaceServiceProxyError>! {
get {
if Thread.isMainThread {
return spaceForIdentifierSpaceIDUnderlyingReturnValue
} else {
var returnValue: Result<SpaceRoomProxyProtocol?, SpaceServiceProxyError>? = nil
DispatchQueue.main.sync {
returnValue = spaceForIdentifierSpaceIDUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
spaceForIdentifierSpaceIDUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
spaceForIdentifierSpaceIDUnderlyingReturnValue = newValue
}
}
}
}
var spaceForIdentifierSpaceIDClosure: ((String) async -> Result<SpaceRoomProxyProtocol?, SpaceServiceProxyError>)?
func spaceForIdentifier(spaceID: String) async -> Result<SpaceRoomProxyProtocol?, SpaceServiceProxyError> {
spaceForIdentifierSpaceIDCallsCount += 1
spaceForIdentifierSpaceIDReceivedSpaceID = spaceID
DispatchQueue.main.async {
self.spaceForIdentifierSpaceIDReceivedInvocations.append(spaceID)
}
if let spaceForIdentifierSpaceIDClosure = spaceForIdentifierSpaceIDClosure {
return await spaceForIdentifierSpaceIDClosure(spaceID)
} else {
return spaceForIdentifierSpaceIDReturnValue
}
}
//MARK: - leaveSpace
var leaveSpaceSpaceIDUnderlyingCallsCount = 0
@@ -23265,6 +23265,81 @@ open class SpaceServiceSDKMock: MatrixRustSDK.SpaceService, @unchecked Sendable
}
}
//MARK: - getSpaceRoom
open var getSpaceRoomRoomIdThrowableError: Error?
var getSpaceRoomRoomIdUnderlyingCallsCount = 0
open var getSpaceRoomRoomIdCallsCount: Int {
get {
if Thread.isMainThread {
return getSpaceRoomRoomIdUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = getSpaceRoomRoomIdUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
getSpaceRoomRoomIdUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
getSpaceRoomRoomIdUnderlyingCallsCount = newValue
}
}
}
}
open var getSpaceRoomRoomIdCalled: Bool {
return getSpaceRoomRoomIdCallsCount > 0
}
open var getSpaceRoomRoomIdReceivedRoomId: String?
open var getSpaceRoomRoomIdReceivedInvocations: [String] = []
var getSpaceRoomRoomIdUnderlyingReturnValue: SpaceRoom?
open var getSpaceRoomRoomIdReturnValue: SpaceRoom? {
get {
if Thread.isMainThread {
return getSpaceRoomRoomIdUnderlyingReturnValue
} else {
var returnValue: SpaceRoom?? = nil
DispatchQueue.main.sync {
returnValue = getSpaceRoomRoomIdUnderlyingReturnValue
}
return returnValue!
}
}
set {
if Thread.isMainThread {
getSpaceRoomRoomIdUnderlyingReturnValue = newValue
} else {
DispatchQueue.main.sync {
getSpaceRoomRoomIdUnderlyingReturnValue = newValue
}
}
}
}
open var getSpaceRoomRoomIdClosure: ((String) async throws -> SpaceRoom?)?
open override func getSpaceRoom(roomId: String) async throws -> SpaceRoom? {
if let error = getSpaceRoomRoomIdThrowableError {
throw error
}
getSpaceRoomRoomIdCallsCount += 1
getSpaceRoomRoomIdReceivedRoomId = roomId
DispatchQueue.main.async {
self.getSpaceRoomRoomIdReceivedInvocations.append(roomId)
}
if let getSpaceRoomRoomIdClosure = getSpaceRoomRoomIdClosure {
return try await getSpaceRoomRoomIdClosure(roomId)
} else {
return getSpaceRoomRoomIdReturnValue
}
}
//MARK: - joinedParentsOfChild
open var joinedParentsOfChildChildIdThrowableError: Error?