Rename SearchUsersResultsProxy to SearchUsersResults. It also proxies nothing.

This commit is contained in:
Doug
2026-07-01 15:21:09 +01:00
committed by Doug
parent 3ef66cdd05
commit b8860baf49
5 changed files with 9 additions and 9 deletions
@@ -3491,14 +3491,14 @@ nonisolated class ClientProxyMock: ClientProxyProtocol, @unchecked Sendable {
} }
private let searchUsersSearchTermLimitReturnValueLock = NSLock() private let searchUsersSearchTermLimitReturnValueLock = NSLock()
private nonisolated(unsafe) var searchUsersSearchTermLimitUnderlyingReturnValue: Result<SearchUsersResultsProxy, ClientProxyError>! private nonisolated(unsafe) var searchUsersSearchTermLimitUnderlyingReturnValue: Result<SearchUsersResults, ClientProxyError>!
var searchUsersSearchTermLimitReturnValue: Result<SearchUsersResultsProxy, ClientProxyError>! { var searchUsersSearchTermLimitReturnValue: Result<SearchUsersResults, ClientProxyError>! {
get { searchUsersSearchTermLimitReturnValueLock.withLock { searchUsersSearchTermLimitUnderlyingReturnValue } } get { searchUsersSearchTermLimitReturnValueLock.withLock { searchUsersSearchTermLimitUnderlyingReturnValue } }
set { searchUsersSearchTermLimitReturnValueLock.withLock { searchUsersSearchTermLimitUnderlyingReturnValue = newValue } } set { searchUsersSearchTermLimitReturnValueLock.withLock { searchUsersSearchTermLimitUnderlyingReturnValue = newValue } }
} }
nonisolated(unsafe) var searchUsersSearchTermLimitClosure: ((String, UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError>)? nonisolated(unsafe) var searchUsersSearchTermLimitClosure: ((String, UInt) async -> Result<SearchUsersResults, ClientProxyError>)?
@concurrent func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError> { @concurrent func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResults, ClientProxyError> {
searchUsersSearchTermLimitCallsCountLock.withLock { searchUsersSearchTermLimitUnderlyingCallsCount += 1 } searchUsersSearchTermLimitCallsCountLock.withLock { searchUsersSearchTermLimitUnderlyingCallsCount += 1 }
searchUsersSearchTermLimitReceivedArguments = (searchTerm: searchTerm, limit: limit) searchUsersSearchTermLimitReceivedArguments = (searchTerm: searchTerm, limit: limit)
searchUsersSearchTermLimitReceivedInvocationsLock.withLock { searchUsersSearchTermLimitUnderlyingReceivedInvocations.append((searchTerm: searchTerm, limit: limit)) } searchUsersSearchTermLimitReceivedInvocationsLock.withLock { searchUsersSearchTermLimitUnderlyingReceivedInvocations.append((searchTerm: searchTerm, limit: limit)) }
@@ -777,7 +777,7 @@ class ClientProxy: ClientProxyProtocol {
append: false) append: false)
} }
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError> { func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResults, ClientProxyError> {
do { do {
return try await .success(.init(sdkResults: client.searchUsers(searchTerm: searchTerm, limit: UInt64(limit)))) return try await .success(.init(sdkResults: client.searchUsers(searchTerm: searchTerm, limit: UInt64(limit))))
} catch { } catch {
@@ -230,7 +230,7 @@ protocol ClientProxyProtocol: AnyObject {
func setPusher(with configuration: PusherConfiguration) async throws func setPusher(with configuration: PusherConfiguration) async throws
func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResultsProxy, ClientProxyError> func searchUsers(searchTerm: String, limit: UInt) async -> Result<SearchUsersResults, ClientProxyError>
func profile(for userID: String) async -> Result<UserProfile, ClientProxyError> func profile(for userID: String) async -> Result<UserProfile, ClientProxyError>
@@ -32,7 +32,7 @@ final class UserDiscoveryService: UserDiscoveryServiceProtocol {
} }
} }
private func merge(queriedProfile: UserProfile?, searchResults: SearchUsersResultsProxy) -> [UserProfile] { private func merge(queriedProfile: UserProfile?, searchResults: SearchUsersResults) -> [UserProfile] {
let searchResults = searchResults.results let searchResults = searchResults.results
guard let queriedProfile else { guard let queriedProfile else {
@@ -55,12 +55,12 @@ nonisolated struct UserProfile: Hashable, Identifiable {
} }
} }
struct SearchUsersResultsProxy { struct SearchUsersResults {
let results: [UserProfile] let results: [UserProfile]
let limited: Bool let limited: Bool
} }
extension SearchUsersResultsProxy { extension SearchUsersResults {
init(sdkResults: MatrixRustSDK.SearchUsersResults) { init(sdkResults: MatrixRustSDK.SearchUsersResults) {
results = sdkResults.results.map(UserProfile.init) results = sdkResults.results.map(UserProfile.init)
limited = sdkResults.limited limited = sdkResults.limited