mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
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:
+3
@@ -436,6 +436,9 @@ class FakeTimeline(
|
||||
|
||||
override suspend fun loadReplyDetails(eventId: EventId) = loadReplyDetailsLambda(eventId)
|
||||
|
||||
var isEventLoadedLambda: (eventId: EventId) -> Boolean = { false }
|
||||
override suspend fun isEventLoaded(eventId: EventId): Boolean = isEventLoadedLambda(eventId)
|
||||
|
||||
var pinEventLambda: (eventId: EventId) -> Result<Boolean> = { lambdaError() }
|
||||
override suspend fun pinEvent(eventId: EventId): Result<Boolean> {
|
||||
return pinEventLambda(eventId)
|
||||
|
||||
Reference in New Issue
Block a user