mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Update the SDK and build a client before logging in with a QR code. (#4320)
This commit is contained in:
@@ -11,9 +11,6 @@ import MatrixRustSDK
|
||||
// sourcery: AutoMockable
|
||||
protocol AuthenticationClientBuilderProtocol {
|
||||
func build(homeserverAddress: String) async throws -> ClientProtocol
|
||||
func buildWithQRCode(qrCodeData: QrCodeData,
|
||||
oidcConfiguration: OIDCConfigurationProxy,
|
||||
progressListener: SDKListener<QrLoginProgress>) async throws -> ClientProtocol
|
||||
}
|
||||
|
||||
/// A wrapper around `ClientBuilder` to share reusable code between Normal and QR logins.
|
||||
@@ -30,15 +27,6 @@ struct AuthenticationClientBuilder: AuthenticationClientBuilderProtocol {
|
||||
try await makeClientBuilder().serverNameOrHomeserverUrl(serverNameOrUrl: homeserverAddress).build()
|
||||
}
|
||||
|
||||
/// Builds a Client, authenticating with the given QR code data.
|
||||
func buildWithQRCode(qrCodeData: QrCodeData,
|
||||
oidcConfiguration: OIDCConfigurationProxy,
|
||||
progressListener: SDKListener<QrLoginProgress>) async throws -> ClientProtocol {
|
||||
try await makeClientBuilder().buildWithQrCode(qrCodeData: qrCodeData,
|
||||
oidcConfiguration: oidcConfiguration.rustValue,
|
||||
progressListener: progressListener)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
/// The base builder configuration used for authentication within the app.
|
||||
|
||||
@@ -58,9 +58,10 @@ final class QRCodeLoginService: QRCodeLoginServiceProtocol {
|
||||
}
|
||||
|
||||
do {
|
||||
let client = try await makeClientBuilder().buildWithQRCode(qrCodeData: qrData,
|
||||
oidcConfiguration: appSettings.oidcConfiguration,
|
||||
progressListener: listener)
|
||||
let client = try await makeClientBuilder().build(homeserverAddress: scannedServerName)
|
||||
try await client.loginWithQrCode(qrCodeData: qrData,
|
||||
oidcConfiguration: appSettings.oidcConfiguration.rustValue,
|
||||
progressListener: listener)
|
||||
MXLog.info("Sliding sync: \(client.slidingSyncVersion())")
|
||||
return await userSession(for: client)
|
||||
} catch let error as HumanQrLoginError {
|
||||
|
||||
Reference in New Issue
Block a user