shop: restore applyShopPendingRoute for resolved deep links (#nav)
- Commit
04b14e61cae01e20ce493fcc90c1ace4b690b19b- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-16 20:51 UTC (19 days ago)
- Parents
a36c3ec
The tabs merge dropped the selection branch's pending-route helper that ShopProfileGateTest pins; the merged Navigation now resolves merchant links through it again (gate-deferred, then reset onto Search). No behaviour change beyond the merge.
Diff
shop/src/main/java/com/vayunmathur/shop/Navigation.kt
diff --git a/shop/src/main/java/com/vayunmathur/shop/Navigation.kt b/shop/src/main/java/com/vayunmathur/shop/Navigation.ktindex 1409ec5fef..fa038149da 100644--- a/shop/src/main/java/com/vayunmathur/shop/Navigation.kt+++ b/shop/src/main/java/com/vayunmathur/shop/Navigation.kt@@ -50,6 +50,24 @@ internal fun applyShopProfileGate( return true } ++/**+ * Applies a resolved deep-link route. While the profile is incomplete the+ * route is left unconsumed (returns false) so it still applies after the gate+ * lifts; the caller re-runs this when completeness changes. Returns true when+ * the route was applied and can be consumed.+ */+internal fun applyShopPendingRoute(+ backStack: NavBackStack<Route>,+ pendingRoute: Route?,+ profileComplete: Boolean,+): Boolean {+ val route = pendingRoute ?: return false+ if (!profileComplete) return false+ if (route == Route.Search) backStack.reset(Route.Search) else backStack.reset(Route.Search, route)+ return true+}+ @Composable fun Navigation( viewModel: ShopViewModel,@@ -84,7 +102,11 @@ fun Navigation( val url = linkRequest?.second ?: return@LaunchedEffect if (backStack.backStack.lastOrNull() == Route.ProfileSetup) return@LaunchedEffect viewModel.openLink(url) { route ->- if (route is Route.ProductDetail) backStack.reset(Route.Search, route) else backStack.reset(route)+ if (route is Route.ProductDetail || route == Route.Search) {+ applyShopPendingRoute(backStack, route, profileComplete = true)+ } else {+ backStack.reset(route)+ } } } LaunchedEffect(viewModel) {