Add @MainActor to some of the hook points.

This commit is contained in:
Doug
2025-11-14 14:05:38 +00:00
committed by Stefan Ceriu
parent 449349ce36
commit 022bc76c52
8 changed files with 35 additions and 33 deletions
@@ -9,7 +9,7 @@
import Compound
protocol CompoundHookProtocol {
func override(colors: CompoundColors, uiColors: CompoundUIColors)
@MainActor func override(colors: CompoundColors, uiColors: CompoundUIColors)
}
struct DefaultCompoundHook: CompoundHookProtocol {
@@ -15,11 +15,11 @@ enum RemoteSettingsError: Error {
protocol RemoteSettingsHookProtocol {
#if IS_MAIN_APP
func initializeCache(using client: ClientProtocol, applyingTo appSettings: CommonSettingsProtocol) async -> Result<Void, RemoteSettingsError>
@MainActor func initializeCache(using client: ClientProtocol, applyingTo appSettings: CommonSettingsProtocol) async -> Result<Void, RemoteSettingsError>
func updateCache(using client: ClientProtocol) async
func reset(_ appSettings: CommonSettingsProtocol)
@MainActor func reset(_ appSettings: CommonSettingsProtocol)
#endif
func loadCache(forHomeserver homeserver: String, applyingTo appSettings: CommonSettingsProtocol)
@MainActor func loadCache(forHomeserver homeserver: String, applyingTo appSettings: CommonSettingsProtocol)
}
struct DefaultRemoteSettingsHook: RemoteSettingsHookProtocol {
@@ -113,7 +113,7 @@ class UserSessionStore: UserSessionStoreProtocol {
}
let homeserverURL = credentials.restorationToken.session.homeserverUrl
appHooks.remoteSettingsHook.loadCache(forHomeserver: homeserverURL, applyingTo: appSettings)
await appHooks.remoteSettingsHook.loadCache(forHomeserver: homeserverURL, applyingTo: appSettings)
let builder = ClientBuilder
.baseBuilder(httpProxy: URL(string: homeserverURL)?.globalProxy,