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

Display read receipts next to each message as a row of Avatars for users who have seen that message #162

Merged
merged 85 commits into from
Jan 23, 2025

Conversation

alanpoon
Copy link
Contributor

@alanpoon alanpoon commented Sep 26, 2024

Fixes #153

  1. With tooltip indicating number of seen - mouse over
read_r_tooltip
  1. mouse out
read_receipt
  • Currently only supports Avatar with username. I need some advice how to put in Avatar with image.
  • Implemented max display of 4 avatars
  • Currently tooltip seems to be not able customize width and position. @jmbejar

@alanpoon alanpoon marked this pull request as ready for review September 27, 2024 04:20
@alanpoon alanpoon marked this pull request as draft September 28, 2024 12:31
@alanpoon
Copy link
Contributor Author

[WIP] Will try to change sequencer to follow GenUI's way of creating a list of widgets

@alanpoon
Copy link
Contributor Author

avatar read_receipt
  1. Modified set_avatar_and_get_username function to use &mut Avatar instead of AvatarRef
  2. Modified set_avatar_and_get_username function to take in an option of Avatar User profile. Read_receipts do not provide user profile. So the User Profile is gotten from the Sender cache.
  3. Added Caching for Avatar that is loaded with Image.

@alanpoon alanpoon marked this pull request as ready for review October 10, 2024 06:52
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

A great start, thanks!

I suggested some minor API changes that will make things clearer and less error-prone. After those changes are made, it should be ready to merge.

src/shared/avatar.rs Outdated Show resolved Hide resolved
src/home/room_read_receipt.rs Outdated Show resolved Hide resolved
src/home/room_screen.rs Outdated Show resolved Hide resolved
src/home/room_screen.rs Outdated Show resolved Hide resolved
src/profile/user_profile.rs Outdated Show resolved Hide resolved
src/profile/user_profile_cache.rs Outdated Show resolved Hide resolved
src/home/room_screen.rs Outdated Show resolved Hide resolved
src/home/room_screen.rs Outdated Show resolved Hide resolved
src/home/room_screen.rs Outdated Show resolved Hide resolved
@kevinaboos
Copy link
Member

  • Currently only supports Avatar with username. I need some advice how to put in Avatar with image.

Using the existing Avatar widget should work just fine. The reason you never get any proper Avatar profile info is because you always pass None into the set_avatar_and_get_username() function. If you're able to obtain the Avatar image therein (by grabbing it from the cache), then that function should automatically pick it up.

Alternatively, we can create a separate function (or further modify set_avatar_and_get_username()) to utilize the user profile and avatar caches if the passed-in avatar info is None or not-yet available.

@alanpoon alanpoon added waiting-on-review This issue is waiting to be reviewed waiting-on-author This issue is waiting on the original author for a response and removed waiting-on-author This issue is waiting on the original author for a response waiting-on-review This issue is waiting to be reviewed labels Jan 21, 2025
@alanpoon alanpoon added waiting-on-review This issue is waiting to be reviewed and removed waiting-on-author This issue is waiting on the original author for a response labels Jan 21, 2025
@kevinaboos
Copy link
Member

There is SignalToUi for enqueue_avatar_update already, so I don't think I can optimize it further.

Hmm, ok. Yeah, the only potential cause I could think of was a missing call to set the UI Signal, but if that's already there, then there might be a different cause for the delay. What I observed is a 10+ second delay between (1) a log statement that says the avatar/profile was fetched for a given user, and (2) the actual image being refreshed for the avatar.

Another cause of this might be how we cache whether a given event was drawn in the timeline. We might need another variable that tracks the draw status of the read receipts separately from that of the event's content and the event's user profile details.

In any case, we can make this improvement later and merge this in now, since the fundamental functionality appears to be working correctly.

Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

Code looks good! I've tested everything locally and it works well.

However, the UI layout of the AvatarRow is a bit inconsistent for different message types. For example, the Avatars are not all vertically aligned, so it looks a bit weird.
There's also still a lot of wasted space on the right side of the RoomScreen.

I think you could fix both of these layout issues by setting the x-alignment of the AvatarRow to the far right side of its parent view in the room screen, and then using a right-margin of 10 or 20.

The final issue would be that the AvatarRow should be displayed towards the bottom of each message, not towards the top of it. This is particularly noticeable on regular (non-Condensed) messages, like the ones from 8:59am, 10:02am, and 10:10am in this screenshot.

image

@kevinaboos kevinaboos added waiting-on-author This issue is waiting on the original author for a response and removed waiting-on-review This issue is waiting to be reviewed labels Jan 21, 2025
@kevinaboos
Copy link
Member

Oh, and also feel free to ignore the positioning of the Message action bar (the small Reply button that pops up when you hover over a message). I am in the process of removing that, so you don't need to reserve any space for it on the right side of the room screen.

@alanpoon
Copy link
Contributor Author

Code looks good! I've tested everything locally and it works well.

However, the UI layout of the AvatarRow is a bit inconsistent for different message types. For example, the Avatars are not all vertically aligned, so it looks a bit weird. There's also still a lot of wasted space on the right side of the RoomScreen.

I think you could fix both of these layout issues by setting the x-alignment of the AvatarRow to the far right side of its parent view in the room screen, and then using a right-margin of 10 or 20.

The final issue would be that the AvatarRow should be displayed towards the bottom of each message, not towards the top of it. This is particularly noticeable on regular (non-Condensed) messages, like the ones from 8:59am, 10:02am, and 10:10am in this screenshot.

image

Sped up the avatar loading, and right align the read receipt
Screenshot 2025-01-22 at 2 12 03 PM

@alanpoon alanpoon added waiting-on-review This issue is waiting to be reviewed and removed waiting-on-author This issue is waiting on the original author for a response labels Jan 22, 2025
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

Looking good, it's almost there!

It seems like there is a slight issue with the way you defined the new Views that wrap around the ReactionList and AvatarRow. It's causing weird whitespace gaps like this:
image

and this:
image

Seems like it's mostly a problem with CondensedMessage, CondensedImageMessage, and SmallStateEvent (more so than regular Message and ImageMessage views, but they might also need adjustment). Make sure you try it out with various different widths of the RoomScreen (which is easiest to do by making the RoomsList wider).

In general, the AvatarRow should go at the very bottom right of an event view, and the Reaction list should go directly beneath the content of the event (like it was previously, before this PR).

I made a small commit that adjusted some things.

src/utils.rs Outdated Show resolved Hide resolved
@kevinaboos kevinaboos added waiting-on-author This issue is waiting on the original author for a response and removed waiting-on-review This issue is waiting to be reviewed labels Jan 23, 2025
@alanpoon alanpoon added waiting-on-review This issue is waiting to be reviewed and removed waiting-on-author This issue is waiting on the original author for a response labels Jan 23, 2025
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

Fanstastic work, thanks so much! Can confirm that everything is working well.

@kevinaboos kevinaboos merged commit d955ec3 into project-robius:main Jan 23, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-review This issue is waiting to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display read receipts for other users on the bottom right of a message/event
2 participants