Skip to content

fix(chat): land message jumps centred on the target - #1136

Merged
bmc08gt merged 1 commit into
mainfrom
fix/chat-jump-landing
Oct 26, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
fix/chat-jump-landing

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Jumping to a message far up a transcript stopped several messages short of it. flipcash://chat/12e1d342-…/m/109 in a photo-heavy group landed on a post from the next morning instead of the 1:39 PM photo it names. It affects deep links, quote taps and boost detail's View Message, since they all end in ChatViewController.scrollToRow.

scrollToRow called scrollToItem(at:at: .centeredVertically) once. The offset came from ChatLayout's 56pt estimate for every row that had never been on screen, and nothing re-anchored after those rows self-sized. With photos several times that height, the target ended up above the visible area. scrollToBottom and scrollToRowTop already re-anchor through a position snapshot on the next runloop turn; the jump had no such pass.

Changes, all in ChatViewController:

  • centerRow(at:) centres a row with a ChatLayoutPositionSnapshot worked out from the row's current height, top-aligning a row taller than the screen.
  • The non-animated jump (a row that arrives with a loaded page) centres, flashes, and re-anchors once more on the next turn.
  • The animated jump settles the destination first by centring twice, restores the reader's position from a bottom snapshot, then animates to the measured offset and re-anchors when it lands. All of the measuring runs before the next frame, so none of it is drawn.

scrollToMessage_tallRows_landsCentred(animated:) drives a windowed transcript of rows several times the estimate. Before the fix, the animated jump left the target 239pt above centre and the deferred jump left it off screen. Both cases now pass, along with the rest of ChatViewControllerTests and ChatReplyReturnTests.

A jump far up a transcript stopped short of the target. scrollToItem
worked out the offset from the 56pt estimate for rows that had never been
on screen, and nothing re-anchored once those rows self-sized, so in a
chat of photos the target ended up above the visible area.

The jump now centres the row through a ChatLayout position snapshot,
recomputed from the row's measured height on each pass. The non-animated
jump re-anchors once more on the next runloop turn. The animated jump
measures its destination first, restores the reader's position, and
scrolls to the measured offset, with a final re-anchor when it lands.

In the new windowed test, the animated jump previously left the target
239pt above centre and the deferred jump left it off screen.
@bmc08gt bmc08gt self-assigned this Oct 26, 2026
@bmc08gt
bmc08gt marked this pull request as ready for review October 26, 2026 18:47
@bmc08gt
bmc08gt merged commit 1a3e27e into main Oct 26, 2026
5 checks passed
@bmc08gt
bmc08gt deleted the fix/chat-jump-landing branch October 26, 2026 18:47
bmc08gt added a commit that referenced this pull request Oct 26, 2026
* commit '28622a831ce5876c6165063aed9d4203292651df':
  feat(history): move the boost emoji and chat into the detail subtitle
  feat(history): show the boost on the detail header and receipt card
  feat(history): title boosted payments and link them to the boosted message
  fix(chat): land message jumps centred on the target (#1136)

# Conflicts:
#	FlipcashCore/Sources/FlipcashStore/Database.swift
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.

1 participant