mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Refactor SpaceServiceProxy.joinedSpaces to topLevelSpaces.
This commit is contained in:
@@ -121,7 +121,7 @@ extension ClientProxyMock {
|
||||
roomProxy.loadOrFetchEventDetailsForReturnValue = .success(TimelineEventSDKMock())
|
||||
return .joined(roomProxy)
|
||||
}
|
||||
} else if let spaceRoomProxy = configuration.spaceServiceConfiguration.joinedSpaces.first(where: { $0.id == identifier }) {
|
||||
} else if let spaceRoomProxy = configuration.spaceServiceConfiguration.topLevelSpaces.first(where: { $0.id == identifier }) {
|
||||
let roomProxy = await JoinedRoomProxyMock(.init(id: spaceRoomProxy.id, name: spaceRoomProxy.name, isSpace: spaceRoomProxy.isSpace))
|
||||
roomProxy.loadOrFetchEventDetailsForReturnValue = .success(TimelineEventSDKMock())
|
||||
return .joined(roomProxy)
|
||||
|
||||
@@ -16685,11 +16685,11 @@ class SpaceRoomProxyMock: SpaceRoomProxyProtocol, @unchecked Sendable {
|
||||
|
||||
}
|
||||
class SpaceServiceProxyMock: SpaceServiceProxyProtocol, @unchecked Sendable {
|
||||
var joinedSpacesPublisher: CurrentValuePublisher<[SpaceRoomProxyProtocol], Never> {
|
||||
get { return underlyingJoinedSpacesPublisher }
|
||||
set(value) { underlyingJoinedSpacesPublisher = value }
|
||||
var topLevelSpacesPublisher: CurrentValuePublisher<[SpaceRoomProxyProtocol], Never> {
|
||||
get { return underlyingTopLevelSpacesPublisher }
|
||||
set(value) { underlyingTopLevelSpacesPublisher = value }
|
||||
}
|
||||
var underlyingJoinedSpacesPublisher: CurrentValuePublisher<[SpaceRoomProxyProtocol], Never>!
|
||||
var underlyingTopLevelSpacesPublisher: CurrentValuePublisher<[SpaceRoomProxyProtocol], Never>!
|
||||
|
||||
//MARK: - spaceRoomList
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import MatrixRustSDK
|
||||
|
||||
extension SpaceServiceProxyMock {
|
||||
struct Configuration {
|
||||
var joinedSpaces: [SpaceRoomProxyProtocol] = []
|
||||
var topLevelSpaces: [SpaceRoomProxyProtocol] = []
|
||||
var joinedParentSpaces: [SpaceRoomProxyProtocol] = []
|
||||
var spaceRoomLists: [String: SpaceRoomListProxyMock] = [:]
|
||||
var leaveSpaceRooms: [LeaveSpaceRoom] = []
|
||||
@@ -21,7 +21,7 @@ extension SpaceServiceProxyMock {
|
||||
convenience init(_ configuration: Configuration) {
|
||||
self.init()
|
||||
|
||||
joinedSpacesPublisher = .init(configuration.joinedSpaces)
|
||||
topLevelSpacesPublisher = .init(configuration.topLevelSpaces)
|
||||
joinedParentsChildIDReturnValue = .success(configuration.joinedParentSpaces)
|
||||
spaceRoomListSpaceIDClosure = { spaceID in
|
||||
if let spaceRoomList = configuration.spaceRoomLists[spaceID] {
|
||||
@@ -35,7 +35,7 @@ extension SpaceServiceProxyMock {
|
||||
leaveHandle: LeaveSpaceHandleSDKMock(.init(rooms: configuration.leaveSpaceRooms))))
|
||||
}
|
||||
spaceForIdentifierSpaceIDClosure = { spaceID in
|
||||
.success(configuration.joinedSpaces.first { $0.id == spaceID })
|
||||
.success(configuration.topLevelSpaces.first { $0.id == spaceID })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,6 @@ extension SpaceServiceProxyMock.Configuration {
|
||||
($0.id, SpaceRoomListProxyMock(.init(spaceRoomProxy: $0, initialSpaceRooms: .mockSingleRoom)))
|
||||
}
|
||||
|
||||
return .init(joinedSpaces: .mockJoinedSpaces, spaceRoomLists: .init(uniqueKeysWithValues: spaceRoomLists + subSpaceRoomLists))
|
||||
return .init(topLevelSpaces: .mockJoinedSpaces, spaceRoomLists: .init(uniqueKeysWithValues: spaceRoomLists + subSpaceRoomLists))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user