Merge branch 'main' into small-actionbar-notifications

This commit is contained in:
2026-10-18 22:06:48 +01:00
3 changed files with 36 additions and 7 deletions
@@ -86,6 +86,13 @@ internal val destinations = listOf(
TopDestination("settings", "Settings", Icons.Default.Settings),
)
/** The home route remains beneath top-level navigation, so Back returns to Runs. */
internal const val HOME_ROUTE = "runs"
/** Returning to home clears the accumulated top-level stack; other destinations keep it. */
internal fun topLevelPopUpToHomeInclusive(destination: String): Boolean =
destination == HOME_ROUTE
/**
* Whether [route] is the current destination. Detail panes are no longer
* separate routes (they are saved state inside a destination), so this is a
@@ -207,14 +214,14 @@ fun PipelinesApp(
is SearchTarget.Pipeline -> {
pipelineSelection = PaneSelection(MasterPane.Detail, target.pipelineId, target.version)
navController.navigate("pipelines") {
popUpTo("pipelines") { inclusive = false }
popUpTo(HOME_ROUTE) { inclusive = false }
launchSingleTop = true
}
}
is SearchTarget.Run -> {
runSelection = PaneSelection(MasterPane.Detail, target.runId)
runSearchNav = target.takeIf { it.sequence > 0 }
navController.navigate("runs") { launchSingleTop = true }
navController.navigate(HOME_ROUTE) { launchSingleTop = true }
}
null -> Unit
}
@@ -228,7 +235,7 @@ fun PipelinesApp(
val openRunFromAttention: (Long) -> Unit = { runId ->
vm.arrivedAtRun(runId)
runSelection = PaneSelection(pane = MasterPane.Detail, itemId = runId)
navController.navigate("runs") { launchSingleTop = true }
navController.navigate(HOME_ROUTE) { launchSingleTop = true }
}
// A deep link (or the notification's click action) opens its run once. The
@@ -271,7 +278,9 @@ fun PipelinesApp(
val onNavigate: (TopDestination) -> Unit = { destination ->
if (currentRoute != destination.route) {
navController.navigate(destination.route) {
popUpTo("pipelines") { inclusive = destination.route == "pipelines" }
popUpTo(HOME_ROUTE) {
inclusive = topLevelPopUpToHomeInclusive(destination.route)
}
launchSingleTop = true
}
}
@@ -314,7 +323,7 @@ fun PipelinesApp(
)
NavHost(
navController = navController,
startDestination = "pipelines",
startDestination = HOME_ROUTE,
// While the banner is visible it owns the status-bar inset, so
// the inner app bars below must not apply it a second time.
modifier = Modifier
@@ -343,11 +352,11 @@ fun PipelinesApp(
pane = MasterPane.Detail,
itemId = runId,
)
navController.navigate("runs") { launchSingleTop = true }
navController.navigate(HOME_ROUTE) { launchSingleTop = true }
},
)
}
composable("runs") {
composable(HOME_ROUTE) {
RunsDestination(
vm = vm,
wide = wide,
@@ -12,6 +12,19 @@ import org.junit.Test
class PipelinesNavTest {
@Test
fun runsIsTheHomeRouteForColdLaunchAndTopLevelBack() {
assertEquals("runs", HOME_ROUTE)
}
@Test
fun returningToHomeIsTheOnlyTopLevelNavigationThatClearsHome() {
assertTrue(topLevelPopUpToHomeInclusive(HOME_ROUTE))
assertFalse(topLevelPopUpToHomeInclusive("pipelines"))
assertFalse(topLevelPopUpToHomeInclusive("chat"))
assertFalse(topLevelPopUpToHomeInclusive("settings"))
}
@Test
fun thePillDoesNotHoldTemplates() {
// Templates is configuration and moved to the Settings page; the pill keeps