diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/feature/login/LoginNavigation.kt b/app/src/main/java/com/x8bit/bitwarden/ui/feature/auth/AuthNavigation.kt similarity index 68% rename from app/src/main/java/com/x8bit/bitwarden/ui/feature/login/LoginNavigation.kt rename to app/src/main/java/com/x8bit/bitwarden/ui/feature/auth/AuthNavigation.kt index d98528cc6..699a1f680 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/feature/login/LoginNavigation.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/feature/auth/AuthNavigation.kt @@ -1,4 +1,4 @@ -package com.x8bit.bitwarden.ui.feature.login +package com.x8bit.bitwarden.ui.feature.auth import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder @@ -10,15 +10,15 @@ import com.x8bit.bitwarden.ui.feature.createaccount.navigateToCreateAccount import com.x8bit.bitwarden.ui.feature.landing.LANDING_ROUTE import com.x8bit.bitwarden.ui.feature.landing.landingDestination -const val LOGIN_ROUTE: String = "login" +const val AUTH_ROUTE: String = "auth" /** - * Add login destinations to the nav graph. + * Add auth destinations to the nav graph. */ -fun NavGraphBuilder.loginDestinations(navController: NavHostController) { +fun NavGraphBuilder.authDestinations(navController: NavHostController) { navigation( startDestination = LANDING_ROUTE, - route = LOGIN_ROUTE, + route = AUTH_ROUTE, ) { createAccountDestinations() landingDestination( @@ -28,10 +28,10 @@ fun NavGraphBuilder.loginDestinations(navController: NavHostController) { } /** - * Navigate to the login screen. Note this will only work if login destination was added - * via [loginDestinations]. + * Navigate to the auth screen. Note this will only work if auth destination was added + * via [authDestinations]. */ -fun NavController.navigateToLogin( +fun NavController.navigateToAuth( navOptions: NavOptions? = null, ) { navigate(LANDING_ROUTE, navOptions) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavScreen.kt index 9548bc073..bdecc8b89 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavScreen.kt @@ -12,8 +12,8 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import com.x8bit.bitwarden.ui.components.PlaceholderComposable -import com.x8bit.bitwarden.ui.feature.login.loginDestinations -import com.x8bit.bitwarden.ui.feature.login.navigateToLogin +import com.x8bit.bitwarden.ui.feature.auth.authDestinations +import com.x8bit.bitwarden.ui.feature.auth.navigateToAuth /** * Controls root level [NavHost] for the app. @@ -30,7 +30,7 @@ fun RootNavScreen( startDestination = SplashRoute, ) { splashDestinations() - loginDestinations(navController) + authDestinations(navController) } // When state changes, navigate to different root navigation state @@ -41,7 +41,7 @@ fun RootNavScreen( } } when (state) { - RootNavState.Login -> navController.navigateToLogin(rootNavOptions) + RootNavState.Auth -> navController.navigateToAuth(rootNavOptions) RootNavState.Splash -> navController.navigateToSplash(rootNavOptions) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavViewModel.kt index f796f6bad..34bd4ca0f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/feature/rootnav/RootNavViewModel.kt @@ -20,7 +20,7 @@ class RootNavViewModel @Inject constructor() : viewModelScope.launch { @Suppress("MagicNumber") delay(1000) - mutableStateFlow.value = RootNavState.Login + mutableStateFlow.value = RootNavState.Auth } } @@ -32,9 +32,9 @@ class RootNavViewModel @Inject constructor() : */ sealed class RootNavState { /** - * Show the login screen. + * Show the auth screens. */ - data object Login : RootNavState() + data object Auth : RootNavState() /** * Show the splash screen. diff --git a/app/src/test/java/com/x8bit/bitwarden/example/ui/feature/rootnav/RootNavViewModelTests.kt b/app/src/test/java/com/x8bit/bitwarden/example/ui/feature/rootnav/RootNavViewModelTests.kt index 9fa84c10c..c26c7c37e 100644 --- a/app/src/test/java/com/x8bit/bitwarden/example/ui/feature/rootnav/RootNavViewModelTests.kt +++ b/app/src/test/java/com/x8bit/bitwarden/example/ui/feature/rootnav/RootNavViewModelTests.kt @@ -16,11 +16,11 @@ class RootNavViewModelTests : BaseViewModelTest() { } @Test - fun `state should move from splash to login`() = runTest { + fun `state should move from splash to auth`() = runTest { val viewModel = RootNavViewModel() viewModel.stateFlow.test { assert(awaitItem() is RootNavState.Splash) - assert(awaitItem() is RootNavState.Login) + assert(awaitItem() is RootNavState.Auth) } } }