Skip to content

Add unread messages marker#866

Open
Grafcube wants to merge 2 commits intocommetchat:mainfrom
Grafcube:unread-marker
Open

Add unread messages marker#866
Grafcube wants to merge 2 commits intocommetchat:mainfrom
Grafcube:unread-marker

Conversation

@Grafcube
Copy link
Copy Markdown
Contributor

Add a marker to indicate new messages since the last time the room was read. Some extra features along with this:

  • Jump to last read when a room is opened
    • Handle rate limiting and other errors when this happens
  • Double tap message to reply
  • Highlight messages replying to you or mentioning you

There were some situations where I got a RangeError but I couldn't figure out where it was happening. It was rare enough that it didn't cause any major problems but that also made it really hard to reproduce. If it does happen, it's easy enough to get around by clicking jump to latest.

Add a marker to indicate new messages since the last time the room was
read. Some extra features along with this:

- Jump to last read when a room is opened
  - Handle rate limiting and other errors when this happens
- Double tap message to reply
- Highlight messages replying to you or mentioning you
}

WidgetsBinding.instance.addPostFrameCallback((_) {
jumpToEvent(timeline.room.lastRead, highlight: false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jumping to the event post-frame causes a stutter when opening the timeline, as on the first visible frame the scroll location is different. it would be better to initialize to the correct position immediately, it should be possible by manipulating recentItemsCount

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I couldn't figure out how to fix this. Setting the offset directly doesn't really work because I couldn't reliably get it and calling the jump too early causes it to just not work or jump to the wrong event. I'm not sure how you mean for me to use recentItemsCount here, since the events could be of different heights and it doesn't account for the loading indicator.

@Grafcube Grafcube requested a review from Airyzz March 25, 2026 13:51
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