Skip to content

Commit a38b750

Browse files
authored
Reader - scroll to the last known position only when the view first appears (#1114)
fix(reader): scroll to the last known position only when the view first appears
1 parent 98862f4 commit a38b750

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

PocketKit/Sources/PocketKit/Article/ReadableViewController.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class ReadableViewController: UIViewController {
4343

4444
private var isReloading = false
4545

46+
var hasAppearedAfterLoading = false
47+
4648
private var userScrollProgress: IndexPath?
4749
// Tippable view controller properties
4850
var tipObservationTask: Task<Void, Error>?
@@ -353,7 +355,10 @@ class ReadableViewController: UIViewController {
353355

354356
override func viewDidAppear(_ animated: Bool) {
355357
super.viewDidAppear(animated)
356-
scrollToLastKnownPosition()
358+
if !hasAppearedAfterLoading {
359+
scrollToLastKnownPosition()
360+
hasAppearedAfterLoading = true
361+
}
357362
// do not vend the tip on syndicated articles
358363
if readableViewModel is SavedItemViewModel {
359364
PocketTipEvents.showSwipeHighlightsTip.sendDonation()

0 commit comments

Comments
 (0)