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

Location avatar #8749

Merged
merged 7 commits into from
Feb 6, 2024
Merged

Location avatar #8749

merged 7 commits into from
Feb 6, 2024

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Feb 5, 2024

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

This change ensure that the user Avatar used in location Event rendering is the same avatar than the avatar of the user in the room. Previously the application was using the Avatar from the user profile, but it can happen that the profile is not loaded into the DB, and so the fallback avatar was used (with the userId first later). As a consequence, if the user has set a avatar just on the current room, it will also be used.

This PR also improves how the cache works in LocationPinProvider. Rely on Glide cache, limit size, and invalidate cache in case of error, then success retrieving avatar data. Also use UserItem for the cache key, to invalidate cache if user avatar / display name change. So this PR also fix a refresh issue if user change their avatar.

This PR also fix a rendering issue of the initial avatar when long clicking on a location Event.

Motivation and context

User user avatar in Location share Event.

Parity with Element Web.

Screenshots / GIFs

Tests

  • Have a room with 2 members Alice and Bob.
  • Invite Charlie to the room, Charlie has a profile avatar
  • Charlie share their location to the room.
  • Without this change, Alice and Bob do not see Charlie's avatar in the location Event, because Charlie's profile is not loaded. Charlie avatar is correctly rendered at the sender details above the message.
  • With this change, Charlies's avatar is correctly rendered on the map, since the sender avatar is known and is used to render the location Event

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

bmarty and others added 7 commits February 2, 2024 13:56
In particular, use the Glide cache, and ensure that if an error occurs and later the avatar can be retrieved, the cache will be replaced.
Also limit cache size to 32.
Also use UserItem as a key, instead of just the userId, so that if displayName or avatarUrl change, there will be not cache hit.
@bmarty bmarty requested a review from ganfra February 5, 2024 08:46
Copy link
Member

@ganfra ganfra 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!

@bmarty bmarty merged commit e0c51bd into develop Feb 6, 2024
13 of 14 checks passed
@bmarty bmarty deleted the feature/bma/locationAvatar branch February 6, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants