Gate out-of-window jump-to-unread on genuinely unread displayable content
The jump-to-unread FAB could surface an OutOfWindow target when the
fully-read marker event was either loaded-but-not-displayed (state/filtered
events) or when there was nothing displayable to jump to. Add two guards to
the recompute:
- Require roomInfo.numUnreadMessages > 0, so the FAB only appears when there
is genuinely unread "interesting" content (never state/hidden events).
- Add Timeline.isEventLoaded to distinguish "in the loaded window but not
rendered" from "genuinely outside the window", falling back to the SDK only
after the cheap display-index check (isKnown) misses.
The RustTimeline implementation reads the replay cache first and releases the
EventTimelineItem native handle via use {} when probing the SDK. Adds presenter
tests for the loaded-but-not-displayed and no-unread-messages branches.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+7
@@ -216,6 +216,13 @@ interface Timeline : AutoCloseable {
|
||||
|
||||
suspend fun loadReplyDetails(eventId: EventId): InReplyTo
|
||||
|
||||
/**
|
||||
* Returns true if [eventId] is currently loaded in this timeline's window, even if the display
|
||||
* layer does not render it (e.g. filtered or state events). This distinguishes "in the window
|
||||
* but not displayed" from "genuinely outside the loaded window".
|
||||
*/
|
||||
suspend fun isEventLoaded(eventId: EventId): Boolean
|
||||
|
||||
/**
|
||||
* Adds a new pinned event by sending an updated `m.room.pinned_events`
|
||||
* event containing the new event id.
|
||||
|
||||
Reference in New Issue
Block a user