Skip to content

Commit 01a55ca

Browse files
committed
Address second round of Sentry Bot comments
1 parent a90feee commit 01a55ca

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2ComposeRoutes.kt‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ internal fun Nav2ComposeApp(
133133
shareSheetProductId.value = null
134134
}
135135

136-
fun resetToHome() {
137-
backStack.resetTo(Home)
136+
fun resetToRoot() {
137+
val root = if (selectedScenario == Nav2Scenario.CUSTOM) Custom else Home
138+
backStack.resetTo(root)
138139
shareSheetProductId.value = null
139-
navController.navigate(Home.route) {
140+
navController.navigate(root.route) {
140141
popUpTo(Home.route) { inclusive = false }
141142
launchSingleTop = true
142143
}
@@ -324,7 +325,7 @@ internal fun Nav2ComposeApp(
324325
Nav2ComposeConfirmationRoute(
325326
routeSpec = RouteSpecs.confirmation,
326327
orderId = entry.arguments?.getString(NavArgs.ORDER_ID).orEmpty(),
327-
onResetBackStack = { resetToHome() },
328+
onResetBackStack = { resetToRoot() },
328329
)
329330
}
330331
}

‎sentry-samples/sentry-samples-android/src/main/java/io/sentry/samples/android/navigation/nav2/Nav2CustomTransactions.kt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ internal class Nav2CustomTransactionController {
113113

114114
private fun handleWholeFlow(currentRoute: String) {
115115
if (currentRoute == RouteNames.CUSTOM) {
116-
if (activeMode == Nav2CustomTransactionMode.WHOLE_FLOW) {
117-
finishActiveTransaction()
118-
}
116+
finishActiveTransaction()
117+
activeMode = Nav2CustomTransactionMode.WHOLE_FLOW
118+
activeRouteName = currentRoute
119119
return
120120
}
121121

0 commit comments

Comments
 (0)