File tree Expand file tree Collapse file tree
app/src/main/java/com/threegap/bitnagil Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,13 +38,7 @@ fun MainNavHost(
3838 popUpTo<Route .Splash > { inclusive = true }
3939 }
4040 },
41- navigateToHome = {
42- navigator.navController.navigate(Route .Home ) {
43- popUpTo(navigator.navController.graph.startDestinationId) {
44- inclusive = true
45- }
46- }
47- },
41+ navigateToHome = navigator::navigateToHomeAndClearStack,
4842 )
4943 }
5044
@@ -56,13 +50,7 @@ fun MainNavHost(
5650
5751 composable<Route .Login > {
5852 LoginScreenContainer (
59- navigateToHome = {
60- navigator.navController.navigate(Route .Home ) {
61- popUpTo(navigator.navController.graph.startDestinationId) {
62- inclusive = true
63- }
64- }
65- },
53+ navigateToHome = navigator::navigateToHomeAndClearStack,
6654 navigateToTermsAgreement = { navigator.navController.navigate(Route .TermsAgreement ) },
6755 )
6856 }
@@ -192,13 +180,7 @@ fun MainNavHost(
192180
193181 OnBoardingScreenContainer (
194182 onBoardingViewModel = viewModel,
195- navigateToHome = {
196- navigator.navController.navigate(Route .Home ) {
197- popUpTo(navigator.navController.graph.startDestinationId) {
198- inclusive = true
199- }
200- }
201- },
183+ navigateToHome = navigator::navigateToHomeAndClearStack,
202184 navigateToBack = {
203185 if (navigator.navController.previousBackStackEntry != null ) {
204186 navigator.navController.popBackStack()
Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ class MainNavigator(
99 val navController : NavHostController ,
1010) {
1111 val startDestination = Route .Splash
12+
13+ internal fun navigateToHomeAndClearStack () =
14+ navController.navigate(Route .Home ) {
15+ popUpTo(0 ) {
16+ inclusive = true
17+ }
18+ }
1219}
1320
1421@Composable
You can’t perform that action at this time.
0 commit comments