Skip to content
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

[AND-313] Fix the Avatar loading #5625

Merged
merged 11 commits into from
Feb 17, 2025
Merged

[AND-313] Fix the Avatar loading #5625

merged 11 commits into from
Feb 17, 2025

Conversation

andremion
Copy link
Contributor

@andremion andremion commented Feb 10, 2025

🎯 Goal

Increase the stability of fading/loading image of the user avatars.

🛠 Implementation details

It seems the CrossfadePlugin is causing this instability. After spending some time debugging, the best option might be to stop using StreamImage, handle the painter states, and use ImageAvatar or InitialsAvatar according to the states.

A positive side-effect of that refactoring is that now we don't need to use a preview avatar anymore. Hence, we can update the snapshots to have the user's initials instead of the preview avatar.

Another positive side-effect is that we could identify a bug in the avatars of Poll components, where the user's initials were not fully displayed due to the font size.

Also, another fix was on the click indicator of user avatars, as now we can see a proper ripple effect.

🎨 UI Changes

Before After
fading.issue.webm
avatar.fading.fix.webm

Avatar click ripple fix

Before After
click.ripple.issue.webm
click.ripple.fix.webm

Poll InitialsAvatar fix

Before After
poll.issue.webm
poll.fix.webm

🎉 GIF

- Fix the fading issue.
- Stop using preview avatar so that we can have snapshot tests doing the same as in production.
Copy link
Contributor

github-actions bot commented Feb 10, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 3.17 MB 3.17 MB 0.00 MB 🟢
stream-chat-android-offline 3.38 MB 3.38 MB 0.00 MB 🟢
stream-chat-android-ui-components 7.87 MB 7.87 MB 0.00 MB 🟢
stream-chat-android-compose 8.75 MB 8.75 MB 0.00 MB 🟢

@andremion andremion added compose Jetpack Compose bug Something isn't working labels Feb 10, 2025
@andremion andremion changed the title [AND-313] Fix the Avatar fading [AND-313] Fix the Avatar loading Feb 10, 2025
@andremion andremion marked this pull request as ready for review February 10, 2025 16:37
@andremion andremion requested a review from a team as a code owner February 10, 2025 16:37
Copy link
Member

@skydoves skydoves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Out of my curiosity, what if we wrap the StreamImage using Crossfade without using CrossfadePlugin? If this makes any problems, this issue should be fixed on the library site.

@andremion
Copy link
Contributor Author

Looks good to me! Out of my curiosity, what if we wrap the StreamImage using Crossfade without using CrossfadePlugin? If this makes any problems, this issue should be fixed on the library site.

I believe Crossfade is designed to switch (based on states) between layouts with a crossfade animation. It shouldn't work to wrap a single child. But I gave a try anyway.

Screenshot 2025-02-14 at 08 25 10
Screen_recording_20250214_082546.webm

@andremion andremion enabled auto-merge (squash) February 17, 2025 11:15
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
59.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@andremion andremion merged commit 78ffd80 into develop Feb 17, 2025
12 of 13 checks passed
@andremion andremion deleted the AND-313-avatar-fading-fix branch February 17, 2025 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compose Jetpack Compose
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants