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,13 +143,18 @@ class MainActivity : BaseActivity() {
}
}
if (navController.currentDestination?.id == startFragmentId) {
when (navController.currentDestination?.id) {
startFragmentId -> {
moveTaskToBack(true)
} else {
navController.popBackStack(R.id.searchResultFragment, false) ||
}
R.id.searchResultFragment -> {
navController.popBackStack(R.id.searchFragment, true) ||
navController.popBackStack()
}
else -> {
navController.popBackStack()
}
}
}
})