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

Send read receipts based on timeline scroll position #152

Merged
merged 8 commits into from
Oct 1, 2024

Conversation

alanpoon
Copy link
Contributor

@alanpoon alanpoon commented Sep 19, 2024

Rework of #124

  1. Removed lazy_static
  2. Replaced thread with makepad timer
  3. Removed de-duplicate logic when sending read receipt
  4. Removed un-neccessary SignalToUI
  5. Moved fields into TimelineUiState

Closes #86

@alanpoon
Copy link
Contributor Author

PR for #86

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.

thanks for the PR!

One request -- can you follow standard whitespace conventions, like a space after a comma? Without that, it's hard to read the code easily.

I left a few detailed comments.

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
src/home/room_screen.rs Outdated Show resolved Hide resolved
src/sliding_sync.rs Outdated Show resolved Hide resolved
src/sliding_sync.rs Outdated Show resolved Hide resolved
src/sliding_sync.rs Outdated Show resolved Hide resolved
src/home/room_screen.rs Outdated Show resolved Hide resolved
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.

I did some minor cleanup just to improve readability, so take a look at those minor changes to see what sort of code style and whitespace conventions we're looking for. The logic for tracking which events have been read is still needlessly complicated, and also rather inefficient, especially with the repeated population of big hashmaps and subsequent iteration over them.
I still believe that all you really need to do is start a 5-second timeout timer whenever scrolling stops, and then after the timer has reached its timeout deadline, send the read receipts for the last visible event.

That being said, your approach technically works despite being overly complicated, so in the interest of time I'm going to accept and merge it in, and we'll save other improvements for the future.

I left a few comments that mostly target C vs Rust coding styles and inefficiencies scattered throughout.

Please submit another PR to clean things up in the future.

src/home/room_screen.rs Show resolved Hide resolved
src/home/room_screen.rs Show resolved Hide resolved
src/home/room_screen.rs Show resolved Hide resolved
src/home/room_screen.rs Show resolved Hide resolved
src/home/room_screen.rs 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 kevinaboos changed the title Send user read receipts based on scroll position #86 Send read receipts based on timeline scroll position Oct 1, 2024
@kevinaboos kevinaboos merged commit f522a1a into project-robius:main Oct 1, 2024
1 check passed
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.

Send user read receipts based on scroll position
2 participants