Fix multiple backstack entries get removed on some fragments

This commit is contained in:
Krunal Patel 2022-11-21 10:23:05 +05:30
parent 3661660dd1
commit 5f5eee3be2

View File

@ -143,12 +143,17 @@ class MainActivity : BaseActivity() {
} }
} }
if (navController.currentDestination?.id == startFragmentId) { when (navController.currentDestination?.id) {
moveTaskToBack(true) startFragmentId -> {
} else { moveTaskToBack(true)
navController.popBackStack(R.id.searchResultFragment, false) || }
R.id.searchResultFragment -> {
navController.popBackStack(R.id.searchFragment, true) || navController.popBackStack(R.id.searchFragment, true) ||
navController.popBackStack()
}
else -> {
navController.popBackStack() navController.popBackStack()
}
} }
} }
}) })