mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Use the ClientFactory pattern everywhere replacing raw ClientBuilders.
# Conflicts: # ElementX/Sources/Services/UserSession/UserSessionStore.swift # NSE/Sources/NSEUserSession.swift
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
import MatrixRustSDKMocks
|
||||
|
||||
nonisolated extension ClientBuilderSDKMock {
|
||||
struct Configuration {
|
||||
var disableWellKnownLookup = false
|
||||
}
|
||||
|
||||
enum MockError: Error { case generic }
|
||||
|
||||
convenience init(_ configuration: Configuration) {
|
||||
self.init()
|
||||
|
||||
disableWellKnownLookupDisableWellKnownLookupReturnValue = self
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ nonisolated extension ClientSDKMock {
|
||||
struct Configuration {
|
||||
// MARK: Authentication
|
||||
|
||||
var serverAddress = "matrix.org"
|
||||
var serverName = "matrix.org"
|
||||
var homeserverURL = "https://matrix-client.matrix.org"
|
||||
var slidingSyncVersion = SlidingSyncVersion.native
|
||||
var oAuthLoginURL: String? = "https://account.matrix.org/authorize"
|
||||
@@ -43,7 +43,7 @@ nonisolated extension ClientSDKMock {
|
||||
homeserverLoginDetailsReturnValue = HomeserverLoginDetailsSDKMock(configuration: configuration)
|
||||
slidingSyncVersionReturnValue = configuration.slidingSyncVersion
|
||||
userIdServerNameThrowableError = MockError.generic
|
||||
serverReturnValue = "https://\(configuration.serverAddress)"
|
||||
serverReturnValue = "https://\(configuration.serverName)"
|
||||
homeserverReturnValue = configuration.homeserverURL
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue = OAuthAuthorizationDataSDKMock(configuration: configuration)
|
||||
loginUsernamePasswordInitialDeviceNameDeviceIdClosure = { [weak self] username, password, _, _ in
|
||||
@@ -54,7 +54,7 @@ nonisolated extension ClientSDKMock {
|
||||
if username.hasPrefix("@"), username.contains(":") {
|
||||
self?.userIdReturnValue = username
|
||||
} else {
|
||||
self?.userIdReturnValue = "@\(username):\(configuration.serverAddress)"
|
||||
self?.userIdReturnValue = "@\(username):\(configuration.serverName)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user