From 8341cbe56d02cae474b9242763df889e367a583c Mon Sep 17 00:00:00 2001 From: Fernando Olivares Date: Sun, 2 Jun 2024 16:31:17 -0600 Subject: [PATCH] Respect proposal context when popping --- .../TurboNavigationHierarchyController.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Turbo Navigator/TurboNavigationHierarchyController.swift b/Source/Turbo Navigator/TurboNavigationHierarchyController.swift index 2d855b1..a54b162 100644 --- a/Source/Turbo Navigator/TurboNavigationHierarchyController.swift +++ b/Source/Turbo Navigator/TurboNavigationHierarchyController.swift @@ -131,14 +131,16 @@ class TurboNavigationHierarchyController { } private func pop(via proposal: VisitProposal) { - if navigationController.presentedViewController != nil { + switch proposal.context { + case .default: + navigationController.popViewController(animated: true) + + case .modal: if modalNavigationController.viewControllers.count == 1 { navigationController.dismiss(animated: proposal.animated) } else { modalNavigationController.popViewController(animated: proposal.animated) } - } else { - navigationController.popViewController(animated: proposal.animated) } }