mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
Login with QR UI components (#6790)
* Display QR button on login screen if HS supports * Create start screen * Add build flag * Connect start screen to the login * QR display screen * Move `LabelledDividerView` into separate file * Show display QR screen on button tap * Add swift concurreny to CameraAccessManager * Introduce `QRLoginServiceProtocol` * Use new service in screens * Introduce scan QR code screen * Remove hardcoded service availability * Remove unnecessary import * Add confirmation screen * Add loading screen * Fix ZXingObjc targets * Add failure screen * Add strings * Various UI tweaks, navigation according to the service state * Fix tests * Add string for invalid QR error * Add QR login service mode
This commit is contained in:
+4
@@ -48,6 +48,10 @@ protocol AuthenticationRestClient: AnyObject {
|
||||
func forgetPassword(for email: String, clientSecret: String, sendAttempt: UInt) async throws -> String
|
||||
func resetPassword(parameters: CheckResetPasswordParameters) async throws
|
||||
func resetPassword(parameters: [String: Any]) async throws
|
||||
|
||||
// MARK: Versions
|
||||
|
||||
func supportedMatrixVersions() async throws -> MXMatrixVersions
|
||||
}
|
||||
|
||||
extension MXRestClient: AuthenticationRestClient { }
|
||||
|
||||
+5
-1
@@ -259,10 +259,14 @@ class AuthenticationService: NSObject {
|
||||
}
|
||||
|
||||
let loginFlow = try await getLoginFlowResult(client: client)
|
||||
|
||||
let supportsQRLogin = try await QRLoginService(client: client,
|
||||
mode: .notAuthenticated).isServiceAvailable()
|
||||
|
||||
let homeserver = AuthenticationState.Homeserver(address: loginFlow.homeserverAddress,
|
||||
addressFromUser: homeserverAddress,
|
||||
preferredLoginMode: loginFlow.loginMode)
|
||||
preferredLoginMode: loginFlow.loginMode,
|
||||
supportsQRLogin: supportsQRLogin)
|
||||
return (client, homeserver)
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,9 @@ struct AuthenticationState {
|
||||
|
||||
/// The preferred login mode for the server
|
||||
var preferredLoginMode: LoginMode = .unknown
|
||||
|
||||
/// Flag indicating whether the homeserver supports logging in via a QR code.
|
||||
var supportsQRLogin = false
|
||||
|
||||
/// The response returned when querying the homeserver for registration flows.
|
||||
var registrationFlow: RegistrationResult?
|
||||
@@ -67,6 +70,7 @@ struct AuthenticationState {
|
||||
AuthenticationHomeserverViewData(address: displayableAddress,
|
||||
showLoginForm: preferredLoginMode.supportsPasswordFlow,
|
||||
showRegistrationForm: registrationFlow != nil && !needsRegistrationFallback,
|
||||
showQRLogin: supportsQRLogin,
|
||||
ssoIdentityProviders: preferredLoginMode.ssoIdentityProviders ?? [])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user