mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Add an AccountProvider type and use it within the authentication flow. (#6103)
* Add an AccountProvider type and use it within AppSettings. * Use the AccountProvider type within the Authentication flow too. * Fix unit test compilation with Swift 6.4 * Make sure defaultAccountProvider takes allowOtherAccountProviders into account. * Document a caveat on using AuthenticationService.homeserver.value.accountProvider.
This commit is contained in:
@@ -26,7 +26,7 @@ enum AuthenticationServiceError: Error, Equatable {
|
||||
|
||||
case invalidServer
|
||||
case invalidCredentials
|
||||
case invalidHomeserverAddress
|
||||
case invalidServerNameOrBaseURL
|
||||
case invalidWellKnown(String)
|
||||
case slidingSyncNotAvailable
|
||||
case loginNotSupported
|
||||
@@ -39,12 +39,14 @@ enum AuthenticationServiceError: Error, Equatable {
|
||||
|
||||
protocol AuthenticationServiceProtocol: QRCodeLoginServiceProtocol {
|
||||
/// The currently configured homeserver.
|
||||
///
|
||||
/// **Note:** The value's `accountProvider` will always be `.generic` after calling `configure(for:flow:)`.
|
||||
var homeserver: CurrentValuePublisher<LoginHomeserver, Never> { get }
|
||||
/// The type of flow the service is currently configured with.
|
||||
var flow: AuthenticationFlow { get }
|
||||
|
||||
/// Sets up the service for login on the specified homeserver address.
|
||||
func configure(for homeserverAddress: String, flow: AuthenticationFlow) async -> Result<Void, AuthenticationServiceError>
|
||||
/// Sets up the service for login or registration using the supplied server name or base URL.
|
||||
func configure(for serverNameOrBaseURL: String, flow: AuthenticationFlow) async -> Result<Void, AuthenticationServiceError>
|
||||
/// Performs login using OAuth for the current homeserver.
|
||||
func urlForOAuthLogin(loginHint: String?) async -> Result<OAuthAuthorizationDataProxy, AuthenticationServiceError>
|
||||
/// Asks the SDK to abort an ongoing OAuth login if we didn't get a callback to complete the request with.
|
||||
|
||||
Reference in New Issue
Block a user