mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Public Search View (#2585)
Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -1131,6 +1131,23 @@ class ClientProxyMock: ClientProxyProtocol {
|
||||
return profileForReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - roomDirectorySearchProxy
|
||||
|
||||
var roomDirectorySearchProxyCallsCount = 0
|
||||
var roomDirectorySearchProxyCalled: Bool {
|
||||
return roomDirectorySearchProxyCallsCount > 0
|
||||
}
|
||||
var roomDirectorySearchProxyReturnValue: RoomDirectorySearchProxyProtocol!
|
||||
var roomDirectorySearchProxyClosure: (() -> RoomDirectorySearchProxyProtocol)?
|
||||
|
||||
func roomDirectorySearchProxy() -> RoomDirectorySearchProxyProtocol {
|
||||
roomDirectorySearchProxyCallsCount += 1
|
||||
if let roomDirectorySearchProxyClosure = roomDirectorySearchProxyClosure {
|
||||
return roomDirectorySearchProxyClosure()
|
||||
} else {
|
||||
return roomDirectorySearchProxyReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - ignoreUser
|
||||
|
||||
var ignoreUserCallsCount = 0
|
||||
@@ -2245,6 +2262,52 @@ class PollInteractionHandlerMock: PollInteractionHandlerProtocol {
|
||||
}
|
||||
}
|
||||
}
|
||||
class RoomDirectorySearchProxyMock: RoomDirectorySearchProxyProtocol {
|
||||
var resultsPublisher: CurrentValuePublisher<[RoomDirectorySearchResult], Never> {
|
||||
get { return underlyingResultsPublisher }
|
||||
set(value) { underlyingResultsPublisher = value }
|
||||
}
|
||||
var underlyingResultsPublisher: CurrentValuePublisher<[RoomDirectorySearchResult], Never>!
|
||||
|
||||
//MARK: - search
|
||||
|
||||
var searchQueryCallsCount = 0
|
||||
var searchQueryCalled: Bool {
|
||||
return searchQueryCallsCount > 0
|
||||
}
|
||||
var searchQueryReceivedQuery: String?
|
||||
var searchQueryReceivedInvocations: [String?] = []
|
||||
var searchQueryReturnValue: Result<Void, RoomDirectorySearchError>!
|
||||
var searchQueryClosure: ((String?) async -> Result<Void, RoomDirectorySearchError>)?
|
||||
|
||||
func search(query: String?) async -> Result<Void, RoomDirectorySearchError> {
|
||||
searchQueryCallsCount += 1
|
||||
searchQueryReceivedQuery = query
|
||||
searchQueryReceivedInvocations.append(query)
|
||||
if let searchQueryClosure = searchQueryClosure {
|
||||
return await searchQueryClosure(query)
|
||||
} else {
|
||||
return searchQueryReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - nextPage
|
||||
|
||||
var nextPageCallsCount = 0
|
||||
var nextPageCalled: Bool {
|
||||
return nextPageCallsCount > 0
|
||||
}
|
||||
var nextPageReturnValue: Result<Void, RoomDirectorySearchError>!
|
||||
var nextPageClosure: (() async -> Result<Void, RoomDirectorySearchError>)?
|
||||
|
||||
func nextPage() async -> Result<Void, RoomDirectorySearchError> {
|
||||
nextPageCallsCount += 1
|
||||
if let nextPageClosure = nextPageClosure {
|
||||
return await nextPageClosure()
|
||||
} else {
|
||||
return nextPageReturnValue
|
||||
}
|
||||
}
|
||||
}
|
||||
class RoomMemberProxyMock: RoomMemberProxyProtocol {
|
||||
var userID: String {
|
||||
get { return underlyingUserID }
|
||||
|
||||
@@ -505,6 +505,23 @@ class SDKClientMock: SDKClientProtocol {
|
||||
restoreSessionSessionReceivedInvocations.append(session)
|
||||
try restoreSessionSessionClosure?(session)
|
||||
}
|
||||
//MARK: - roomDirectorySearch
|
||||
|
||||
public var roomDirectorySearchCallsCount = 0
|
||||
public var roomDirectorySearchCalled: Bool {
|
||||
return roomDirectorySearchCallsCount > 0
|
||||
}
|
||||
public var roomDirectorySearchReturnValue: RoomDirectorySearch!
|
||||
public var roomDirectorySearchClosure: (() -> RoomDirectorySearch)?
|
||||
|
||||
public func roomDirectorySearch() -> RoomDirectorySearch {
|
||||
roomDirectorySearchCallsCount += 1
|
||||
if let roomDirectorySearchClosure = roomDirectorySearchClosure {
|
||||
return roomDirectorySearchClosure()
|
||||
} else {
|
||||
return roomDirectorySearchReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - rooms
|
||||
|
||||
public var roomsCallsCount = 0
|
||||
|
||||
Reference in New Issue
Block a user