mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 01:19:33 +00:00
Make storeUserProfile main-safe instead of wrapping getUserProfile
This commit is contained in:
committed by
Benoit Marty
parent
8912341439
commit
d5780507c9
+2
-4
@@ -519,20 +519,18 @@ class RustMatrixClient(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getUserProfile(): Result<MatrixUser> = withContext(sessionDispatcher) {
|
override suspend fun getUserProfile(): Result<MatrixUser> = getProfile(sessionId)
|
||||||
getProfile(sessionId)
|
|
||||||
.onSuccess { matrixUser ->
|
.onSuccess { matrixUser ->
|
||||||
// Also update our session storage
|
// Also update our session storage
|
||||||
_userProfile.emit(matrixUser)
|
_userProfile.emit(matrixUser)
|
||||||
storeUserProfile(matrixUser)
|
storeUserProfile(matrixUser)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store the user profile in the session storage, including a base64 encoded thumbnail of the avatar,
|
* Store the user profile in the session storage, including a base64 encoded thumbnail of the avatar,
|
||||||
* so that the avatar can be rendered without having to use this client.
|
* so that the avatar can be rendered without having to use this client.
|
||||||
*/
|
*/
|
||||||
private suspend fun storeUserProfile(matrixUser: MatrixUser) {
|
private suspend fun storeUserProfile(matrixUser: MatrixUser): Unit = withContext(sessionDispatcher) {
|
||||||
val avatarUrl = matrixUser.avatarUrl
|
val avatarUrl = matrixUser.avatarUrl
|
||||||
val storedSession = sessionStore.getSession(sessionId.value)
|
val storedSession = sessionStore.getSession(sessionId.value)
|
||||||
val avatarData = when {
|
val avatarData = when {
|
||||||
|
|||||||
Reference in New Issue
Block a user