-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fall back to initials avatar when image avatar doesn't work #2667
Conversation
Thank you for your contribution! Here are a few things to check in the PR to ensure it's reviewed as quickly as possible:
|
bd7fc38
to
beaa822
Compare
Initially I had it implemented such that it would only fallback on error, but actually it's nice to have also while loading if it takes a while to load the avatar.
beaa822
to
f704cca
Compare
I guess the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @SpiritCroc! Please see my answer about previews.
...system/src/main/kotlin/io/element/android/libraries/designsystem/components/avatar/Avatar.kt
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2667 +/- ##
===========================================
- Coverage 73.48% 73.48% -0.01%
===========================================
Files 1456 1456
Lines 35113 35126 +13
Branches 6733 6738 +5
===========================================
+ Hits 25804 25813 +9
Misses 5793 5793
- Partials 3516 3520 +4 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
Initially I had it implemented such that it would only fallback on error, but actually it's nice to have also while loading if it takes a while to load the avatar.
Type of change
Content
SubcomposeAsyncImage
allows us to render the image or something else based on the render state, so we can render the initials avatar if the image doesn't load successfullyMotivation and context
I heard in the Element X chat that Element wants to have this (I had this in SchildiChat for a while already)
Screenshots / GIFs
Imagine some name-based fallback avatars in the roomlist like before, but also for contacts with broken mxc url
Tests
/myroomavatar mxc://broken
on desktopTested devices
Checklist
Sign-off
Signed-off-by: Tobias Büttner [email protected]