Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Contributor] 컨트리뷰터 화면이 뒤로가기로 앱이 종료되지 않도록 한다 #69

Merged
merged 3 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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