Update the SDK, handling OIDC/OAuth API breaks. (#5497)

Update the SDK handling API breaks.
This commit is contained in:
Doug
2026-04-27 14:46:53 +01:00
committed by GitHub
parent 9987a34265
commit 1c8c5ea711
13 changed files with 363 additions and 214 deletions

View File

@@ -10131,7 +10131,7 @@
repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift"; repositoryURL = "https://github.com/element-hq/matrix-rust-components-swift";
requirement = { requirement = {
kind = exactVersion; kind = exactVersion;
version = 26.04.23; version = 26.04.27;
}; };
}; };
701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = { 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */ = {

View File

@@ -1,5 +1,5 @@
{ {
"originHash" : "6eccca91b7f5f7d7d50476c059d00f2944d321851b0e0c1d6afb529416131af2", "originHash" : "307a0af81ae7a463ea2d0c101af1045c15def8948a63c21aa97fc7929759206e",
"pins" : [ "pins" : [
{ {
"identity" : "compound-design-tokens", "identity" : "compound-design-tokens",
@@ -158,8 +158,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/matrix-rust-components-swift", "location" : "https://github.com/element-hq/matrix-rust-components-swift",
"state" : { "state" : {
"revision" : "cadee968c71d7ddff8f4b04e934b963b6c08c2bd", "revision" : "7480a104b123d588fc5be40c0769d9fdb4c5565c",
"version" : "26.4.23" "version" : "26.4.27"
} }
}, },
{ {

View File

@@ -22,14 +22,14 @@ struct OIDCConfiguration {
import MatrixRustSDK import MatrixRustSDK
extension OIDCConfiguration { extension OIDCConfiguration {
var rustValue: OidcConfiguration { var rustValue: OAuthConfiguration {
OidcConfiguration(clientName: clientName, OAuthConfiguration(clientName: clientName,
redirectUri: redirectURI.absoluteString, redirectUri: redirectURI.absoluteString,
clientUri: clientURI.absoluteString, clientUri: clientURI.absoluteString,
logoUri: logoURI.absoluteString, logoUri: logoURI.absoluteString,
tosUri: tosURI.absoluteString, tosUri: tosURI.absoluteString,
policyUri: policyURI.absoluteString, policyUri: policyURI.absoluteString,
staticRegistrations: staticRegistrations) staticRegistrations: staticRegistrations)
} }
} }
#endif #endif

View File

@@ -31,7 +31,7 @@ extension ClientSDKMock {
userId: "@alice:matrix.org", userId: "@alice:matrix.org",
deviceId: UUID().uuidString, deviceId: UUID().uuidString,
homeserverUrl: "https://matrix-client.matrix.org", homeserverUrl: "https://matrix-client.matrix.org",
oidcData: nil, oauthData: nil,
slidingSyncVersion: .native) slidingSyncVersion: .native)
} }
@@ -45,7 +45,7 @@ extension ClientSDKMock {
userIdServerNameThrowableError = MockError.generic userIdServerNameThrowableError = MockError.generic
serverReturnValue = "https://\(configuration.serverAddress)" serverReturnValue = "https://\(configuration.serverAddress)"
homeserverReturnValue = configuration.homeserverURL homeserverReturnValue = configuration.homeserverURL
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue = OAuthAuthorizationDataSDKMock(configuration: configuration) urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue = OAuthAuthorizationDataSDKMock(configuration: configuration)
loginUsernamePasswordInitialDeviceNameDeviceIdClosure = { [weak self] username, password, _, _ in loginUsernamePasswordInitialDeviceNameDeviceIdClosure = { [weak self] username, password, _, _ in
guard username == configuration.validCredentials.username, guard username == configuration.validCredentials.username,
password == configuration.validCredentials.password else { password == configuration.validCredentials.password else {
@@ -77,8 +77,8 @@ extension HomeserverLoginDetailsSDKMock {
slidingSyncVersionReturnValue = configuration.slidingSyncVersion slidingSyncVersionReturnValue = configuration.slidingSyncVersion
supportsPasswordLoginReturnValue = configuration.supportsPasswordLogin supportsPasswordLoginReturnValue = configuration.supportsPasswordLogin
supportsOidcLoginReturnValue = configuration.oidcLoginURL != nil supportsOauthLoginReturnValue = configuration.oidcLoginURL != nil
supportedOidcPromptsReturnValue = switch (configuration.oidcLoginURL, configuration.supportsOIDCCreatePrompt) { supportedOauthPromptsReturnValue = switch (configuration.oidcLoginURL, configuration.supportsOIDCCreatePrompt) {
case (.none, _): [] case (.none, _): []
case (.some, true): [.consent, .create] case (.some, true): [.consent, .create]
case (.some, false): [.consent] case (.some, false): [.consent]

View File

@@ -84,9 +84,9 @@ class EncryptionResetScreenViewModel: EncryptionResetScreenViewModelType, Encryp
} }
actionsSubject.send(.requestPassword(passwordPublisher: passwordPublisher)) actionsSubject.send(.requestPassword(passwordPublisher: passwordPublisher))
case .oidc(let oidcInfo): case .oAuth(let oAuthInfo):
guard let url = URL(string: oidcInfo.approvalUrl) else { guard let url = URL(string: oAuthInfo.approvalUrl) else {
fatalError("Invalid URL received through identity reset handle: \(oidcInfo.approvalUrl)") fatalError("Invalid URL received through identity reset handle: \(oAuthInfo.approvalUrl)")
} }
hideLoadingIndicator() hideLoadingIndicator()

View File

@@ -72,8 +72,8 @@ class AuthenticationService: AuthenticationServiceProtocol {
let client = try await makeClient(homeserverAddress: homeserverAddress) let client = try await makeClient(homeserverAddress: homeserverAddress)
let loginDetails = await client.homeserverLoginDetails() let loginDetails = await client.homeserverLoginDetails()
homeserver.loginMode = if loginDetails.supportsOidcLogin() { homeserver.loginMode = if loginDetails.supportsOauthLogin() {
.oidc(supportsCreatePrompt: loginDetails.supportedOidcPrompts().contains(.create)) .oidc(supportsCreatePrompt: loginDetails.supportedOauthPrompts().contains(.create))
} else if loginDetails.supportsPasswordLogin() { } else if loginDetails.supportsPasswordLogin() {
.password .password
} else { } else {
@@ -110,11 +110,11 @@ class AuthenticationService: AuthenticationServiceProtocol {
do { do {
// The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429 // The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429
// let prompt: OidcPrompt = flow == .register ? .create : .consent // 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, prompt: .consent,
loginHint: loginHint, loginHint: loginHint,
deviceId: nil, deviceId: nil,
additionalScopes: nil) additionalScopes: nil)
return .success(OIDCAuthorizationDataProxy(underlyingData: oidcData)) return .success(OIDCAuthorizationDataProxy(underlyingData: oidcData))
} catch { } catch {
MXLog.error("Failed to get URL for OIDC login: \(error)") MXLog.error("Failed to get URL for OIDC login: \(error)")
@@ -125,16 +125,16 @@ class AuthenticationService: AuthenticationServiceProtocol {
func abortOIDCLogin(data: OIDCAuthorizationDataProxy) async { func abortOIDCLogin(data: OIDCAuthorizationDataProxy) async {
guard let client else { return } guard let client else { return }
MXLog.info("Aborting OIDC login.") 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> { func loginWithOIDCCallback(_ callbackURL: URL) async -> Result<UserSessionProtocol, AuthenticationServiceError> {
guard let client else { return .failure(.failedLoggingIn) } guard let client else { return .failure(.failedLoggingIn) }
do { do {
try await client.loginWithOidcCallback(callbackUrl: callbackURL.absoluteString) try await client.loginWithOauthCallback(callbackUrl: callbackURL.absoluteString)
await verifyClientIfPossible(client: client) await verifyClientIfPossible(client: client)
return await userSession(for: client) return await userSession(for: client)
} catch OidcError.Cancelled { } catch OAuthError.Cancelled {
return .failure(.oidcError(.userCancellation)) return .failure(.oidcError(.userCancellation))
} catch { } catch {
MXLog.error("Login with OIDC failed: \(error)") MXLog.error("Login with OIDC failed: \(error)")
@@ -206,7 +206,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
Task { Task {
do { do {
let client = try await makeClient(homeserverAddress: scannedServerNameOrBaseUrl) 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) try await qrCodeHandler.scan(qrCodeData: qrData, progressListener: listener)
// Since the QR code login flow includes verification. // Since the QR code login flow includes verification.
@@ -284,7 +284,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
appSettings: appSettings, appSettings: appSettings,
appHooks: appHooks) appHooks: appHooks)
let loginDetails = await client.homeserverLoginDetails() let loginDetails = await client.homeserverLoginDetails()
let isServerSupported = loginDetails.supportsOidcLogin() || loginDetails.supportsPasswordLogin() let isServerSupported = loginDetails.supportsOauthLogin() || loginDetails.supportsPasswordLogin()
MXLog.info("Classic app homeserver supported: \(isServerSupported)") MXLog.info("Classic app homeserver supported: \(isServerSupported)")
classicAppAccount.state.isServerSupported = isServerSupported classicAppAccount.state.isServerSupported = isServerSupported
@@ -370,7 +370,7 @@ private extension HumanQrLoginError {
.qrCodeError(.deviceNotSignedIn) .qrCodeError(.deviceNotSignedIn)
case .UnsupportedQrCodeType: case .UnsupportedQrCodeType:
.qrCodeError(.invalidQRCode) .qrCodeError(.invalidQRCode)
case .Unknown, .OidcMetadataInvalid, .CheckCodeAlreadySent, .CheckCodeCannotBeSent: case .Unknown, .OAuthMetadataInvalid, .CheckCodeAlreadySent, .CheckCodeCannotBeSent:
.qrCodeError(.unknown) .qrCodeError(.unknown)
} }
} }

View File

@@ -77,7 +77,7 @@ extension MatrixRustSDK.Session: @retroactive Codable {
userId: container.decode(String.self, forKey: .userId), userId: container.decode(String.self, forKey: .userId),
deviceId: container.decode(String.self, forKey: .deviceId), deviceId: container.decode(String.self, forKey: .deviceId),
homeserverUrl: container.decode(String.self, forKey: .homeserverUrl), homeserverUrl: container.decode(String.self, forKey: .homeserverUrl),
oidcData: container.decodeIfPresent(String.self, forKey: .oidcData), oauthData: container.decodeIfPresent(String.self, forKey: .oidcData),
slidingSyncVersion: .native) slidingSyncVersion: .native)
} }
@@ -88,7 +88,7 @@ extension MatrixRustSDK.Session: @retroactive Codable {
try container.encode(userId, forKey: .userId) try container.encode(userId, forKey: .userId)
try container.encode(deviceId, forKey: .deviceId) try container.encode(deviceId, forKey: .deviceId)
try container.encode(homeserverUrl, forKey: .homeserverUrl) try container.encode(homeserverUrl, forKey: .homeserverUrl)
try container.encode(oidcData, forKey: .oidcData) try container.encode(oauthData, forKey: .oidcData)
} }
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {

View File

@@ -6,6 +6,21 @@
import Foundation 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 { open class CheckCodeSenderSDKMock: MatrixRustSDK.CheckCodeSender, @unchecked Sendable {
public init() { public init() {
super.init(noHandle: .init()) super.init(noHandle: .init())
@@ -82,17 +97,17 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
fileprivate var underlyingHandle: UInt64! fileprivate var underlyingHandle: UInt64!
//MARK: - abortOidcAuth //MARK: - abortOauthAuth
open var abortOidcAuthAuthorizationDataUnderlyingCallsCount = 0 open var abortOauthAuthAuthorizationDataUnderlyingCallsCount = 0
open var abortOidcAuthAuthorizationDataCallsCount: Int { open var abortOauthAuthAuthorizationDataCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return abortOidcAuthAuthorizationDataUnderlyingCallsCount return abortOauthAuthAuthorizationDataUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = abortOidcAuthAuthorizationDataUnderlyingCallsCount returnValue = abortOauthAuthAuthorizationDataUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -100,28 +115,28 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
abortOidcAuthAuthorizationDataUnderlyingCallsCount = newValue abortOauthAuthAuthorizationDataUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
abortOidcAuthAuthorizationDataUnderlyingCallsCount = newValue abortOauthAuthAuthorizationDataUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var abortOidcAuthAuthorizationDataCalled: Bool { open var abortOauthAuthAuthorizationDataCalled: Bool {
return abortOidcAuthAuthorizationDataCallsCount > 0 return abortOauthAuthAuthorizationDataCallsCount > 0
} }
open var abortOidcAuthAuthorizationDataReceivedAuthorizationData: OAuthAuthorizationData? open var abortOauthAuthAuthorizationDataReceivedAuthorizationData: OAuthAuthorizationData?
open var abortOidcAuthAuthorizationDataReceivedInvocations: [OAuthAuthorizationData] = [] open var abortOauthAuthAuthorizationDataReceivedInvocations: [OAuthAuthorizationData] = []
open var abortOidcAuthAuthorizationDataClosure: ((OAuthAuthorizationData) async -> Void)? open var abortOauthAuthAuthorizationDataClosure: ((OAuthAuthorizationData) async -> Void)?
open override func abortOidcAuth(authorizationData: OAuthAuthorizationData) async { open override func abortOauthAuth(authorizationData: OAuthAuthorizationData) async {
abortOidcAuthAuthorizationDataCallsCount += 1 abortOauthAuthAuthorizationDataCallsCount += 1
abortOidcAuthAuthorizationDataReceivedAuthorizationData = authorizationData abortOauthAuthAuthorizationDataReceivedAuthorizationData = authorizationData
DispatchQueue.main.async { DispatchQueue.main.async {
self.abortOidcAuthAuthorizationDataReceivedInvocations.append(authorizationData) self.abortOauthAuthAuthorizationDataReceivedInvocations.append(authorizationData)
} }
await abortOidcAuthAuthorizationDataClosure?(authorizationData) await abortOauthAuthAuthorizationDataClosure?(authorizationData)
} }
//MARK: - accountData //MARK: - accountData
@@ -3406,18 +3421,18 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
try await loginWithEmailEmailPasswordInitialDeviceNameDeviceIdClosure?(email, password, initialDeviceName, deviceId) try await loginWithEmailEmailPasswordInitialDeviceNameDeviceIdClosure?(email, password, initialDeviceName, deviceId)
} }
//MARK: - loginWithOidcCallback //MARK: - loginWithOauthCallback
open var loginWithOidcCallbackCallbackUrlThrowableError: Error? open var loginWithOauthCallbackCallbackUrlThrowableError: Error?
open var loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = 0 open var loginWithOauthCallbackCallbackUrlUnderlyingCallsCount = 0
open var loginWithOidcCallbackCallbackUrlCallsCount: Int { open var loginWithOauthCallbackCallbackUrlCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return loginWithOidcCallbackCallbackUrlUnderlyingCallsCount return loginWithOauthCallbackCallbackUrlUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = loginWithOidcCallbackCallbackUrlUnderlyingCallsCount returnValue = loginWithOauthCallbackCallbackUrlUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -3425,31 +3440,31 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = newValue loginWithOauthCallbackCallbackUrlUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
loginWithOidcCallbackCallbackUrlUnderlyingCallsCount = newValue loginWithOauthCallbackCallbackUrlUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var loginWithOidcCallbackCallbackUrlCalled: Bool { open var loginWithOauthCallbackCallbackUrlCalled: Bool {
return loginWithOidcCallbackCallbackUrlCallsCount > 0 return loginWithOauthCallbackCallbackUrlCallsCount > 0
} }
open var loginWithOidcCallbackCallbackUrlReceivedCallbackUrl: String? open var loginWithOauthCallbackCallbackUrlReceivedCallbackUrl: String?
open var loginWithOidcCallbackCallbackUrlReceivedInvocations: [String] = [] open var loginWithOauthCallbackCallbackUrlReceivedInvocations: [String] = []
open var loginWithOidcCallbackCallbackUrlClosure: ((String) async throws -> Void)? open var loginWithOauthCallbackCallbackUrlClosure: ((String) async throws -> Void)?
open override func loginWithOidcCallback(callbackUrl: String) async throws { open override func loginWithOauthCallback(callbackUrl: String) async throws {
if let error = loginWithOidcCallbackCallbackUrlThrowableError { if let error = loginWithOauthCallbackCallbackUrlThrowableError {
throw error throw error
} }
loginWithOidcCallbackCallbackUrlCallsCount += 1 loginWithOauthCallbackCallbackUrlCallsCount += 1
loginWithOidcCallbackCallbackUrlReceivedCallbackUrl = callbackUrl loginWithOauthCallbackCallbackUrlReceivedCallbackUrl = callbackUrl
DispatchQueue.main.async { DispatchQueue.main.async {
self.loginWithOidcCallbackCallbackUrlReceivedInvocations.append(callbackUrl) self.loginWithOauthCallbackCallbackUrlReceivedInvocations.append(callbackUrl)
} }
try await loginWithOidcCallbackCallbackUrlClosure?(callbackUrl) try await loginWithOauthCallbackCallbackUrlClosure?(callbackUrl)
} }
//MARK: - logout //MARK: - logout
@@ -3559,15 +3574,15 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
//MARK: - newLoginWithQrCodeHandler //MARK: - newLoginWithQrCodeHandler
open var newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount = 0 open var newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount = 0
open var newLoginWithQrCodeHandlerOidcConfigurationCallsCount: Int { open var newLoginWithQrCodeHandlerOauthConfigurationCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount return newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount returnValue = newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -3575,29 +3590,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount = newValue newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingCallsCount = newValue newLoginWithQrCodeHandlerOauthConfigurationUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var newLoginWithQrCodeHandlerOidcConfigurationCalled: Bool { open var newLoginWithQrCodeHandlerOauthConfigurationCalled: Bool {
return newLoginWithQrCodeHandlerOidcConfigurationCallsCount > 0 return newLoginWithQrCodeHandlerOauthConfigurationCallsCount > 0
} }
open var newLoginWithQrCodeHandlerOidcConfigurationReceivedOidcConfiguration: OidcConfiguration? open var newLoginWithQrCodeHandlerOauthConfigurationReceivedOauthConfiguration: OAuthConfiguration?
open var newLoginWithQrCodeHandlerOidcConfigurationReceivedInvocations: [OidcConfiguration] = [] open var newLoginWithQrCodeHandlerOauthConfigurationReceivedInvocations: [OAuthConfiguration] = []
open var newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue: LoginWithQrCodeHandler! open var newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue: LoginWithQrCodeHandler!
open var newLoginWithQrCodeHandlerOidcConfigurationReturnValue: LoginWithQrCodeHandler! { open var newLoginWithQrCodeHandlerOauthConfigurationReturnValue: LoginWithQrCodeHandler! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue return newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue
} else { } else {
var returnValue: LoginWithQrCodeHandler? = nil var returnValue: LoginWithQrCodeHandler? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue returnValue = newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue
} }
return returnValue! return returnValue!
@@ -3605,26 +3620,26 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue = newValue newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
newLoginWithQrCodeHandlerOidcConfigurationUnderlyingReturnValue = newValue newLoginWithQrCodeHandlerOauthConfigurationUnderlyingReturnValue = newValue
} }
} }
} }
} }
open var newLoginWithQrCodeHandlerOidcConfigurationClosure: ((OidcConfiguration) -> LoginWithQrCodeHandler)? open var newLoginWithQrCodeHandlerOauthConfigurationClosure: ((OAuthConfiguration) -> LoginWithQrCodeHandler)?
open override func newLoginWithQrCodeHandler(oidcConfiguration: OidcConfiguration) -> LoginWithQrCodeHandler { open override func newLoginWithQrCodeHandler(oauthConfiguration: OAuthConfiguration) -> LoginWithQrCodeHandler {
newLoginWithQrCodeHandlerOidcConfigurationCallsCount += 1 newLoginWithQrCodeHandlerOauthConfigurationCallsCount += 1
newLoginWithQrCodeHandlerOidcConfigurationReceivedOidcConfiguration = oidcConfiguration newLoginWithQrCodeHandlerOauthConfigurationReceivedOauthConfiguration = oauthConfiguration
DispatchQueue.main.async { DispatchQueue.main.async {
self.newLoginWithQrCodeHandlerOidcConfigurationReceivedInvocations.append(oidcConfiguration) self.newLoginWithQrCodeHandlerOauthConfigurationReceivedInvocations.append(oauthConfiguration)
} }
if let newLoginWithQrCodeHandlerOidcConfigurationClosure = newLoginWithQrCodeHandlerOidcConfigurationClosure { if let newLoginWithQrCodeHandlerOauthConfigurationClosure = newLoginWithQrCodeHandlerOauthConfigurationClosure {
return newLoginWithQrCodeHandlerOidcConfigurationClosure(oidcConfiguration) return newLoginWithQrCodeHandlerOauthConfigurationClosure(oauthConfiguration)
} else { } 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 //MARK: - subscribeToRoomInfo
open var subscribeToRoomInfoRoomIdListenerThrowableError: Error? 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 urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError: Error?
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = 0 open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = 0
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount: Int { open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount returnValue = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -6299,29 +6389,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCalled: Bool { open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCalled: Bool {
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount > 0 return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount > 0
} }
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments: (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 urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedInvocations: [(oidcConfiguration: OidcConfiguration, prompt: OidcPrompt?, 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 urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue: OAuthAuthorizationData!
open var urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue: OAuthAuthorizationData! { open var urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReturnValue: OAuthAuthorizationData! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue return urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue
} else { } else {
var returnValue: OAuthAuthorizationData? = nil var returnValue: OAuthAuthorizationData? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue returnValue = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue
} }
return returnValue! return returnValue!
@@ -6329,29 +6419,29 @@ open class ClientSDKMock: MatrixRustSDK.Client, @unchecked Sendable {
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { 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 { open override func urlForOauth(oauthConfiguration: OAuthConfiguration, prompt: OAuthPrompt?, loginHint: String?, deviceId: String?, additionalScopes: [String]?) async throws -> OAuthAuthorizationData {
if let error = urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError { if let error = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesThrowableError {
throw error throw error
} }
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount += 1 urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount += 1
urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments = (oidcConfiguration: oidcConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes) urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments = (oauthConfiguration: oauthConfiguration, prompt: prompt, loginHint: loginHint, deviceId: deviceId, additionalScopes: additionalScopes)
DispatchQueue.main.async { 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 { if let urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure = urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure {
return try await urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure(oidcConfiguration, prompt, loginHint, deviceId, additionalScopes) return try await urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesClosure(oauthConfiguration, prompt, loginHint, deviceId, additionalScopes)
} else { } 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 { open class EncryptionSDKMock: MatrixRustSDK.Encryption, @unchecked Sendable {
public init() { public init() {
super.init(noHandle: .init()) super.init(noHandle: .init())
@@ -10815,17 +10920,17 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
} }
} }
//MARK: - supportedOidcPrompts //MARK: - supportedOauthPrompts
open var supportedOidcPromptsUnderlyingCallsCount = 0 open var supportedOauthPromptsUnderlyingCallsCount = 0
open var supportedOidcPromptsCallsCount: Int { open var supportedOauthPromptsCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return supportedOidcPromptsUnderlyingCallsCount return supportedOauthPromptsUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = supportedOidcPromptsUnderlyingCallsCount returnValue = supportedOauthPromptsUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -10833,27 +10938,27 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
supportedOidcPromptsUnderlyingCallsCount = newValue supportedOauthPromptsUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
supportedOidcPromptsUnderlyingCallsCount = newValue supportedOauthPromptsUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var supportedOidcPromptsCalled: Bool { open var supportedOauthPromptsCalled: Bool {
return supportedOidcPromptsCallsCount > 0 return supportedOauthPromptsCallsCount > 0
} }
open var supportedOidcPromptsUnderlyingReturnValue: [OidcPrompt]! open var supportedOauthPromptsUnderlyingReturnValue: [OAuthPrompt]!
open var supportedOidcPromptsReturnValue: [OidcPrompt]! { open var supportedOauthPromptsReturnValue: [OAuthPrompt]! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return supportedOidcPromptsUnderlyingReturnValue return supportedOauthPromptsUnderlyingReturnValue
} else { } else {
var returnValue: [OidcPrompt]? = nil var returnValue: [OAuthPrompt]? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = supportedOidcPromptsUnderlyingReturnValue returnValue = supportedOauthPromptsUnderlyingReturnValue
} }
return returnValue! return returnValue!
@@ -10861,36 +10966,36 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
supportedOidcPromptsUnderlyingReturnValue = newValue supportedOauthPromptsUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
supportedOidcPromptsUnderlyingReturnValue = newValue supportedOauthPromptsUnderlyingReturnValue = newValue
} }
} }
} }
} }
open var supportedOidcPromptsClosure: (() -> [OidcPrompt])? open var supportedOauthPromptsClosure: (() -> [OAuthPrompt])?
open override func supportedOidcPrompts() -> [OidcPrompt] { open override func supportedOauthPrompts() -> [OAuthPrompt] {
supportedOidcPromptsCallsCount += 1 supportedOauthPromptsCallsCount += 1
if let supportedOidcPromptsClosure = supportedOidcPromptsClosure { if let supportedOauthPromptsClosure = supportedOauthPromptsClosure {
return supportedOidcPromptsClosure() return supportedOauthPromptsClosure()
} else { } else {
return supportedOidcPromptsReturnValue return supportedOauthPromptsReturnValue
} }
} }
//MARK: - supportsOidcLogin //MARK: - supportsOauthLogin
open var supportsOidcLoginUnderlyingCallsCount = 0 open var supportsOauthLoginUnderlyingCallsCount = 0
open var supportsOidcLoginCallsCount: Int { open var supportsOauthLoginCallsCount: Int {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return supportsOidcLoginUnderlyingCallsCount return supportsOauthLoginUnderlyingCallsCount
} else { } else {
var returnValue: Int? = nil var returnValue: Int? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = supportsOidcLoginUnderlyingCallsCount returnValue = supportsOauthLoginUnderlyingCallsCount
} }
return returnValue! return returnValue!
@@ -10898,27 +11003,27 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
supportsOidcLoginUnderlyingCallsCount = newValue supportsOauthLoginUnderlyingCallsCount = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
supportsOidcLoginUnderlyingCallsCount = newValue supportsOauthLoginUnderlyingCallsCount = newValue
} }
} }
} }
} }
open var supportsOidcLoginCalled: Bool { open var supportsOauthLoginCalled: Bool {
return supportsOidcLoginCallsCount > 0 return supportsOauthLoginCallsCount > 0
} }
open var supportsOidcLoginUnderlyingReturnValue: Bool! open var supportsOauthLoginUnderlyingReturnValue: Bool!
open var supportsOidcLoginReturnValue: Bool! { open var supportsOauthLoginReturnValue: Bool! {
get { get {
if Thread.isMainThread { if Thread.isMainThread {
return supportsOidcLoginUnderlyingReturnValue return supportsOauthLoginUnderlyingReturnValue
} else { } else {
var returnValue: Bool? = nil var returnValue: Bool? = nil
DispatchQueue.main.sync { DispatchQueue.main.sync {
returnValue = supportsOidcLoginUnderlyingReturnValue returnValue = supportsOauthLoginUnderlyingReturnValue
} }
return returnValue! return returnValue!
@@ -10926,22 +11031,22 @@ open class HomeserverLoginDetailsSDKMock: MatrixRustSDK.HomeserverLoginDetails,
} }
set { set {
if Thread.isMainThread { if Thread.isMainThread {
supportsOidcLoginUnderlyingReturnValue = newValue supportsOauthLoginUnderlyingReturnValue = newValue
} else { } else {
DispatchQueue.main.sync { DispatchQueue.main.sync {
supportsOidcLoginUnderlyingReturnValue = newValue supportsOauthLoginUnderlyingReturnValue = newValue
} }
} }
} }
} }
open var supportsOidcLoginClosure: (() -> Bool)? open var supportsOauthLoginClosure: (() -> Bool)?
open override func supportsOidcLogin() -> Bool { open override func supportsOauthLogin() -> Bool {
supportsOidcLoginCallsCount += 1 supportsOauthLoginCallsCount += 1
if let supportsOidcLoginClosure = supportsOidcLoginClosure { if let supportsOauthLoginClosure = supportsOauthLoginClosure {
return supportsOidcLoginClosure() return supportsOauthLoginClosure()
} else { } else {
return supportsOidcLoginReturnValue return supportsOauthLoginReturnValue
} }
} }
@@ -19065,9 +19170,34 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
} }
open var startLiveLocationShareDurationMillisReceivedDurationMillis: UInt64? open var startLiveLocationShareDurationMillisReceivedDurationMillis: UInt64?
open var startLiveLocationShareDurationMillisReceivedInvocations: [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 { if let error = startLiveLocationShareDurationMillisThrowableError {
throw error throw error
} }
@@ -19076,7 +19206,11 @@ open class RoomSDKMock: MatrixRustSDK.Room, @unchecked Sendable {
DispatchQueue.main.async { DispatchQueue.main.async {
self.startLiveLocationShareDurationMillisReceivedInvocations.append(durationMillis) self.startLiveLocationShareDurationMillisReceivedInvocations.append(durationMillis)
} }
try await startLiveLocationShareDurationMillisClosure?(durationMillis) if let startLiveLocationShareDurationMillisClosure = startLiveLocationShareDurationMillisClosure {
return try await startLiveLocationShareDurationMillisClosure(durationMillis)
} else {
return startLiveLocationShareDurationMillisReturnValue
}
} }
//MARK: - stopLiveLocationShare //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 { open class SecretsBundleWithUserIdSDKMock: MatrixRustSDK.SecretsBundleWithUserId, @unchecked Sendable {
public init() { public init() {
super.init(noHandle: .init()) super.init(noHandle: .init())

View File

@@ -41,7 +41,7 @@ final class AuthenticationStartScreenViewModelTests {
// Given a view model that has no provisioning parameters. // Given a view model that has no provisioning parameters.
await setupViewModel() await setupViewModel()
#expect(authenticationService.homeserver.value.loginMode == .unknown) #expect(authenticationService.homeserver.value.loginMode == .unknown)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When tapping any of the buttons on the screen // When tapping any of the buttons on the screen
let actions: [(AuthenticationStartScreenViewAction, AuthenticationStartScreenViewModelAction)] = [ let actions: [(AuthenticationStartScreenViewAction, AuthenticationStartScreenViewModelAction)] = [
@@ -58,7 +58,7 @@ final class AuthenticationStartScreenViewModelTests {
// Then the authentication service should not be used yet. // Then the authentication service should not be used yet.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
#expect(authenticationService.homeserver.value.loginMode == .unknown) #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. // 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")) await setupViewModel(provisioningParameters: .init(accountProvider: "company.com", loginHint: "user@company.com"))
#expect(authenticationService.homeserver.value.loginMode == .unknown) #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 // 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. // should request to continue the flow without any server selection needed.
@@ -77,9 +77,9 @@ final class AuthenticationStartScreenViewModelTests {
try await deferred.fulfill() try await deferred.fulfill()
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "user@company.com") #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "user@company.com")
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false)) #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. // 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) await setupViewModel(provisioningParameters: .init(accountProvider: "company.com", loginHint: "user@company.com"), supportsOIDC: false)
#expect(authenticationService.homeserver.value.loginMode == .unknown) #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 // 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. // should request to continue the flow without any server selection needed.
@@ -107,7 +107,7 @@ final class AuthenticationStartScreenViewModelTests {
setAllowedAccountProviders(["company.com"]) setAllowedAccountProviders(["company.com"])
await setupViewModel() await setupViewModel()
#expect(authenticationService.homeserver.value.loginMode == .unknown) #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 // 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. // should request to continue the flow without any server selection needed.
@@ -116,9 +116,9 @@ final class AuthenticationStartScreenViewModelTests {
try await deferred.fulfill() try await deferred.fulfill()
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == nil) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == nil)
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false)) #expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
} }
@@ -128,7 +128,7 @@ final class AuthenticationStartScreenViewModelTests {
setAllowedAccountProviders(["company.com"]) setAllowedAccountProviders(["company.com"])
await setupViewModel(supportsOIDC: false) await setupViewModel(supportsOIDC: false)
#expect(authenticationService.homeserver.value.loginMode == .unknown) #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 // 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. // should request to continue the flow without any server selection needed.
@@ -163,7 +163,7 @@ final class AuthenticationStartScreenViewModelTests {
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksReceivedArguments?.homeserverAddress == "company.com") #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksReceivedArguments?.homeserverAddress == "company.com")
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false)) #expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)") #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
} }
@Test @Test
@@ -187,7 +187,7 @@ final class AuthenticationStartScreenViewModelTests {
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 2) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 2)
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksReceivedArguments?.homeserverAddress == "https://matrix.company.com") #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksReceivedArguments?.homeserverAddress == "https://matrix.company.com")
#expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false)) #expect(authenticationService.homeserver.value.loginMode == .oidc(supportsCreatePrompt: false))
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)") #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.loginHint == "mxid:\(classicAppAccount.userID)")
} }
@Test @Test

View File

@@ -33,7 +33,7 @@ struct KeychainControllerTests {
userId: "userId", userId: "userId",
deviceId: "deviceId", deviceId: "deviceId",
homeserverUrl: "homeserverUrl", homeserverUrl: "homeserverUrl",
oidcData: "oidcData", oauthData: "oauthData",
slidingSyncVersion: .native), slidingSyncVersion: .native),
sessionDirectories: .init(), sessionDirectories: .init(),
passphrase: "passphrase", passphrase: "passphrase",
@@ -53,7 +53,7 @@ struct KeychainControllerTests {
userId: "userId", userId: "userId",
deviceId: "deviceId", deviceId: "deviceId",
homeserverUrl: "homeserverUrl", homeserverUrl: "homeserverUrl",
oidcData: "oidcData", oauthData: "oauthData",
slidingSyncVersion: .native), slidingSyncVersion: .native),
sessionDirectories: .init(), sessionDirectories: .init(),
passphrase: "passphrase", passphrase: "passphrase",
@@ -79,7 +79,7 @@ struct KeychainControllerTests {
userId: "userId", userId: "userId",
deviceId: "deviceId", deviceId: "deviceId",
homeserverUrl: "homeserverUrl", homeserverUrl: "homeserverUrl",
oidcData: "oidcData", oauthData: "oauthData",
slidingSyncVersion: .native), slidingSyncVersion: .native),
sessionDirectories: .init(), sessionDirectories: .init(),
passphrase: "passphrase", passphrase: "passphrase",
@@ -104,7 +104,7 @@ struct KeychainControllerTests {
userId: "userId", userId: "userId",
deviceId: "deviceId", deviceId: "deviceId",
homeserverUrl: "homeserverUrl", homeserverUrl: "homeserverUrl",
oidcData: "oidcData", oauthData: "oauthData",
slidingSyncVersion: .native), slidingSyncVersion: .native),
sessionDirectories: .init(), sessionDirectories: .init(),
passphrase: "passphrase", passphrase: "passphrase",

View File

@@ -103,7 +103,7 @@ struct RestorationTokenTests {
userId: "@user:example.com", userId: "@user:example.com",
deviceId: "D3V1C3", deviceId: "D3V1C3",
homeserverUrl: "https://matrix.example.com", homeserverUrl: "https://matrix.example.com",
oidcData: "data-from-mas", oauthData: "data-from-mas",
slidingSyncVersion: .native), slidingSyncVersion: .native),
sessionDirectories: .init(), sessionDirectories: .init(),
passphrase: "passphrase", passphrase: "passphrase",
@@ -123,7 +123,7 @@ struct RestorationTokenTests {
#expect(session.userId == originalSession.userId, "The user ID should not be changed.") #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.deviceId == originalSession.deviceId, "The device ID should not be changed.")
#expect(session.homeserverUrl == originalSession.homeserverUrl, "The homeserver URL 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.")
} }
} }

View File

@@ -43,7 +43,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .unknown) #expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address)) #expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
@@ -52,8 +52,8 @@ final class ServerConfirmationScreenViewModelTests {
// Then a call to configure service should be made. // Then a call to configure service should be made.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true)) #expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
} }
@@ -68,7 +68,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true)) #expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address)) #expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } 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. // Then the configured homeserver should be used and no additional client should be built.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
} }
@Test @Test
@@ -88,7 +88,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .unknown) #expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address)) #expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
@@ -97,9 +97,9 @@ final class ServerConfirmationScreenViewModelTests {
// Then a call to configure service should be made. // Then a call to configure service should be made.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #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 // 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)) #expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
} }
@@ -114,7 +114,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true)) #expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address)) #expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } 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. // Then the configured homeserver should be used and no additional client should be built.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
// The create prompt is broken: https://github.com/element-hq/matrix-authentication-service/issues/3429 // 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(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
} }
@Test @Test
@@ -135,7 +135,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .unknown) #expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address)) #expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } 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. // Then a call to configure service should be made, but not for the OIDC URL.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
#expect(service.homeserver.value.loginMode == .password) #expect(service.homeserver.value.loginMode == .password)
} }
@@ -159,7 +159,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .password) #expect(service.homeserver.value.loginMode == .password)
#expect(context.viewState.mode == .confirmation(service.homeserver.value.address)) #expect(context.viewState.mode == .confirmation(service.homeserver.value.address))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } 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. // 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(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
} }
@Test @Test
@@ -235,7 +235,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .unknown) #expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .picker(appSettings.accountProviders)) #expect(context.viewState.mode == .picker(appSettings.accountProviders))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC }
@@ -244,8 +244,8 @@ final class ServerConfirmationScreenViewModelTests {
// Then a call to configure service should be made. // Then a call to configure service should be made.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true)) #expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
} }
@@ -260,7 +260,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true)) #expect(service.homeserver.value.loginMode == .oidc(supportsCreatePrompt: true))
#expect(context.viewState.mode == .picker(appSettings.accountProviders)) #expect(context.viewState.mode == .picker(appSettings.accountProviders))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithOIDC } 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. // Then the configured homeserver should be used and no additional client should be built.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesReceivedArguments?.prompt == .consent)
} }
@Test @Test
@@ -280,7 +280,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .unknown) #expect(service.homeserver.value.loginMode == .unknown)
#expect(context.viewState.mode == .picker(appSettings.accountProviders)) #expect(context.viewState.mode == .picker(appSettings.accountProviders))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 0)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } 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. // Then a call to configure service should be made, but not for the OIDC URL.
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
#expect(service.homeserver.value.loginMode == .password) #expect(service.homeserver.value.loginMode == .password)
} }
@@ -304,7 +304,7 @@ final class ServerConfirmationScreenViewModelTests {
#expect(service.homeserver.value.loginMode == .password) #expect(service.homeserver.value.loginMode == .password)
#expect(context.viewState.mode == .picker(appSettings.accountProviders)) #expect(context.viewState.mode == .picker(appSettings.accountProviders))
#expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1) #expect(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
// When continuing from the confirmation screen. // When continuing from the confirmation screen.
let deferred = deferFulfillment(viewModel.actions) { $0.isContinueWithPassword } 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. // 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(clientFactory.makeClientHomeserverAddressSessionDirectoriesPassphraseClientSessionDelegateAppSettingsAppHooksCallsCount == 1)
#expect(client.urlForOidcOidcConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0) #expect(client.urlForOauthOauthConfigurationPromptLoginHintDeviceIdAdditionalScopesCallsCount == 0)
} }
// MARK: - Helpers // MARK: - Helpers

View File

@@ -74,7 +74,7 @@ packages:
# Element/Matrix dependencies # Element/Matrix dependencies
MatrixRustSDK: MatrixRustSDK:
url: https://github.com/element-hq/matrix-rust-components-swift url: https://github.com/element-hq/matrix-rust-components-swift
exactVersion: 26.04.23 exactVersion: 26.04.27
# path: ../matrix-rust-sdk # path: ../matrix-rust-sdk
Compound: Compound:
path: compound-ios path: compound-ios