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

Improve avatar rendering #3642

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Oct 10, 2024

Content

This PR takes care of using a single thumbnail request size, so caching works properly.
Indeed, according to the matrix specs :

Servers SHOULD produce thumbnails with the following dimensions and methods:
32x32, crop
96x96, crop
320x240, scale
640x480, scale
800x600, scale

For rendering avatar we could use crop, but it's not available in the rust sdk yet.
So instead, always use the smallest scale function ie. requesting with a size <= 240 pixels would makes sure we do.

This way, we'll be hitting the server only once per mxc url, and not for each size we've defined in our AvatarSize.

Motivation and context

Improve rendering by removing useless network calls.

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

@ganfra ganfra added the PR-Misc For other changes label Oct 10, 2024
@ganfra ganfra marked this pull request as ready for review October 10, 2024 09:55
@ganfra ganfra requested a review from a team as a code owner October 10, 2024 09:55
@ganfra ganfra requested review from jmartinesp and removed request for a team October 10, 2024 09:55
Copy link
Contributor

github-actions bot commented Oct 10, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/UfJiwj

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ganfra ganfra force-pushed the feature/fga/improve_avatar_rendering branch from 0d6c6a9 to e0d2eae Compare October 10, 2024 10:16
@ganfra ganfra enabled auto-merge October 10, 2024 10:17
@ganfra ganfra added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 10, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 10, 2024
@ganfra ganfra force-pushed the feature/fga/improve_avatar_rendering branch from e0d2eae to 2e631b1 Compare October 10, 2024 12:10
Copy link

sonarcloud bot commented Oct 10, 2024

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.

Project coverage is 82.83%. Comparing base (366db47) to head (2e631b1).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
...roid/libraries/matrix/ui/media/CoilMediaFetcher.kt 0.00% 2 Missing ⚠️
.../libraries/matrix/ui/media/ImageLoaderFactories.kt 0.00% 2 Missing ⚠️
...droid/libraries/matrix/ui/media/AvatatarDataExt.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3642   +/-   ##
========================================
  Coverage    82.82%   82.83%           
========================================
  Files         1747     1747           
  Lines        41742    41737    -5     
  Branches      5102     5102           
========================================
  Hits         34572    34572           
+ Misses        5355     5350    -5     
  Partials      1815     1815           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ganfra ganfra added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 10, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 10, 2024
@ganfra ganfra merged commit 7a85cdd into develop Oct 10, 2024
29 of 30 checks passed
@ganfra ganfra deleted the feature/fga/improve_avatar_rendering branch October 10, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Misc For other changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants