Skip to content

Commit

Permalink
Rename SettingsBaseRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
f33lnothin9 committed Nov 20, 2024
1 parent e8fd3ac commit 5f2b227
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import kotlinx.serialization.Serializable
import ru.resodostudios.cashsense.feature.settings.SettingsScreen

@Serializable
data object SettingsGraph
data object SettingsBaseRoute

@Serializable
data object SettingsRoute

fun NavController.navigateToSettingsGraph(navOptions: NavOptions? = null) =
navigate(route = SettingsGraph, navOptions)
fun NavController.navigateToSettings(navOptions: NavOptions? = null) =
navigate(route = SettingsRoute, navOptions)

fun NavGraphBuilder.settingsGraph(
fun NavGraphBuilder.settingsSection(
onLicensesClick: () -> Unit,
nestedGraphs: NavGraphBuilder.() -> Unit,
) {
navigation<SettingsGraph>(
navigation<SettingsBaseRoute>(
startDestination = SettingsRoute,
) {
composable<SettingsRoute> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.navigation.compose.NavHost
import ru.resodostudios.cashsense.feature.category.list.navigation.categoriesScreen
import ru.resodostudios.cashsense.feature.settings.navigation.licensesScreen
import ru.resodostudios.cashsense.feature.settings.navigation.navigateToLicenses
import ru.resodostudios.cashsense.feature.settings.navigation.settingsGraph
import ru.resodostudios.cashsense.feature.settings.navigation.settingsSection
import ru.resodostudios.cashsense.feature.subscription.list.navigation.subscriptionsScreen
import ru.resodostudios.cashsense.feature.transfer.navigation.navigateToTransfer
import ru.resodostudios.cashsense.feature.transfer.navigation.transferDialog
Expand Down Expand Up @@ -48,7 +48,7 @@ fun CsNavHost(
)
categoriesScreen(onShowSnackbar)
subscriptionsScreen(onShowSnackbar)
settingsGraph(
settingsSection(
onLicensesClick = navController::navigateToLicenses,
nestedGraphs = { licensesScreen(navController::navigateUp) },
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ru.resodostudios.cashsense.R
import ru.resodostudios.cashsense.core.designsystem.icon.CsIcons
import ru.resodostudios.cashsense.feature.category.list.navigation.CategoriesRoute
import ru.resodostudios.cashsense.feature.home.navigation.HomeRoute
import ru.resodostudios.cashsense.feature.settings.navigation.SettingsGraph
import ru.resodostudios.cashsense.feature.settings.navigation.SettingsBaseRoute
import ru.resodostudios.cashsense.feature.settings.navigation.SettingsRoute
import ru.resodostudios.cashsense.feature.subscription.list.navigation.SubscriptionsRoute
import ru.resodostudios.cashsense.ui.home2pane.HomeListDetailRoute
Expand Down Expand Up @@ -73,6 +73,6 @@ enum class TopLevelDestination(
fabIcon = null,
fabTitle = null,
route = SettingsRoute::class,
baseRoute = SettingsGraph::class,
baseRoute = SettingsBaseRoute::class,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import ru.resodostudios.cashsense.feature.category.list.navigation.navigateToCat
import ru.resodostudios.cashsense.feature.home.navigation.HomeRoute
import ru.resodostudios.cashsense.feature.home.navigation.navigateToHome
import ru.resodostudios.cashsense.feature.settings.navigation.SettingsRoute
import ru.resodostudios.cashsense.feature.settings.navigation.navigateToSettingsGraph
import ru.resodostudios.cashsense.feature.settings.navigation.navigateToSettings
import ru.resodostudios.cashsense.feature.subscription.list.navigation.SubscriptionsRoute
import ru.resodostudios.cashsense.feature.subscription.list.navigation.navigateToSubscriptions
import ru.resodostudios.cashsense.feature.transfer.navigation.TransferRoute
Expand Down Expand Up @@ -99,7 +99,7 @@ class CsAppState(
HOME -> navController.navigateToHome(navOptions = topLevelNavOptions)
CATEGORIES -> navController.navigateToCategories(topLevelNavOptions)
SUBSCRIPTIONS -> navController.navigateToSubscriptions(topLevelNavOptions)
SETTINGS -> navController.navigateToSettingsGraph(topLevelNavOptions)
SETTINGS -> navController.navigateToSettings(topLevelNavOptions)
}
}
}
Expand Down

0 comments on commit 5f2b227

Please sign in to comment.