mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +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:
@@ -14,7 +14,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
|
||||
// MARK: Authentication
|
||||
|
||||
#if IS_MAIN_APP
|
||||
func makeAuthenticationClient(homeserverAddress: String,
|
||||
func makeAuthenticationClient(serverNameOrBaseURL: String,
|
||||
sessionDirectories: SessionDirectories,
|
||||
passphrase: String,
|
||||
clientSessionDelegate: ClientSessionDelegate,
|
||||
@@ -29,12 +29,12 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
|
||||
.enableAutomaticBackPagination(enableAutomaticBackPagination: appSettings.automaticBackPaginationEnabled)
|
||||
.sqliteStore(config: .init(dataPath: sessionDirectories.dataPath, cachePath: sessionDirectories.cachePath)
|
||||
.passphrase(passphrase: passphrase))
|
||||
.serverNameOrHomeserverUrl(serverNameOrUrl: homeserverAddress)
|
||||
.serverNameOrHomeserverUrl(serverNameOrUrl: serverNameOrBaseURL)
|
||||
|
||||
return try await build(builder, for: .authentication, appHooks: appHooks)
|
||||
}
|
||||
|
||||
func makeInMemoryClient(homeserverAddress: String,
|
||||
func makeInMemoryClient(serverNameOrBaseURL: String,
|
||||
clientSessionDelegate: ClientSessionDelegate,
|
||||
appSettings: AppSettings,
|
||||
appHooks: AppHooks) async throws -> ClientProtocol {
|
||||
@@ -45,7 +45,7 @@ nonisolated struct ClientFactory: ClientFactoryProtocol {
|
||||
enableOnlySignedDeviceIsolationMode: appSettings.enableOnlySignedDeviceIsolationMode,
|
||||
threadsEnabled: appSettings.threadsEnabled)
|
||||
.inMemoryStore()
|
||||
.serverNameOrHomeserverUrl(serverNameOrUrl: homeserverAddress)
|
||||
.serverNameOrHomeserverUrl(serverNameOrUrl: serverNameOrBaseURL)
|
||||
|
||||
return try await build(builder, for: .classicAppAccount, appHooks: appHooks)
|
||||
}
|
||||
|
||||
@@ -12,14 +12,14 @@ nonisolated protocol ClientFactoryProtocol {
|
||||
// MARK: Authentication
|
||||
|
||||
#if IS_MAIN_APP
|
||||
func makeAuthenticationClient(homeserverAddress: String,
|
||||
func makeAuthenticationClient(serverNameOrBaseURL: String,
|
||||
sessionDirectories: SessionDirectories,
|
||||
passphrase: String,
|
||||
clientSessionDelegate: ClientSessionDelegate,
|
||||
appSettings: AppSettings,
|
||||
appHooks: AppHooks) async throws -> ClientProtocol
|
||||
|
||||
func makeInMemoryClient(homeserverAddress: String,
|
||||
func makeInMemoryClient(serverNameOrBaseURL: String,
|
||||
clientSessionDelegate: ClientSessionDelegate,
|
||||
appSettings: AppSettings,
|
||||
appHooks: AppHooks) async throws -> ClientProtocol
|
||||
|
||||
@@ -67,7 +67,7 @@ class HomeserverHistoryManager {
|
||||
/// in all lowercase. This is the list that matches are made against.
|
||||
private func updateCachedServers() {
|
||||
let previous = appSettings.previousServers.map { $0.lowercased() }
|
||||
let defaultProviders = appSettings.accountProviders.map { $0.lowercased() }
|
||||
let defaultProviders = appSettings.accountProviders.map { $0.serverNameOrBaseURL.lowercased() }
|
||||
|
||||
cachedServers = previous + defaultProviders
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user