Use consistent naming when adding a single screen to a graph (#433)

This commit is contained in:
Brian Yencho 2023-12-27 09:05:37 -06:00 committed by Álison Fernandes
parent c440c28a02
commit 48169bafb9
6 changed files with 12 additions and 12 deletions

View file

@ -6,13 +6,13 @@ import androidx.navigation.NavHostController
import androidx.navigation.NavOptions import androidx.navigation.NavOptions
import androidx.navigation.navOptions import androidx.navigation.navOptions
import androidx.navigation.navigation import androidx.navigation.navigation
import com.x8bit.bitwarden.ui.auth.feature.createaccount.createAccountDestinations import com.x8bit.bitwarden.ui.auth.feature.createaccount.createAccountDestination
import com.x8bit.bitwarden.ui.auth.feature.createaccount.navigateToCreateAccount import com.x8bit.bitwarden.ui.auth.feature.createaccount.navigateToCreateAccount
import com.x8bit.bitwarden.ui.auth.feature.environment.environmentDestination import com.x8bit.bitwarden.ui.auth.feature.environment.environmentDestination
import com.x8bit.bitwarden.ui.auth.feature.environment.navigateToEnvironment import com.x8bit.bitwarden.ui.auth.feature.environment.navigateToEnvironment
import com.x8bit.bitwarden.ui.auth.feature.landing.LANDING_ROUTE import com.x8bit.bitwarden.ui.auth.feature.landing.LANDING_ROUTE
import com.x8bit.bitwarden.ui.auth.feature.landing.landingDestinations import com.x8bit.bitwarden.ui.auth.feature.landing.landingDestination
import com.x8bit.bitwarden.ui.auth.feature.login.loginDestinations import com.x8bit.bitwarden.ui.auth.feature.login.loginDestination
import com.x8bit.bitwarden.ui.auth.feature.login.navigateToLogin import com.x8bit.bitwarden.ui.auth.feature.login.navigateToLogin
const val AUTH_GRAPH_ROUTE: String = "auth_graph" const val AUTH_GRAPH_ROUTE: String = "auth_graph"
@ -25,7 +25,7 @@ fun NavGraphBuilder.authGraph(navController: NavHostController) {
startDestination = LANDING_ROUTE, startDestination = LANDING_ROUTE,
route = AUTH_GRAPH_ROUTE, route = AUTH_GRAPH_ROUTE,
) { ) {
createAccountDestinations( createAccountDestination(
onNavigateBack = { navController.popBackStack() }, onNavigateBack = { navController.popBackStack() },
onNavigateToLogin = { emailAddress, captchaToken -> onNavigateToLogin = { emailAddress, captchaToken ->
navController.navigateToLogin( navController.navigateToLogin(
@ -37,7 +37,7 @@ fun NavGraphBuilder.authGraph(navController: NavHostController) {
) )
}, },
) )
landingDestinations( landingDestination(
onNavigateToCreateAccount = { navController.navigateToCreateAccount() }, onNavigateToCreateAccount = { navController.navigateToCreateAccount() },
onNavigateToLogin = { emailAddress -> onNavigateToLogin = { emailAddress ->
navController.navigateToLogin( navController.navigateToLogin(
@ -49,7 +49,7 @@ fun NavGraphBuilder.authGraph(navController: NavHostController) {
navController.navigateToEnvironment() navController.navigateToEnvironment()
}, },
) )
loginDestinations( loginDestination(
onNavigateBack = { navController.popBackStack() }, onNavigateBack = { navController.popBackStack() },
) )
environmentDestination( environmentDestination(

View file

@ -18,7 +18,7 @@ fun NavController.navigateToCreateAccount(navOptions: NavOptions? = null) {
/** /**
* Add the create account screen to the nav graph. * Add the create account screen to the nav graph.
*/ */
fun NavGraphBuilder.createAccountDestinations( fun NavGraphBuilder.createAccountDestination(
onNavigateBack: () -> Unit, onNavigateBack: () -> Unit,
onNavigateToLogin: (emailAddress: String, captchaToken: String) -> Unit, onNavigateToLogin: (emailAddress: String, captchaToken: String) -> Unit,
) { ) {

View file

@ -18,7 +18,7 @@ fun NavController.navigateToLanding(navOptions: NavOptions? = null) {
/** /**
* Add the Landing screen to the nav graph. * Add the Landing screen to the nav graph.
*/ */
fun NavGraphBuilder.landingDestinations( fun NavGraphBuilder.landingDestination(
onNavigateToCreateAccount: () -> Unit, onNavigateToCreateAccount: () -> Unit,
onNavigateToLogin: (emailAddress: String) -> Unit, onNavigateToLogin: (emailAddress: String) -> Unit,
onNavigateToEnvironment: () -> Unit, onNavigateToEnvironment: () -> Unit,

View file

@ -40,7 +40,7 @@ fun NavController.navigateToLogin(
/** /**
* Add the Login screen to the nav graph. * Add the Login screen to the nav graph.
*/ */
fun NavGraphBuilder.loginDestinations( fun NavGraphBuilder.loginDestination(
onNavigateBack: () -> Unit, onNavigateBack: () -> Unit,
) { ) {
composable( composable(

View file

@ -20,7 +20,7 @@ fun NavController.navigateToVaultUnlock(
/** /**
* Add the Vault Unlock screen to the nav graph. * Add the Vault Unlock screen to the nav graph.
*/ */
fun NavGraphBuilder.vaultUnlockDestinations() { fun NavGraphBuilder.vaultUnlockDestination() {
composable( composable(
route = VAULT_UNLOCK_ROUTE, route = VAULT_UNLOCK_ROUTE,
enterTransition = TransitionProviders.Enter.slideUp, enterTransition = TransitionProviders.Enter.slideUp,

View file

@ -15,7 +15,7 @@ import com.x8bit.bitwarden.ui.auth.feature.auth.authGraph
import com.x8bit.bitwarden.ui.auth.feature.auth.navigateToAuthGraph import com.x8bit.bitwarden.ui.auth.feature.auth.navigateToAuthGraph
import com.x8bit.bitwarden.ui.auth.feature.vaultunlock.VAULT_UNLOCK_ROUTE import com.x8bit.bitwarden.ui.auth.feature.vaultunlock.VAULT_UNLOCK_ROUTE
import com.x8bit.bitwarden.ui.auth.feature.vaultunlock.navigateToVaultUnlock import com.x8bit.bitwarden.ui.auth.feature.vaultunlock.navigateToVaultUnlock
import com.x8bit.bitwarden.ui.auth.feature.vaultunlock.vaultUnlockDestinations import com.x8bit.bitwarden.ui.auth.feature.vaultunlock.vaultUnlockDestination
import com.x8bit.bitwarden.ui.platform.feature.splash.SPLASH_ROUTE import com.x8bit.bitwarden.ui.platform.feature.splash.SPLASH_ROUTE
import com.x8bit.bitwarden.ui.platform.feature.splash.navigateToSplash import com.x8bit.bitwarden.ui.platform.feature.splash.navigateToSplash
import com.x8bit.bitwarden.ui.platform.feature.splash.splashDestination import com.x8bit.bitwarden.ui.platform.feature.splash.splashDestination
@ -50,7 +50,7 @@ fun RootNavScreen(
) { ) {
splashDestination() splashDestination()
authGraph(navController) authGraph(navController)
vaultUnlockDestinations() vaultUnlockDestination()
vaultUnlockedGraph(navController) vaultUnlockedGraph(navController)
} }