mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-28 20:26:57 +02:00
Release 2.0.0
This commit is contained in:
+6
@@ -34,6 +34,8 @@ protocol AuthenticationRestClient: AnyObject {
|
||||
func login(parameters: LoginParameters) async throws -> MXCredentials
|
||||
func login(parameters: [String: Any]) async throws -> MXCredentials
|
||||
|
||||
func generateLoginToken() async throws -> MXLoginToken
|
||||
|
||||
// MARK: Registration
|
||||
|
||||
var registerFallbackURL: URL { get }
|
||||
@@ -48,6 +50,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 { }
|
||||
|
||||
+9
-5
@@ -109,8 +109,8 @@ class AuthenticationService: NSObject {
|
||||
// not logged in
|
||||
// update the state with given HS and IS addresses
|
||||
state = AuthenticationState(flow: flow,
|
||||
homeserverAddress: hsUrl ?? BuildSettings.serverConfigDefaultHomeserverUrlString,
|
||||
identityServer: isUrl ?? BuildSettings.serverConfigDefaultIdentityServerUrlString)
|
||||
homeserverAddress: hsUrl ?? BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString,
|
||||
identityServer: isUrl ?? BWIBuildSettings.shared.serverConfigDefaultIdentityServerUrlString)
|
||||
|
||||
// store the link to override the default homeserver address.
|
||||
provisioningLink = universalLink
|
||||
@@ -143,7 +143,7 @@ class AuthenticationService: NSObject {
|
||||
/// - homeserverAddress: The homeserver to start the flow for, or `nil` to use the default.
|
||||
/// If a provisioning link has been set, it will override the default homeserver when passing `nil`.
|
||||
func startFlow(_ flow: AuthenticationFlow, for homeserverAddress: String? = nil) async throws {
|
||||
let address = homeserverAddress ?? provisioningLink?.homeserverUrl ?? BuildSettings.serverConfigDefaultHomeserverUrlString
|
||||
let address = homeserverAddress ?? provisioningLink?.homeserverUrl ?? BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString
|
||||
|
||||
var (client, homeserver) = try await loginFlow(for: address)
|
||||
|
||||
@@ -197,7 +197,7 @@ class AuthenticationService: NSObject {
|
||||
|
||||
// This address will be replaced when `startFlow` is called, but for
|
||||
// completeness revert to the default homeserver if requested anyway.
|
||||
let address = useDefaultServer ? BuildSettings.serverConfigDefaultHomeserverUrlString : state.homeserver.addressFromUser ?? state.homeserver.address
|
||||
let address = useDefaultServer ? BWIBuildSettings.shared.serverConfigDefaultHomeserverUrlString : state.homeserver.addressFromUser ?? state.homeserver.address
|
||||
let identityServer = state.identityServer
|
||||
state = AuthenticationState(flow: .login,
|
||||
homeserverAddress: address,
|
||||
@@ -260,9 +260,13 @@ 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