damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit f2cf30a72880fb85bf5268a79aca57fc20e04e62
parent 69922b1d77f985b68704963ae78620cf516d096d
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 12 Jul 2023 08:23:46 -0700

Scroll to top for longform events only

Fixes: ad6a1962 ("Scroll to top of event instead of bottom")

Diffstat:
Mdamus/Views/EventDetailView.swift | 2+-
Mdamus/Views/ThreadView.swift | 3++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/damus/Views/EventDetailView.swift b/damus/Views/EventDetailView.swift @@ -21,7 +21,7 @@ struct EventDetailView_Previews: PreviewProvider { } } -func scroll_to_event(scroller: ScrollViewProxy, id: String, delay: Double, animate: Bool, anchor: UnitPoint = .top) { +func scroll_to_event(scroller: ScrollViewProxy, id: String, delay: Double, animate: Bool, anchor: UnitPoint = .bottom) { DispatchQueue.main.asyncAfter(deadline: .now() + delay) { if animate { withAnimation { diff --git a/damus/Views/ThreadView.swift b/damus/Views/ThreadView.swift @@ -88,7 +88,8 @@ struct ThreadView: View { }.navigationBarTitle(NSLocalizedString("Thread", comment: "Navigation bar title for note thread.")) .onAppear { thread.subscribe() - scroll_to_event(scroller: reader, id: self.thread.event.id, delay: 0.0, animate: false) + let anchor: UnitPoint = self.thread.event.known_kind == .longform ? .top : .bottom + scroll_to_event(scroller: reader, id: self.thread.event.id, delay: 0.0, animate: false, anchor: anchor) } .onDisappear { thread.unsubscribe()