Update the SDK, handling OIDC/OAuth API breaks. (#5497)
Update the SDK handling API breaks.
This commit is contained in:
@@ -10131,7 +10131,7 @@
|
||||
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 26.04.23;
|
||||
version = 26.04.27;
|
||||
};
|
||||
};
|
||||
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"originHash" : "6eccca91b7f5f7d7d50476c059d00f2944d321851b0e0c1d6afb529416131af2",
|
||||
"originHash" : "307a0af81ae7a463ea2d0c101af1045c15def8948a63c21aa97fc7929759206e",
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "compound-design-tokens",
|
||||
@@ -158,8 +158,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/element-hq/matrix-rust-components-swift",
|
||||
"state" : {
|
||||
"revision" : "cadee968c71d7ddff8f4b04e934b963b6c08c2bd",
|
||||
"version" : "26.4.23"
|
||||
"revision" : "7480a104b123d588fc5be40c0769d9fdb4c5565c",
|
||||
"version" : "26.4.27"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@ struct OIDCConfiguration {
|
||||
import MatrixRustSDK
|
||||
|
||||
extension OIDCConfiguration {
|
||||
var rustValue: OidcConfiguration {
|
||||
OidcConfiguration(clientName: clientName,
|
||||
var rustValue: OAuthConfiguration {
|
||||
OAuthConfiguration(clientName: clientName,
|
||||
redirectUri: redirectURI.absoluteString,
|
||||
clientUri: clientURI.absoluteString,
|
||||
logoUri: logoURI.absoluteString,
|
||||
|
||||
@@ -31,7 +31,7 @@ extension ClientSDKMock {
|
||||
userId: "@alice:matrix.org",
|
||||
deviceId: UUID().uuidString,
|
||||
homeserverUrl: "https://matrix-client.matrix.org",
|
||||
oidcData: nil,
|
||||
oauthData: nil,
|
||||
slidingSyncVersion: .native)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ extension ClientSDKMock {
|
||||
userIdServerNameThrowableError = MockError.generic
|
||||
serverReturnValue = "https://\(configuration.serverAddress)"
|
||||
homeserverReturnValue = configuration.homeserverURL
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue = OAuthAuthorizationDataSDKMock(configuration: configuration)
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue = OAuthAuthorizationDataSDKMock(configuration: configuration)
|
||||
loginUsernamePasswordInitialDeviceNameDeviceIdClosure = { [weak self] username, password, _, _ in
|
||||
guard username == configuration.validCredentials.username,
|
||||
password == configuration.validCredentials.password else {
|
||||
@@ -77,8 +77,8 @@ extension HomeserverLoginDetailsSDKMock {
|
||||
|
||||
slidingSyncVersionReturnValue = configuration.slidingSyncVersion
|
||||
supportsPasswordLoginReturnValue = configuration.supportsPasswordLogin
|
||||
supportsOidcLoginReturnValue = configuration.oidcLoginURL != nil
|
||||
supportedOidcPromptsReturnValue = switch (configuration.oidcLoginURL, configuration.supportsOIDCCreatePrompt) {
|
||||
supportsOauthLoginReturnValue = configuration.oidcLoginURL != nil
|
||||
supportedOauthPromptsReturnValue = switch (configuration.oidcLoginURL, configuration.supportsOIDCCreatePrompt) {
|
||||
case (.none, _): []
|
||||
case (.some, true): [.consent, .create]
|
||||
case (.some, false): [.consent]
|
||||
|
||||
@@ -84,9 +84,9 @@ class EncryptionResetScreenViewModel: EncryptionResetScreenViewModelType, Encryp
|
||||
}
|
||||
|
||||
actionsSubject.send(.requestPassword(passwordPublisher: passwordPublisher))
|
||||
case .oidc(let oidcInfo):
|
||||
guard let url = URL(string: oidcInfo.approvalUrl) else {
|
||||
fatalError("Invalid URL received through identity reset handle: \(oidcInfo.approvalUrl)")
|
||||
case .oAuth(let oAuthInfo):
|
||||
guard let url = URL(string: oAuthInfo.approvalUrl) else {
|
||||
fatalError("Invalid URL received through identity reset handle: \(oAuthInfo.approvalUrl)")
|
||||
}
|
||||
|
||||
hideLoadingIndicator()
|
||||
|
||||
@@ -72,8 +72,8 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
let client = try await makeClient(homeserverAddress: homeserverAddress)
|
||||
let loginDetails = await client.homeserverLoginDetails()
|
||||
|
||||
homeserver.loginMode = if loginDetails.supportsOidcLogin() {
|
||||
.oidc(supportsCreatePrompt: loginDetails.supportedOidcPrompts().contains(.create))
|
||||
homeserver.loginMode = if loginDetails.supportsOauthLogin() {
|
||||
.oidc(supportsCreatePrompt: loginDetails.supportedOauthPrompts().contains(.create))
|
||||
} else if loginDetails.supportsPasswordLogin() {
|
||||
.password
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
do {
|
||||
// The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429
|
||||
// let prompt: OidcPrompt = flow == .register ? .create : .consent
|
||||
let oidcData = try await client.urlForOidc(oidcConfiguration: appSettings.oidcConfiguration.rustValue,
|
||||
let oidcData = try await client.urlForOauth(oauthConfiguration: appSettings.oidcConfiguration.rustValue,
|
||||
prompt: .consent,
|
||||
loginHint: loginHint,
|
||||
deviceId: nil,
|
||||
@@ -125,16 +125,16 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
func abortOIDCLogin(data: OIDCAuthorizationDataProxy) async {
|
||||
guard let client else { return }
|
||||
MXLog.info("Aborting OIDC login.")
|
||||
await client.abortOidcAuth(authorizationData: data.underlyingData)
|
||||
await client.abortOauthAuth(authorizationData: data.underlyingData)
|
||||
}
|
||||
|
||||
func loginWithOIDCCallback(_ callbackURL: URL) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
|
||||
guard let client else { return .failure(.failedLoggingIn) }
|
||||
do {
|
||||
try await client.loginWithOidcCallback(callbackUrl: callbackURL.absoluteString)
|
||||
try await client.loginWithOauthCallback(callbackUrl: callbackURL.absoluteString)
|
||||
await verifyClientIfPossible(client: client)
|
||||
return await userSession(for: client)
|
||||
} catch OidcError.Cancelled {
|
||||
} catch OAuthError.Cancelled {
|
||||
return .failure(.oidcError(.userCancellation))
|
||||
} catch {
|
||||
MXLog.error("Login with OIDC failed: \(error)")
|
||||
@@ -206,7 +206,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
Task {
|
||||
do {
|
||||
let client = try await makeClient(homeserverAddress: scannedServerNameOrBaseUrl)
|
||||
let qrCodeHandler = client.newLoginWithQrCodeHandler(oidcConfiguration: appSettings.oidcConfiguration.rustValue)
|
||||
let qrCodeHandler = client.newLoginWithQrCodeHandler(oauthConfiguration: appSettings.oidcConfiguration.rustValue)
|
||||
try await qrCodeHandler.scan(qrCodeData: qrData, progressListener: listener)
|
||||
|
||||
// Since the QR code login flow includes verification.
|
||||
@@ -284,7 +284,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
||||
appSettings: appSettings,
|
||||
appHooks: appHooks)
|
||||
let loginDetails = await client.homeserverLoginDetails()
|
||||
let isServerSupported = loginDetails.supportsOidcLogin() || loginDetails.supportsPasswordLogin()
|
||||
let isServerSupported = loginDetails.supportsOauthLogin() || loginDetails.supportsPasswordLogin()
|
||||
MXLog.info("Classic app homeserver supported: \(isServerSupported)")
|
||||
classicAppAccount.state.isServerSupported = isServerSupported
|
||||
|
||||
@@ -370,7 +370,7 @@ private extension HumanQrLoginError {
|
||||
.qrCodeError(.deviceNotSignedIn)
|
||||
case .UnsupportedQrCodeType:
|
||||
.qrCodeError(.invalidQRCode)
|
||||
case .Unknown, .OidcMetadataInvalid, .CheckCodeAlreadySent, .CheckCodeCannotBeSent:
|
||||
case .Unknown, .OAuthMetadataInvalid, .CheckCodeAlreadySent, .CheckCodeCannotBeSent:
|
||||
.qrCodeError(.unknown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ extension MatrixRustSDK.Session: @retroactive Codable {
|
||||
userId: container.decode(String.self, forKey: .userId),
|
||||
deviceId: container.decode(String.self, forKey: .deviceId),
|
||||
homeserverUrl: container.decode(String.self, forKey: .homeserverUrl),
|
||||
oidcData: container.decodeIfPresent(String.self, forKey: .oidcData),
|
||||
oauthData: container.decodeIfPresent(String.self, forKey: .oidcData),
|
||||
slidingSyncVersion: .native)
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ extension MatrixRustSDK.Session: @retroactive Codable {
|
||||
try container.encode(userId, forKey: .userId)
|
||||
try container.encode(deviceId, forKey: .deviceId)
|
||||
try container.encode(homeserverUrl, forKey: .homeserverUrl)
|
||||
try container.encode(oidcData, forKey: .oidcData)
|
||||
try container.encode(oauthData, forKey: .oidcData)
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
|
||||
@@ -6,6 +6,21 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
open class BackupSecretsSDKMock: MatrixRustSDK.BackupSecrets, @unchecked Sendable {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
public required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate var handle: UInt64 {
|
||||
get { return underlyingHandle }
|
||||
set(value) { underlyingHandle = value }
|
||||
}
|
||||
fileprivate var underlyingHandle: UInt64!
|
||||
}
|
||||
open class CheckCodeSenderSDKMock: MatrixRustSDK.CheckCodeSender, @unchecked Sendable {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
@@ -82,17 +97,17 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
fileprivate var underlyingHandle: UInt64!
|
||||
|
||||
//MARK: - abortOidcAuth
|
||||
//MARK: - abortOauthAuth
|
||||
|
||||
open var abortOidcAuthAuthorizationDataUnderlyingCallsCount = 0
|
||||
open var abortOidcAuthAuthorizationDataCallsCount: Int {
|
||||
open var abortOauthAuthAuthorizationDataUnderlyingCallsCount = 0
|
||||
open var abortOauthAuthAuthorizationDataCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return abortOidcAuthAuthorizationDataUnderlyingCallsCount
|
||||
return abortOauthAuthAuthorizationDataUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = abortOidcAuthAuthorizationDataUnderlyingCallsCount
|
||||
returnValue = abortOauthAuthAuthorizationDataUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -100,28 +115,28 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
abortOidcAuthAuthorizationDataUnderlyingCallsCount = newValue
|
||||
abortOauthAuthAuthorizationDataUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
abortOidcAuthAuthorizationDataUnderlyingCallsCount = newValue
|
||||
abortOauthAuthAuthorizationDataUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var abortOidcAuthAuthorizationDataCalled: Bool {
|
||||
return abortOidcAuthAuthorizationDataCallsCount > 0
|
||||
open var abortOauthAuthAuthorizationDataCalled: Bool {
|
||||
return abortOauthAuthAuthorizationDataCallsCount > 0
|
||||
}
|
||||
open var abortOidcAuthAuthorizationDataReceivedAuthorizationData: OAuthAuthorizationData?
|
||||
open var abortOidcAuthAuthorizationDataReceivedInvocations: [OAuthAuthorizationData] = []
|
||||
open var abortOidcAuthAuthorizationDataClosure: ((OAuthAuthorizationData) async -> Void)?
|
||||
open var abortOauthAuthAuthorizationDataReceivedAuthorizationData: OAuthAuthorizationData?
|
||||
open var abortOauthAuthAuthorizationDataReceivedInvocations: [OAuthAuthorizationData] = []
|
||||
open var abortOauthAuthAuthorizationDataClosure: ((OAuthAuthorizationData) async -> Void)?
|
||||
|
||||
open override func abortOidcAuth(authorizationData: OAuthAuthorizationData) async {
|
||||
abortOidcAuthAuthorizationDataCallsCount += 1
|
||||
abortOidcAuthAuthorizationDataReceivedAuthorizationData = authorizationData
|
||||
open override func abortOauthAuth(authorizationData: OAuthAuthorizationData) async {
|
||||
abortOauthAuthAuthorizationDataCallsCount += 1
|
||||
abortOauthAuthAuthorizationDataReceivedAuthorizationData = authorizationData
|
||||
DispatchQueue.main.async {
|
||||
self.abortOidcAuthAuthorizationDataReceivedInvocations.append(authorizationData)
|
||||
self.abortOauthAuthAuthorizationDataReceivedInvocations.append(authorizationData)
|
||||
}
|
||||
await abortOidcAuthAuthorizationDataClosure?(authorizationData)
|
||||
await abortOauthAuthAuthorizationDataClosure?(authorizationData)
|
||||
}
|
||||
|
||||
//MARK: - accountData
|
||||
@@ -3406,18 +3421,18 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
try await loginWithEmailEmailPasswordInitialDeviceNameDeviceIdClosure?(email, password, initialDeviceName, deviceId)
|
||||
}
|
||||
|
||||
//MARK: - loginWithOidcCallback
|
||||
//MARK: - loginWithOauthCallback
|
||||
|
||||
open var loginWithOidcCallbackCallbackUrlThrowableError: Error?
|
||||
open var loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = 0
|
||||
open var loginWithOidcCallbackCallbackUrlCallsCount: Int {
|
||||
open var loginWithOauthCallbackCallbackUrlThrowableError: Error?
|
||||
open var loginWithOauthCallbackCallbackUrlUnderlyingCallsCount = 0
|
||||
open var loginWithOauthCallbackCallbackUrlCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return loginWithOidcCallbackCallbackUrlUnderlyingCallsCount
|
||||
return loginWithOauthCallbackCallbackUrlUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = loginWithOidcCallbackCallbackUrlUnderlyingCallsCount
|
||||
returnValue = loginWithOauthCallbackCallbackUrlUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -3425,31 +3440,31 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = newValue
|
||||
loginWithOauthCallbackCallbackUrlUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = newValue
|
||||
loginWithOauthCallbackCallbackUrlUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var loginWithOidcCallbackCallbackUrlCalled: Bool {
|
||||
return loginWithOidcCallbackCallbackUrlCallsCount > 0
|
||||
open var loginWithOauthCallbackCallbackUrlCalled: Bool {
|
||||
return loginWithOauthCallbackCallbackUrlCallsCount > 0
|
||||
}
|
||||
open var loginWithOidcCallbackCallbackUrlReceivedCallbackUrl: String?
|
||||
open var loginWithOidcCallbackCallbackUrlReceivedInvocations: [String] = []
|
||||
open var loginWithOidcCallbackCallbackUrlClosure: ((String) async throws -> Void)?
|
||||
open var loginWithOauthCallbackCallbackUrlReceivedCallbackUrl: String?
|
||||
open var loginWithOauthCallbackCallbackUrlReceivedInvocations: [String] = []
|
||||
open var loginWithOauthCallbackCallbackUrlClosure: ((String) async throws -> Void)?
|
||||
|
||||
open override func loginWithOidcCallback(callbackUrl: String) async throws {
|
||||
if let error = loginWithOidcCallbackCallbackUrlThrowableError {
|
||||
open override func loginWithOauthCallback(callbackUrl: String) async throws {
|
||||
if let error = loginWithOauthCallbackCallbackUrlThrowableError {
|
||||
throw error
|
||||
}
|
||||
loginWithOidcCallbackCallbackUrlCallsCount += 1
|
||||
loginWithOidcCallbackCallbackUrlReceivedCallbackUrl = callbackUrl
|
||||
loginWithOauthCallbackCallbackUrlCallsCount += 1
|
||||
loginWithOauthCallbackCallbackUrlReceivedCallbackUrl = callbackUrl
|
||||
DispatchQueue.main.async {
|
||||
self.loginWithOidcCallbackCallbackUrlReceivedInvocations.append(callbackUrl)
|
||||
self.loginWithOauthCallbackCallbackUrlReceivedInvocations.append(callbackUrl)
|
||||
}
|
||||
try await loginWithOidcCallbackCallbackUrlClosure?(callbackUrl)
|
||||
try await loginWithOauthCallbackCallbackUrlClosure?(callbackUrl)
|
||||
}
|
||||
|
||||
//MARK: - logout
|
||||
@@ -3559,15 +3574,15 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
|
||||
//MARK: - newLoginWithQrCodeHandler
|
||||
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount = 0
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationCallsCount: Int {
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount = 0
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount
|
||||
return newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount
|
||||
returnValue = newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -3575,29 +3590,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount = newValue
|
||||
newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount = newValue
|
||||
newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationCalled: Bool {
|
||||
return newLoginWithQrCodeHandlerOidcConfigurationCallsCount > 0
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationCalled: Bool {
|
||||
return newLoginWithQrCodeHandlerOauthConfigurationCallsCount > 0
|
||||
}
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationReceivedOidcConfiguration: OidcConfiguration?
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationReceivedInvocations: [OidcConfiguration] = []
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationReceivedOauthConfiguration: OAuthConfiguration?
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationReceivedInvocations: [OAuthConfiguration] = []
|
||||
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue: LoginWithQrCodeHandler!
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationReturnValue: LoginWithQrCodeHandler! {
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue: LoginWithQrCodeHandler!
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationReturnValue: LoginWithQrCodeHandler! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue
|
||||
return newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: LoginWithQrCodeHandler? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue
|
||||
returnValue = newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -3605,26 +3620,26 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue = newValue
|
||||
newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue = newValue
|
||||
newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var newLoginWithQrCodeHandlerOidcConfigurationClosure: ((OidcConfiguration) -> LoginWithQrCodeHandler)?
|
||||
open var newLoginWithQrCodeHandlerOauthConfigurationClosure: ((OAuthConfiguration) -> LoginWithQrCodeHandler)?
|
||||
|
||||
open override func newLoginWithQrCodeHandler(oidcConfiguration: OidcConfiguration) -> LoginWithQrCodeHandler {
|
||||
newLoginWithQrCodeHandlerOidcConfigurationCallsCount += 1
|
||||
newLoginWithQrCodeHandlerOidcConfigurationReceivedOidcConfiguration = oidcConfiguration
|
||||
open override func newLoginWithQrCodeHandler(oauthConfiguration: OAuthConfiguration) -> LoginWithQrCodeHandler {
|
||||
newLoginWithQrCodeHandlerOauthConfigurationCallsCount += 1
|
||||
newLoginWithQrCodeHandlerOauthConfigurationReceivedOauthConfiguration = oauthConfiguration
|
||||
DispatchQueue.main.async {
|
||||
self.newLoginWithQrCodeHandlerOidcConfigurationReceivedInvocations.append(oidcConfiguration)
|
||||
self.newLoginWithQrCodeHandlerOauthConfigurationReceivedInvocations.append(oauthConfiguration)
|
||||
}
|
||||
if let newLoginWithQrCodeHandlerOidcConfigurationClosure = newLoginWithQrCodeHandlerOidcConfigurationClosure {
|
||||
return newLoginWithQrCodeHandlerOidcConfigurationClosure(oidcConfiguration)
|
||||
if let newLoginWithQrCodeHandlerOauthConfigurationClosure = newLoginWithQrCodeHandlerOauthConfigurationClosure {
|
||||
return newLoginWithQrCodeHandlerOauthConfigurationClosure(oauthConfiguration)
|
||||
} else {
|
||||
return newLoginWithQrCodeHandlerOidcConfigurationReturnValue
|
||||
return newLoginWithQrCodeHandlerOauthConfigurationReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5635,6 +5650,81 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - subscribeToOwnBeaconInfoUpdates
|
||||
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerThrowableError: Error?
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerUnderlyingCallsCount = 0
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return subscribeToOwnBeaconInfoUpdatesListenerUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = subscribeToOwnBeaconInfoUpdatesListenerUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
subscribeToOwnBeaconInfoUpdatesListenerUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
subscribeToOwnBeaconInfoUpdatesListenerUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerCalled: Bool {
|
||||
return subscribeToOwnBeaconInfoUpdatesListenerCallsCount > 0
|
||||
}
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerReceivedListener: BeaconInfoListener?
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerReceivedInvocations: [BeaconInfoListener] = []
|
||||
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerUnderlyingReturnValue: TaskHandle!
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerReturnValue: TaskHandle! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return subscribeToOwnBeaconInfoUpdatesListenerUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: TaskHandle? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = subscribeToOwnBeaconInfoUpdatesListenerUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
subscribeToOwnBeaconInfoUpdatesListenerUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
subscribeToOwnBeaconInfoUpdatesListenerUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var subscribeToOwnBeaconInfoUpdatesListenerClosure: ((BeaconInfoListener) throws -> TaskHandle)?
|
||||
|
||||
open override func subscribeToOwnBeaconInfoUpdates(listener: BeaconInfoListener) throws -> TaskHandle {
|
||||
if let error = subscribeToOwnBeaconInfoUpdatesListenerThrowableError {
|
||||
throw error
|
||||
}
|
||||
subscribeToOwnBeaconInfoUpdatesListenerCallsCount += 1
|
||||
subscribeToOwnBeaconInfoUpdatesListenerReceivedListener = listener
|
||||
DispatchQueue.main.async {
|
||||
self.subscribeToOwnBeaconInfoUpdatesListenerReceivedInvocations.append(listener)
|
||||
}
|
||||
if let subscribeToOwnBeaconInfoUpdatesListenerClosure = subscribeToOwnBeaconInfoUpdatesListenerClosure {
|
||||
return try subscribeToOwnBeaconInfoUpdatesListenerClosure(listener)
|
||||
} else {
|
||||
return subscribeToOwnBeaconInfoUpdatesListenerReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - subscribeToRoomInfo
|
||||
|
||||
open var subscribeToRoomInfoRoomIdListenerThrowableError: Error?
|
||||
@@ -6280,18 +6370,18 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - urlForOidc
|
||||
//MARK: - urlForOauth
|
||||
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError: Error?
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = 0
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount: Int {
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError: Error?
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = 0
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount
|
||||
return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount
|
||||
returnValue = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -6299,29 +6389,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCalled: Bool {
|
||||
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount > 0
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCalled: Bool {
|
||||
return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount > 0
|
||||
}
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments: (oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?)?
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations: [(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?)] = []
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments: (oauthConfiguration: OAuthConfiguration, prompt: OAuthPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?)?
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations: [(oauthConfiguration: OAuthConfiguration, prompt: OAuthPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?)] = []
|
||||
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue: OAuthAuthorizationData!
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue: OAuthAuthorizationData! {
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue: OAuthAuthorizationData!
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue: OAuthAuthorizationData! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue
|
||||
return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: OAuthAuthorizationData? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue
|
||||
returnValue = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -6329,29 +6419,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure: ((OidcConfiguration, OidcPrompt?, String?, String?, [String]?) async throws -> OAuthAuthorizationData)?
|
||||
open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure: ((OAuthConfiguration, OAuthPrompt?, String?, String?, [String]?) async throws -> OAuthAuthorizationData)?
|
||||
|
||||
open override func urlForOidc(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?) async throws -> OAuthAuthorizationData {
|
||||
if let error = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError {
|
||||
open override func urlForOauth(oauthConfiguration: OAuthConfiguration, prompt: OAuthPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?) async throws -> OAuthAuthorizationData {
|
||||
if let error = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError {
|
||||
throw error
|
||||
}
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount += 1
|
||||
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments = (oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes)
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount += 1
|
||||
urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments = (oauthConfiguration: oauthConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes)
|
||||
DispatchQueue.main.async {
|
||||
self.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations.append((oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes))
|
||||
self.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations.append((oauthConfiguration: oauthConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes))
|
||||
}
|
||||
if let urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure {
|
||||
return try await urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure(oidcConfiguration, prompt, loginHint, deviceId, additionalScopes)
|
||||
if let urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure {
|
||||
return try await urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure(oauthConfiguration, prompt, loginHint, deviceId, additionalScopes)
|
||||
} else {
|
||||
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue
|
||||
return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8583,6 +8673,21 @@ open class ClientBuilderSDKMock: MatrixRustSDK.ClientBuilder, @unchecked Sendabl
|
||||
}
|
||||
}
|
||||
}
|
||||
open class CrossSigningSecretsSDKMock: MatrixRustSDK.CrossSigningSecrets, @unchecked Sendable {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
public required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate var handle: UInt64 {
|
||||
get { return underlyingHandle }
|
||||
set(value) { underlyingHandle = value }
|
||||
}
|
||||
fileprivate var underlyingHandle: UInt64!
|
||||
}
|
||||
open class EncryptionSDKMock: MatrixRustSDK.Encryption, @unchecked Sendable {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
@@ -10815,17 +10920,17 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - supportedOidcPrompts
|
||||
//MARK: - supportedOauthPrompts
|
||||
|
||||
open var supportedOidcPromptsUnderlyingCallsCount = 0
|
||||
open var supportedOidcPromptsCallsCount: Int {
|
||||
open var supportedOauthPromptsUnderlyingCallsCount = 0
|
||||
open var supportedOauthPromptsCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return supportedOidcPromptsUnderlyingCallsCount
|
||||
return supportedOauthPromptsUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = supportedOidcPromptsUnderlyingCallsCount
|
||||
returnValue = supportedOauthPromptsUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -10833,27 +10938,27 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
supportedOidcPromptsUnderlyingCallsCount = newValue
|
||||
supportedOauthPromptsUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
supportedOidcPromptsUnderlyingCallsCount = newValue
|
||||
supportedOauthPromptsUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var supportedOidcPromptsCalled: Bool {
|
||||
return supportedOidcPromptsCallsCount > 0
|
||||
open var supportedOauthPromptsCalled: Bool {
|
||||
return supportedOauthPromptsCallsCount > 0
|
||||
}
|
||||
|
||||
open var supportedOidcPromptsUnderlyingReturnValue: [OidcPrompt]!
|
||||
open var supportedOidcPromptsReturnValue: [OidcPrompt]! {
|
||||
open var supportedOauthPromptsUnderlyingReturnValue: [OAuthPrompt]!
|
||||
open var supportedOauthPromptsReturnValue: [OAuthPrompt]! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return supportedOidcPromptsUnderlyingReturnValue
|
||||
return supportedOauthPromptsUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: [OidcPrompt]? = nil
|
||||
var returnValue: [OAuthPrompt]? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = supportedOidcPromptsUnderlyingReturnValue
|
||||
returnValue = supportedOauthPromptsUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -10861,36 +10966,36 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
supportedOidcPromptsUnderlyingReturnValue = newValue
|
||||
supportedOauthPromptsUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
supportedOidcPromptsUnderlyingReturnValue = newValue
|
||||
supportedOauthPromptsUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var supportedOidcPromptsClosure: (() -> [OidcPrompt])?
|
||||
open var supportedOauthPromptsClosure: (() -> [OAuthPrompt])?
|
||||
|
||||
open override func supportedOidcPrompts() -> [OidcPrompt] {
|
||||
supportedOidcPromptsCallsCount += 1
|
||||
if let supportedOidcPromptsClosure = supportedOidcPromptsClosure {
|
||||
return supportedOidcPromptsClosure()
|
||||
open override func supportedOauthPrompts() -> [OAuthPrompt] {
|
||||
supportedOauthPromptsCallsCount += 1
|
||||
if let supportedOauthPromptsClosure = supportedOauthPromptsClosure {
|
||||
return supportedOauthPromptsClosure()
|
||||
} else {
|
||||
return supportedOidcPromptsReturnValue
|
||||
return supportedOauthPromptsReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - supportsOidcLogin
|
||||
//MARK: - supportsOauthLogin
|
||||
|
||||
open var supportsOidcLoginUnderlyingCallsCount = 0
|
||||
open var supportsOidcLoginCallsCount: Int {
|
||||
open var supportsOauthLoginUnderlyingCallsCount = 0
|
||||
open var supportsOauthLoginCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return supportsOidcLoginUnderlyingCallsCount
|
||||
return supportsOauthLoginUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = supportsOidcLoginUnderlyingCallsCount
|
||||
returnValue = supportsOauthLoginUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -10898,27 +11003,27 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
supportsOidcLoginUnderlyingCallsCount = newValue
|
||||
supportsOauthLoginUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
supportsOidcLoginUnderlyingCallsCount = newValue
|
||||
supportsOauthLoginUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var supportsOidcLoginCalled: Bool {
|
||||
return supportsOidcLoginCallsCount > 0
|
||||
open var supportsOauthLoginCalled: Bool {
|
||||
return supportsOauthLoginCallsCount > 0
|
||||
}
|
||||
|
||||
open var supportsOidcLoginUnderlyingReturnValue: Bool!
|
||||
open var supportsOidcLoginReturnValue: Bool! {
|
||||
open var supportsOauthLoginUnderlyingReturnValue: Bool!
|
||||
open var supportsOauthLoginReturnValue: Bool! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return supportsOidcLoginUnderlyingReturnValue
|
||||
return supportsOauthLoginUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Bool? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = supportsOidcLoginUnderlyingReturnValue
|
||||
returnValue = supportsOauthLoginUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
@@ -10926,22 +11031,22 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
supportsOidcLoginUnderlyingReturnValue = newValue
|
||||
supportsOauthLoginUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
supportsOidcLoginUnderlyingReturnValue = newValue
|
||||
supportsOauthLoginUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var supportsOidcLoginClosure: (() -> Bool)?
|
||||
open var supportsOauthLoginClosure: (() -> Bool)?
|
||||
|
||||
open override func supportsOidcLogin() -> Bool {
|
||||
supportsOidcLoginCallsCount += 1
|
||||
if let supportsOidcLoginClosure = supportsOidcLoginClosure {
|
||||
return supportsOidcLoginClosure()
|
||||
open override func supportsOauthLogin() -> Bool {
|
||||
supportsOauthLoginCallsCount += 1
|
||||
if let supportsOauthLoginClosure = supportsOauthLoginClosure {
|
||||
return supportsOauthLoginClosure()
|
||||
} else {
|
||||
return supportsOidcLoginReturnValue
|
||||
return supportsOauthLoginReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19065,9 +19170,34 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
||||
}
|
||||
open var startLiveLocationShareDurationMillisReceivedDurationMillis: UInt64?
|
||||
open var startLiveLocationShareDurationMillisReceivedInvocations: [UInt64] = []
|
||||
open var startLiveLocationShareDurationMillisClosure: ((UInt64) async throws -> Void)?
|
||||
|
||||
open override func startLiveLocationShare(durationMillis: UInt64) async throws {
|
||||
open var startLiveLocationShareDurationMillisUnderlyingReturnValue: String!
|
||||
open var startLiveLocationShareDurationMillisReturnValue: String! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return startLiveLocationShareDurationMillisUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: String? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = startLiveLocationShareDurationMillisUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
startLiveLocationShareDurationMillisUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
startLiveLocationShareDurationMillisUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
open var startLiveLocationShareDurationMillisClosure: ((UInt64) async throws -> String)?
|
||||
|
||||
open override func startLiveLocationShare(durationMillis: UInt64) async throws -> String {
|
||||
if let error = startLiveLocationShareDurationMillisThrowableError {
|
||||
throw error
|
||||
}
|
||||
@@ -19076,7 +19206,11 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
|
||||
DispatchQueue.main.async {
|
||||
self.startLiveLocationShareDurationMillisReceivedInvocations.append(durationMillis)
|
||||
}
|
||||
try await startLiveLocationShareDurationMillisClosure?(durationMillis)
|
||||
if let startLiveLocationShareDurationMillisClosure = startLiveLocationShareDurationMillisClosure {
|
||||
return try await startLiveLocationShareDurationMillisClosure(durationMillis)
|
||||
} else {
|
||||
return startLiveLocationShareDurationMillisReturnValue
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - stopLiveLocationShare
|
||||
@@ -23749,6 +23883,21 @@ open class RoomSearchIteratorSDKMock: MatrixRustSDK.RoomSearchIterator, @uncheck
|
||||
}
|
||||
}
|
||||
}
|
||||
open class SecretsBundleSDKMock: MatrixRustSDK.SecretsBundle, @unchecked Sendable {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
}
|
||||
|
||||
public required init(unsafeFromHandle handle: UInt64) {
|
||||
fatalError("init(unsafeFromHandle:) has not been implemented")
|
||||
}
|
||||
|
||||
fileprivate var handle: UInt64 {
|
||||
get { return underlyingHandle }
|
||||
set(value) { underlyingHandle = value }
|
||||
}
|
||||
fileprivate var underlyingHandle: UInt64!
|
||||
}
|
||||
open class SecretsBundleWithUserIdSDKMock: MatrixRustSDK.SecretsBundleWithUserId, @unchecked Sendable {
|
||||
public init() {
|
||||
super.init(noHandle: .init())
|
||||
|
||||
@@ -41,7 +41,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
// Given a view model that has no provisioning parameters.
|
||||
await setupViewModel()
|
||||
#expect(authenticationService.homeserver.value.loginMode == .unknown)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When tapping any of the buttons on the screen
|
||||
let actions: [(AuthenticationStartScreenViewAction, AuthenticationStartScreenViewModelAction)] = [
|
||||
@@ -58,7 +58,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
|
||||
// Then the authentication service should not be used yet.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(authenticationService.homeserver.value.loginMode == .unknown)
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
// Given a view model that has been provisioned with a server that supports OIDC.
|
||||
await setupViewModel(provisioningParameters: .init(accountProvider: "company.com", loginHint: "user@company.com"))
|
||||
#expect(authenticationService.homeserver.value.loginMode == .unknown)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When tapping the login button the authentication service should be used and the screen
|
||||
// should request to continue the flow without any server selection needed.
|
||||
@@ -77,9 +77,9 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
try await deferred.fulfill()
|
||||
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "user@company.com")
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "user@company.com")
|
||||
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
// Given a view model that has been provisioned with a server that does not support OIDC.
|
||||
await setupViewModel(provisioningParameters: .init(accountProvider: "company.com", loginHint: "user@company.com"), supportsOIDC: false)
|
||||
#expect(authenticationService.homeserver.value.loginMode == .unknown)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When tapping the login button the authentication service should be used and the screen
|
||||
// should request to continue the flow without any server selection needed.
|
||||
@@ -107,7 +107,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
setAllowedAccountProviders(["company.com"])
|
||||
await setupViewModel()
|
||||
#expect(authenticationService.homeserver.value.loginMode == .unknown)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When tapping the login button the authentication service should be used and the screen
|
||||
// should request to continue the flow without any server selection needed.
|
||||
@@ -116,9 +116,9 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
try await deferred.fulfill()
|
||||
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == nil)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == nil)
|
||||
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
setAllowedAccountProviders(["company.com"])
|
||||
await setupViewModel(supportsOIDC: false)
|
||||
#expect(authenticationService.homeserver.value.loginMode == .unknown)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When tapping the login button the authentication service should be used and the screen
|
||||
// should request to continue the flow without any server selection needed.
|
||||
@@ -163,7 +163,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksReceivedArguments?.homeserverAddress == "company.com")
|
||||
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -187,7 +187,7 @@ final class AuthenticationStartScreenViewModelTests {
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 2)
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksReceivedArguments?.homeserverAddress == "https://matrix.company.com")
|
||||
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -33,7 +33,7 @@ struct KeychainControllerTests {
|
||||
userId: "userId",
|
||||
deviceId: "deviceId",
|
||||
homeserverUrl: "homeserverUrl",
|
||||
oidcData: "oidcData",
|
||||
oauthData: "oauthData",
|
||||
slidingSyncVersion: .native),
|
||||
sessionDirectories: .init(),
|
||||
passphrase: "passphrase",
|
||||
@@ -53,7 +53,7 @@ struct KeychainControllerTests {
|
||||
userId: "userId",
|
||||
deviceId: "deviceId",
|
||||
homeserverUrl: "homeserverUrl",
|
||||
oidcData: "oidcData",
|
||||
oauthData: "oauthData",
|
||||
slidingSyncVersion: .native),
|
||||
sessionDirectories: .init(),
|
||||
passphrase: "passphrase",
|
||||
@@ -79,7 +79,7 @@ struct KeychainControllerTests {
|
||||
userId: "userId",
|
||||
deviceId: "deviceId",
|
||||
homeserverUrl: "homeserverUrl",
|
||||
oidcData: "oidcData",
|
||||
oauthData: "oauthData",
|
||||
slidingSyncVersion: .native),
|
||||
sessionDirectories: .init(),
|
||||
passphrase: "passphrase",
|
||||
@@ -104,7 +104,7 @@ struct KeychainControllerTests {
|
||||
userId: "userId",
|
||||
deviceId: "deviceId",
|
||||
homeserverUrl: "homeserverUrl",
|
||||
oidcData: "oidcData",
|
||||
oauthData: "oauthData",
|
||||
slidingSyncVersion: .native),
|
||||
sessionDirectories: .init(),
|
||||
passphrase: "passphrase",
|
||||
|
||||
@@ -103,7 +103,7 @@ struct RestorationTokenTests {
|
||||
userId: "@user:example.com",
|
||||
deviceId: "D3V1C3",
|
||||
homeserverUrl: "https://matrix.example.com",
|
||||
oidcData: "data-from-mas",
|
||||
oauthData: "data-from-mas",
|
||||
slidingSyncVersion: .native),
|
||||
sessionDirectories: .init(),
|
||||
passphrase: "passphrase",
|
||||
@@ -123,7 +123,7 @@ struct RestorationTokenTests {
|
||||
#expect(session.userId == originalSession.userId, "The user ID should not be changed.")
|
||||
#expect(session.deviceId == originalSession.deviceId, "The device ID should not be changed.")
|
||||
#expect(session.homeserverUrl == originalSession.homeserverUrl, "The homeserver URL should not be changed.")
|
||||
#expect(session.oidcData == originalSession.oidcData, "The OIDC data should not be changed.")
|
||||
#expect(session.oauthData == originalSession.oidcData, "The OAuth data should not be changed.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .unknown)
|
||||
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
|
||||
@@ -52,8 +52,8 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then a call to configure service should be made.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
|
||||
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
|
||||
@@ -77,8 +77,8 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then the configured homeserver should be used and no additional client should be built.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,7 +88,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .unknown)
|
||||
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
|
||||
@@ -97,9 +97,9 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then a call to configure service should be made.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
// The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429
|
||||
// #expect(client.urlForOidcOidcConfigurationPromptReceivedArguments?.prompt == .create)
|
||||
// #expect(client.urlForOauthOauthConfigurationPromptReceivedArguments?.prompt == .create)
|
||||
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
|
||||
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
|
||||
@@ -124,8 +124,8 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
// Then the configured homeserver should be used and no additional client should be built.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
// The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429
|
||||
// #expect(client.urlForOidcOidcConfigurationPromptReceivedArguments?.prompt == .create)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
// #expect(client.urlForOauthOauthConfigurationPromptReceivedArguments?.prompt == .create)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -135,7 +135,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .unknown)
|
||||
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword }
|
||||
@@ -144,7 +144,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then a call to configure service should be made, but not for the OIDC URL.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(service.homeserver.value.loginMode == .password)
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .password)
|
||||
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword }
|
||||
@@ -168,7 +168,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then the configured homeserver should be used and no additional client should be built, nor a call to get the OIDC URL.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -235,7 +235,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .unknown)
|
||||
#expect(context.viewState.mode == .picker(appSettings.accountProviders))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
|
||||
@@ -244,8 +244,8 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then a call to configure service should be made.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
|
||||
#expect(context.viewState.mode == .picker(appSettings.accountProviders))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
|
||||
@@ -269,8 +269,8 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then the configured homeserver should be used and no additional client should be built.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -280,7 +280,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .unknown)
|
||||
#expect(context.viewState.mode == .picker(appSettings.accountProviders))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword }
|
||||
@@ -289,7 +289,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then a call to configure service should be made, but not for the OIDC URL.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(service.homeserver.value.loginMode == .password)
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
#expect(service.homeserver.value.loginMode == .password)
|
||||
#expect(context.viewState.mode == .picker(appSettings.accountProviders))
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
|
||||
// When continuing from the confirmation screen.
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword }
|
||||
@@ -313,7 +313,7 @@ final class ServerConfirmationScreenViewModelTests {
|
||||
|
||||
// Then the configured homeserver should be used and no additional client should be built, nor a call to get the OIDC URL.
|
||||
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
|
||||
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
#expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
@@ -74,7 +74,7 @@ packages:
|
||||
# Element/Matrix dependencies
|
||||
MatrixRustSDK:
|
||||
url: https://github.com/element-hq/matrix-rust-components-swift
|
||||
exactVersion: 26.04.23
|
||||
exactVersion: 26.04.27
|
||||
# path: ../matrix-rust-sdk
|
||||
Compound:
|
||||
path: compound-ios
|
||||
|
||||
Reference in New Issue
Block a user