mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
single space access implementation
also added the copies for the single and multiple spaces selection
This commit is contained in:
@@ -16616,6 +16616,76 @@ class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
return leaveSpaceSpaceIDReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - joinedParents
|
||||
|
||||
var joinedParentsRoomIDUnderlyingCallsCount = 0
|
||||
var joinedParentsRoomIDCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return joinedParentsRoomIDUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = joinedParentsRoomIDUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
joinedParentsRoomIDUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
joinedParentsRoomIDUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var joinedParentsRoomIDCalled: Bool {
|
||||
return joinedParentsRoomIDCallsCount > 0
|
||||
}
|
||||
var joinedParentsRoomIDReceivedRoomID: String?
|
||||
var joinedParentsRoomIDReceivedInvocations: [String] = []
|
||||
|
||||
var joinedParentsRoomIDUnderlyingReturnValue: Result<[SpaceRoomProxyProtocol], SpaceServiceProxyError>!
|
||||
var joinedParentsRoomIDReturnValue: Result<[SpaceRoomProxyProtocol], SpaceServiceProxyError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return joinedParentsRoomIDUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<[SpaceRoomProxyProtocol], SpaceServiceProxyError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = joinedParentsRoomIDUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
joinedParentsRoomIDUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
joinedParentsRoomIDUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var joinedParentsRoomIDClosure: ((String) async -> Result<[SpaceRoomProxyProtocol], SpaceServiceProxyError>)?
|
||||
|
||||
func joinedParents(roomID: String) async -> Result<[SpaceRoomProxyProtocol], SpaceServiceProxyError> {
|
||||
joinedParentsRoomIDCallsCount += 1
|
||||
joinedParentsRoomIDReceivedRoomID = roomID
|
||||
DispatchQueue.main.async {
|
||||
self.joinedParentsRoomIDReceivedInvocations.append(roomID)
|
||||
}
|
||||
if let joinedParentsRoomIDClosure = joinedParentsRoomIDClosure {
|
||||
return await joinedParentsRoomIDClosure(roomID)
|
||||
} else {
|
||||
return joinedParentsRoomIDReturnValue
|
||||
}
|
||||
}
|
||||
}
|
||||
class StaticRoomSummaryProviderMock: StaticRoomSummaryProviderProtocol, @unchecked Sendable {
|
||||
var statePublisher: CurrentValuePublisher<RoomSummaryProviderState, Never> {
|
||||
|
||||
@@ -13,6 +13,7 @@ import MatrixRustSDK
|
||||
extension SpaceServiceProxyMock {
|
||||
struct Configuration {
|
||||
var joinedSpaces: [SpaceRoomProxyProtocol] = []
|
||||
var joinedParentSpaces: [SpaceRoomProxyProtocol] = []
|
||||
var spaceRoomLists: [String: SpaceRoomListProxyMock] = [:]
|
||||
var leaveSpaceRooms: [LeaveSpaceRoom] = []
|
||||
}
|
||||
@@ -21,6 +22,7 @@ extension SpaceServiceProxyMock {
|
||||
self.init()
|
||||
|
||||
joinedSpacesPublisher = .init(configuration.joinedSpaces)
|
||||
joinedParentsRoomIDReturnValue = .success(configuration.joinedParentSpaces)
|
||||
spaceRoomListSpaceIDClosure = { spaceID in
|
||||
if let spaceRoomList = configuration.spaceRoomLists[spaceID] {
|
||||
.success(spaceRoomList)
|
||||
|
||||
Reference in New Issue
Block a user