implemented the LiveLocationManager as part of the user session and setup of permissions in the plist.

This commit is contained in:
Mauro Romito
2026-03-31 02:09:25 +02:00
committed by Mauro
parent 3ba636aa37
commit b31d0cad75
9 changed files with 200 additions and 6 deletions
@@ -58,7 +58,7 @@ class UserSessionStore: UserSessionStoreProtocol {
switch await restorePreviousLogin(credentials) {
case .success(let clientProxy):
return .success(buildUserSessionWithClient(clientProxy))
return await .success(buildUserSessionWithClient(clientProxy))
case .failure(let error):
MXLog.error("Failed restoring login with error: \(error)")
@@ -84,7 +84,7 @@ class UserSessionStore: UserSessionStoreProtocol {
MXLog.info("Set up session for user \(userID) at: \(sessionDirectories)")
return .success(buildUserSessionWithClient(clientProxy))
return await .success(buildUserSessionWithClient(clientProxy))
} catch {
MXLog.error("Failed creating user session with error: \(error)")
return .failure(.failedSettingUpSession)
@@ -103,16 +103,22 @@ class UserSessionStore: UserSessionStoreProtocol {
// MARK: - Private
private func buildUserSessionWithClient(_ clientProxy: ClientProxyProtocol) -> UserSessionProtocol {
private func buildUserSessionWithClient(_ clientProxy: ClientProxyProtocol) async -> UserSessionProtocol {
let mediaProvider = MediaProvider(mediaLoader: clientProxy.mediaLoader,
imageCache: .onlyInMemory,
homeserverReachabilityPublisher: clientProxy.homeserverReachabilityPublisher)
let voiceMessageMediaManager = VoiceMessageMediaManager(mediaProvider: mediaProvider)
let liveLocationManager = await MainActor.run {
LiveLocationManager(clientProxy: clientProxy,
appSettings: appSettings)
}
return UserSession(clientProxy: clientProxy,
mediaProvider: mediaProvider,
voiceMessageMediaManager: voiceMessageMediaManager)
voiceMessageMediaManager: voiceMessageMediaManager,
liveLocationManager: liveLocationManager)
}
private func restorePreviousLogin(_ credentials: KeychainCredentials) async -> Result<ClientProxyProtocol, UserSessionStoreError> {