diff --git a/app/src/main/java/com/bitchat/android/MainActivity.kt b/app/src/main/java/com/bitchat/android/MainActivity.kt index 8b547f40..b0e56485 100644 --- a/app/src/main/java/com/bitchat/android/MainActivity.kt +++ b/app/src/main/java/com/bitchat/android/MainActivity.kt @@ -220,7 +220,11 @@ class MainActivity : OrientationAwareActivity() { BackHandler( enabled = navigator.backStack.lastOrNull() == ChatRoute && canHandleBack ) { - chatViewModel.handleBackPressed() + // enabled trails the state by a dispatch and a recomposition, so a + // second quick press can arrive with nothing left to unwind. Forward + // it rather than swallowing it: pop a route if there is one, and + // otherwise leave, which is what the press would have done anyway. + if (!chatViewModel.handleBackPressed() && !navigator.goBack()) finish() } } }