Skip to content

Commit

Permalink
Merge pull request #69 from laco-dev/feature/#67
Browse files Browse the repository at this point in the history
[Contributor] 컨트리뷰터 화면이 뒤로가기로 앱이 종료되지 않도록 한다
  • Loading branch information
laco-dev authored Jul 22, 2023
2 parents 9a39f46 + f62fc3a commit d33166c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navOptions
import com.droidknights.app2023.feature.contributor.navigation.ContributorRoute
import com.droidknights.app2023.feature.contributor.navigation.navigateContributor
import com.droidknights.app2023.feature.home.navigation.HomeRoute
import com.droidknights.app2023.feature.home.navigation.navigateHome
import com.droidknights.app2023.feature.setting.navigation.SettingRoute
Expand All @@ -21,8 +22,8 @@ internal class MainNavigator(
private val currentDestination: NavDestination?
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination
val startDestination: String
@Composable get() = currentDestination?.route ?: HomeRoute.route

val startDestination = HomeRoute.route

val currentTab: MainTab?
@Composable get() = when (currentDestination?.route) {
Expand All @@ -45,12 +46,12 @@ internal class MainNavigator(
when (tab) {
MainTab.SETTING -> navController.navigateSetting(navOptions)
MainTab.HOME -> navController.navigateHome(navOptions)
MainTab.TEMP -> navController.navigate("temp") // TODO: ???
MainTab.TEMP -> navController.navigate("temp", navOptions) // TODO: ???
}
}

fun navigateContributor() {
navController.navigate(ContributorRoute.route)
navController.navigateContributor()
}

fun popBackStack() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal fun MainScreen(navigator: MainNavigator = rememberMainNavigator()) {
) {
NavHost(
navController = navigator.navController,
startDestination = navigator.startDestination
startDestination = navigator.startDestination,
) {
settingNavGraph()
homeNavGraph(
Expand Down

0 comments on commit d33166c

Please sign in to comment.