Skip to content

fix: prevent back button from closing the app#248

Merged
barrydeen merged 1 commit intomainfrom
fix/back-button-closes-app
Mar 15, 2026
Merged

fix: prevent back button from closing the app#248
barrydeen merged 1 commit intomainfrom
fix/back-button-closes-app

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

Summary

  • Add a global BackHandler in Navigation.kt that prevents the system back button from ever exiting the app
  • On the feed screen, back press is consumed (no-op since there's nowhere to go)
  • On any other app screen, pops the back stack normally; if the stack is empty, navigates to the feed as a fallback

Test plan

  • On the feed screen, press the Android back button — app should stay on feed
  • Navigate to a nested screen (e.g. thread, profile), press back — should pop back normally
  • Deep-link or navigate to a screen where the back stack is empty, press back — should land on feed instead of closing

Add a global BackHandler that intercepts system back presses. On the
feed screen it consumes the press (no-op). On any other app screen it
pops the back stack, falling back to the feed if the stack is empty.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@barrydeen barrydeen merged commit 621d935 into main Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant