Add support for reading accounts from Element Classic.

This commit is contained in:
Mauro Romito
2025-10-10 16:44:26 +02:00
committed by Doug
parent 21a1c8d4a3
commit 44303bdee7
18 changed files with 775 additions and 3 deletions

View File

@@ -605,8 +605,10 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
private func startAuthentication() {
let encryptionKeyProvider = EncryptionKeyProvider()
let classicAppManager = makeClassicAppManager()
let authenticationService = AuthenticationService(userSessionStore: userSessionStore,
encryptionKeyProvider: encryptionKeyProvider,
classicAppManager: classicAppManager,
appSettings: appSettings,
appHooks: appHooks)
@@ -628,6 +630,19 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
}
}
private func makeClassicAppManager() -> ClassicAppManagerProtocol? {
guard let classicAppGroupIdentifier = InfoPlistReader.main.classicAppGroupIdentifier,
let classicAppKeychainServiceIdentifier = InfoPlistReader.main.classicAppKeychainServiceIdentifier,
let classicAppKeychainAccessGroupIdentifier = InfoPlistReader.main.classicAppKeychainAccessGroupIdentifier else {
MXLog.info("Classic App IDs not set, manager disabled.")
return nil
}
return ClassicAppManager(classicAppGroupIdentifier: classicAppGroupIdentifier,
classicAppKeychainServiceIdentifier: classicAppKeychainServiceIdentifier,
classicAppKeychainAccessGroupIdentifier: classicAppKeychainAccessGroupIdentifier)
}
private func runPostSessionSetupTasks() async {
guard let userSession, let userSessionFlowCoordinator else {
fatalError("User session not setup")
@@ -660,6 +675,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
let authenticationService = AuthenticationService(userSessionStore: userSessionStore,
encryptionKeyProvider: EncryptionKeyProvider(),
classicAppManager: makeClassicAppManager(),
appSettings: appSettings,
appHooks: appHooks)
_ = await authenticationService.configure(for: userSession.clientProxy.homeserver, flow: .login)