Closed Sjmarf closed 2 months ago
It also appears that the scroll-to doesn't behave nicely on long comment sections:
This appears to be caused by the presence a super-long post/comment body (one that covers the entire screen). The behavior seen in that post can be reproduced for any post by replacing ExpandedPostView.swift:95
with a long Text
:
- LargePostView(post: post, isExpanded: true)
+ Text(verbatim: .init(repeating: "A", count: 10000))
I did some experimenting but couldn't find a good way to fix this 😔 It's possibly a SwiftUI bug. iOS 18 implements a new scrolling system, .scrollPosition
, which I'm hoping might be used to fix this.
Rewrote parts of
ExpandedPostView
to make scrolling to a comment more reliable.This is partly done by scrolling to the comment 0.1 seconds after the view appears. During that time, a
ProgressView
is shown ontop of the view using aZStack
. The view also now checks whether the targeted comment is included in theGetComments
response, and requests a second page before showing theExpandedPostView
if not.Also includes a little bit of logic for the upcoming comment page (which was originally going to be in this PR, but I thought I'd split it up). Relies on this MlemMiddleware PR to support that logic.