Add tests for loading Classic accounts.

Tidy up warnings and fix a few bugs that were revealed.
This commit is contained in:
Doug
2026-03-10 13:54:14 +00:00
committed by Doug
parent 06c6ed3b2d
commit b5f571bfe4
9 changed files with 156 additions and 41 deletions
@@ -605,7 +605,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
private func startAuthentication() {
let encryptionKeyProvider = EncryptionKeyProvider()
let classicAppManager = makeClassicAppManager()
let classicAppManager = ClassicAppManager()
let authenticationService = AuthenticationService(userSessionStore: userSessionStore,
encryptionKeyProvider: encryptionKeyProvider,
classicAppManager: classicAppManager,
@@ -630,19 +630,6 @@ 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")
@@ -675,7 +662,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
let authenticationService = AuthenticationService(userSessionStore: userSessionStore,
encryptionKeyProvider: EncryptionKeyProvider(),
classicAppManager: makeClassicAppManager(),
classicAppManager: ClassicAppManager(),
appSettings: appSettings,
appHooks: appHooks)
_ = await authenticationService.configure(for: userSession.clientProxy.homeserver, flow: .login)