Skip to content

Commit

Permalink
Detect restore visit in viewWillAppear when navigating from a native …
Browse files Browse the repository at this point in the history
…screen
  • Loading branch information
pfeiffer committed Feb 27, 2024
1 parent 1390d04 commit 661b3a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/Session/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ extension Session: VisitDelegate {

extension Session: VisitableDelegate {
public func visitableViewWillAppear(_ visitable: Visitable) {
let lastDisappearingVisit = self.disappearingVisitForSnapshotting
self.disappearingVisitForSnapshotting = nil

guard let topmostVisit = self.topmostVisit, let currentVisit = self.currentVisit else { return }
Expand All @@ -228,7 +229,7 @@ extension Session: VisitableDelegate {
} else if visitable === currentVisit.visitable && currentVisit.state == .started {
// Navigating forward - complete navigation early
completeNavigationForCurrentVisit()
} else if visitable !== topmostVisit.visitable {
} else if visitable !== topmostVisit.visitable || visitable === lastDisappearingVisit?.visitable {
// Navigating backward
visit(visitable, action: .restore)
}
Expand Down

0 comments on commit 661b3a9

Please sign in to comment.