Merge commit '80bda1906235b6007b98f18fb13681fff587f4a3' into feature/basis_update_192

# Conflicts:
#	Config/AppVersion.xcconfig
#	Config/BuildSettings.swift
#	DesignKit/Source/ColorsSwiftUI.swift
#	DesignKit/Source/FontsSwiftUI.swift
#	DesignKit/Source/ThemeV2.swift
#	DesignKit/Variants/Colors/Dark/DarkColors.swift
#	DesignKit/Variants/Colors/Light/LightColors.swift
#	Podfile.lock
#	Riot/Assets/de.lproj/InfoPlist.strings
#	Riot/Assets/de.lproj/Vector.strings
#	Riot/Assets/en.lproj/Vector.strings
#	Riot/Generated/Images.swift
#	Riot/Generated/Strings.swift
#	Riot/Managers/PushNotification/PushNotificationService.m
#	Riot/Managers/Settings/RiotSettings.swift
#	Riot/Modules/Common/Recents/DataSources/RecentsDataSource.h
#	Riot/Modules/Common/Recents/RecentsViewController.m
#	Riot/Modules/Communities/Home/GroupHomeViewController.m
#	Riot/Modules/Room/RoomViewController.m
#	Riot/Modules/SetPinCode/PinCodePreferences.swift
#	Riot/Modules/Settings/SettingsViewController.m
#	Riot/Modules/TabBar/MasterTabBarController.h
#	Riot/Modules/TabBar/MasterTabBarController.m
#	Riot/Modules/TabBar/TabBarCoordinator.swift
#	fastlane/Fastfile
#	project.yml
This commit is contained in:
Frank Rotermund
2022-09-19 14:42:25 +02:00
508 changed files with 12777 additions and 9549 deletions
@@ -60,6 +60,8 @@ class AuthenticationService: NSObject {
private(set) var loginWizard: LoginWizard?
/// The current registration wizard or `nil` if `startFlow` hasn't been called for `.registration`.
private(set) var registrationWizard: RegistrationWizard?
/// The provisioning link the service is currently configured with.
private(set) var provisioningLink: UniversalLink?
/// The authentication service's delegate.
weak var delegate: AuthenticationServiceDelegate?
@@ -110,6 +112,9 @@ class AuthenticationService: NSObject {
state = AuthenticationState(flow: flow,
homeserverAddress: hsUrl ?? BuildSettings.serverConfigDefaultHomeserverUrlString,
identityServer: isUrl ?? BuildSettings.serverConfigDefaultIdentityServerUrlString)
// store the link to override the default homeserver address.
provisioningLink = universalLink
delegate?.authenticationService(self, didUpdateStateWithLink: universalLink)
} else {
// logged in
@@ -133,8 +138,15 @@ class AuthenticationService: NSObject {
MXKAccountManager.shared().activeAccounts?.first?.mxSession
}
func startFlow(_ flow: AuthenticationFlow, for homeserverAddress: String) async throws {
var (client, homeserver) = try await loginFlow(for: homeserverAddress)
/// Set up the service to start a new authentication flow.
/// - Parameters:
/// - flow: The flow to be started (login or register).
/// - 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
var (client, homeserver) = try await loginFlow(for: address)
let loginWizard = LoginWizard(client: client, sessionCreator: sessionCreator)
self.loginWizard = loginWizard
@@ -179,8 +191,13 @@ class AuthenticationService: NSObject {
loginWizard = nil
registrationWizard = nil
softLogoutCredentials = nil
if useDefaultServer {
provisioningLink = nil
}
// The previously used homeserver is re-used as `startFlow` will be called again a replace it anyway.
// 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 identityServer = state.identityServer
self.state = AuthenticationState(flow: .login,
@@ -52,7 +52,9 @@ enum LoginMode {
var ssoIdentityProviders: [SSOIdentityProvider]? {
switch self {
case .sso(let ssoIdentityProviders), .ssoAndPassword(let ssoIdentityProviders):
return ssoIdentityProviders
// Provide a backup for homeservers that support SSO but don't offer any identity providers
// https://spec.matrix.org/latest/client-server-api/#client-login-via-sso
return ssoIdentityProviders.count > 0 ? ssoIdentityProviders : [SSOIdentityProvider(id: "", name: "SSO", brand: nil, iconURL: nil)]
default:
return nil
}