Make the remote settings hook usable within the app extensions. (#4342)

This commit is contained in:
Doug
2025-07-22 17:09:53 +01:00
committed by GitHub
parent f65b191c8a
commit b7867dac85
20 changed files with 245 additions and 139 deletions

View File

@@ -117,6 +117,7 @@ class UserSessionStore: UserSessionStoreProtocol {
}
let homeserverURL = credentials.restorationToken.session.homeserverUrl
appHooks.remoteSettingsHook.loadCache(forHomeserver: homeserverURL, applyingTo: appSettings)
let builder = ClientBuilder
.baseBuilder(httpProxy: URL(string: homeserverURL)?.globalProxy,
@@ -134,11 +135,12 @@ class UserSessionStore: UserSessionStoreProtocol {
do {
let client = try await builder.build()
try await client.restoreSession(session: credentials.restorationToken.session)
MXLog.info("Set up session for user \(credentials.userID) at: \(credentials.restorationToken.sessionDirectories)")
Task(priority: .low) { await appHooks.remoteSettingsHook.updateCache(using: client) }
return try await .success(setupProxyForClient(client, needsSlidingSyncMigration: credentials.restorationToken.needsSlidingSyncMigration))
} catch UserSessionStoreError.failedSettingUpClientProxy(let error) {
// If this has failed, there is likely something wrong with the creation of the sync service