mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Use the stored avatar thumbnail as a fallback for other accounts
Add an optional thumbnail to `MatrixUser` and `AvatarData`, filled from the session database for the other accounts in the room list header, the settings and the account selection screen. `ImageAvatar` renders this thumbnail instead of the initial letter while the avatar is loading or when it fails to load, for instance when the homeserver of the current account is not federated with the one of the other account. Fixes #5571 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
@@ -20,6 +20,7 @@ fun MatrixUser.getAvatarData(size: AvatarSize) = AvatarData(
|
||||
name = displayName,
|
||||
url = avatarUrl,
|
||||
size = size,
|
||||
thumbnail = avatarThumbnail,
|
||||
)
|
||||
|
||||
fun MatrixUser.getBestName(): String {
|
||||
|
||||
+2
@@ -33,12 +33,14 @@ class MatrixUserExtensionsTest : RobolectricTest() {
|
||||
userId = A_USER_ID,
|
||||
displayName = "displayName",
|
||||
avatarUrl = "avatarUrl",
|
||||
avatarThumbnail = "avatarThumbnail",
|
||||
)
|
||||
val expected = AvatarData(
|
||||
id = A_USER_ID.value,
|
||||
name = "displayName",
|
||||
url = "avatarUrl",
|
||||
size = AvatarSize.UserHeader,
|
||||
thumbnail = "avatarThumbnail",
|
||||
)
|
||||
assertThat(matrixUser.getAvatarData(AvatarSize.UserHeader)).isEqualTo(expected)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user