diff --git a/navigation/common/api/navigation.api b/navigation/common/api/navigation.api index 041f4eb7..87cf275e 100644 --- a/navigation/common/api/navigation.api +++ b/navigation/common/api/navigation.api @@ -32,7 +32,7 @@ public abstract class com/mirego/pilot/navigation/PilotNavigationListener { public fun ()V public abstract fun pop ()V public abstract fun popTo (Lcom/mirego/pilot/navigation/PilotNavigationRoute;Z)V - public abstract fun push (Lcom/mirego/pilot/navigation/PilotNavigationRoute;)V + public abstract fun push (Lcom/mirego/pilot/navigation/PilotNavigationRoute;)Z } public abstract class com/mirego/pilot/navigation/PilotNavigationManager { @@ -70,7 +70,7 @@ public class com/mirego/pilot/navigation/compose/PilotNavControllerNavigationLis public fun (Landroidx/navigation/NavController;)V public fun pop ()V public fun popTo (Lcom/mirego/pilot/navigation/PilotNavigationRoute;Z)V - public fun push (Lcom/mirego/pilot/navigation/PilotNavigationRoute;)V + public fun push (Lcom/mirego/pilot/navigation/PilotNavigationRoute;)Z } public final class com/mirego/pilot/navigation/compose/PilotNavigationHelpersKt { diff --git a/navigation/common/src/androidMain/kotlin/com/mirego/pilot/navigation/compose/PilotNavControllerNavigationListener.kt b/navigation/common/src/androidMain/kotlin/com/mirego/pilot/navigation/compose/PilotNavControllerNavigationListener.kt index 37576de3..2b46f519 100644 --- a/navigation/common/src/androidMain/kotlin/com/mirego/pilot/navigation/compose/PilotNavControllerNavigationListener.kt +++ b/navigation/common/src/androidMain/kotlin/com/mirego/pilot/navigation/compose/PilotNavControllerNavigationListener.kt @@ -8,8 +8,9 @@ public open class PilotNavControllerNavigationListener() { - override fun push(route: ROUTE) { + override fun push(route: ROUTE): Boolean { navController.navigate(route.navRoute) + return true } override fun pop() { diff --git a/navigation/common/src/commonMain/kotlin/com/mirego/pilot/navigation/DefaultPilotNavigationManager.kt b/navigation/common/src/commonMain/kotlin/com/mirego/pilot/navigation/DefaultPilotNavigationManager.kt index 6679bcf8..eb19924d 100644 --- a/navigation/common/src/commonMain/kotlin/com/mirego/pilot/navigation/DefaultPilotNavigationManager.kt +++ b/navigation/common/src/commonMain/kotlin/com/mirego/pilot/navigation/DefaultPilotNavigationManager.kt @@ -23,9 +23,11 @@ public open class DefaultPilotNavigationManager { - public abstract fun push(route: ROUTE) + public abstract fun push(route: ROUTE): Boolean public abstract fun pop() public abstract fun popTo(route: ROUTE, inclusive: Boolean) } diff --git a/navigation/ios/NavigationState.swift b/navigation/ios/NavigationState.swift index 52f0631b..5aad0708 100644 --- a/navigation/ios/NavigationState.swift +++ b/navigation/ios/NavigationState.swift @@ -46,18 +46,18 @@ class NavigationState< actionListener.startListening() } - override func push(route: PilotNavigationRoute) { + override func push(route: PilotNavigationRoute) -> Bool { guard let buildNavigation else { fatalError("buildNavigation not set")} guard let route = route as? Route else { fatalError("Invalid route type")} guard let navigation = buildNavigation(currentStack(), route) else { - navigationManager?.popToId(uniqueId: route.uniqueId, inclusive: true) - return + return false } dedounceNavigation { [weak self] in guard let self else { return } top().child = NavigationState(navigation: navigation, route: route) } + return true } override func popTo(route: PilotNavigationRoute, inclusive: Bool) {