-
Notifications
You must be signed in to change notification settings - Fork 46
Improve SpaceLobbyScreen with avatar caching, info display, and state persistence #665
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
base: main
Are you sure you want to change the base?
Improve SpaceLobbyScreen with avatar caching, info display, and state persistence #665
Conversation
…UI state persistence Changes: - Use avatar_cache to display room/space avatars instead of always showing initials - Show join status (Invited, Left, Knocked, Banned) for rooms user hasn't joined - Show Public/Private/Knock-to-join based on join_rule - Display truncated topic in the info label - Save/restore expanded_spaces state when switching between spaces - Remove #[allow(unused)] from fields that are now used This addresses most items from issue project-robius#664, except: - "Suggested" badge: SpaceRoom struct in matrix-sdk-ui doesn't have this field yet - Header space info: would need architectural changes to fetch parent space details
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 @AndyBodnar, and welcome to the project! Wow, you're quick! I think you submitted this PR only a couple of hours after I created the issue, haha.
In general, things look pretty good, I appreciate that you followed the existing code usage/style patterns. Typically I wouldn't review PRs that haven't been tested at runtime, but I'll make an exception for your first submission.
I'm actually happy to accept this PR as-is since I'm about to completely restructure the SpaceLobbyScreen anyway. There are a few issues but nothing that is a serious blocker, just some things that will need to be fixed in the future:
- Pulling the avatar from the cache does work, but there are two things that can be improved there.
- In the SpaceLobbyScreen's event handler, we need to explicitly handle
Event::Signalby handling any pending avatar_cache updates (since we now use that cache) and then redraw if there were any. Otherwise, the avatars don't actually get shown when they're fetched, they don't show up until you close/re-open the SpaceLobbyScreen. - Just an optimization: once we fetch the avatar from the cache, we should store it locally in the
SpaceRoomInfo'room_avatarfield.
- In the SpaceLobbyScreen's event handler, we need to explicitly handle
- As with the
RoomScreen, we actually need to save the UI state when the SpaceLobbyScreen is destroyed, not just when showing a new one. Currently the state never actually gets saved, so there's nothing to restore. - Truncating a string (e.g., the topic) is an okay approach if you know that you always want it to be limited to, say, 50 characters, but in general it's best to allow the Label to truncate it via
flow: Rightandwrap: Ellipsis(which is currently broken in makepad but will be fixed shortly). - Displaying Public/Private for each subspace is actually a bit crowded and unnecessary. On second thought, I think we should probably just display that for the top-level main space, similar to what Element does.
Let me know if you want to fix these things in this PR, otherwise I can just merge it as-is and make the improvements soon after.
- Add Event::Signal handling for avatar cache updates - Store avatar data locally in SpaceRoomInfo (Arc<[u8]>) - Make save_current_state() public for external callers - Remove manual topic truncation (let Label handle it) - Remove Public/Private display for subspaces
should be good to merge now after you review new changes.. |
This addresses most of the improvements from #663's follow-up issue #664.
What changed:
Room/space avatars now load from the avatar cache instead of always showing initials. When you scroll through the space lobby, avatars will progressively load as they're fetched.
Each entry now shows more info in the subtitle: join status for rooms you haven't joined yet (Invited, Left, Knocked, Banned), visibility (Public, Private, or Knock to join), and a truncated topic if one exists.
Expanded/collapsed state is now saved when you navigate away from a space and restored when you come back. So if you had a subspace expanded, it stays expanded.
What I skipped:
Testing:
Closes #664