Merge pull request #467 from barrydeen/fix/back-minimizes-app

fix: allow back button to minimize app from FEED
This commit is contained in:
Barry Deen
2026-04-16 21:29:24 -04:00
committed by GitHub
+8 -13
View File
@@ -610,20 +610,15 @@ fun WispNavHost(
)
}
// Prevent the system back button from ever closing the app.
// On FEED: consume the press (nowhere to go).
// On any other app screen: pop the back stack, falling back to FEED if empty.
// On non-FEED app screens: pop the back stack, falling back to FEED if empty.
// On FEED: let the system handle back (minimizes the app).
val isAppRoute = currentRoute != null && currentRoute !in nonAppRoutes
BackHandler(enabled = isAppRoute) {
if (currentRoute == Routes.FEED) {
// Already on home — do nothing
} else {
val popped = navController.popBackStack()
if (!popped) {
navController.navigate(Routes.FEED) {
popUpTo(0) { inclusive = true }
launchSingleTop = true
}
BackHandler(enabled = isAppRoute && currentRoute != Routes.FEED) {
val popped = navController.popBackStack()
if (!popped) {
navController.navigate(Routes.FEED) {
popUpTo(0) { inclusive = true }
launchSingleTop = true
}
}
}