mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
BIT-730: Refactor Generator Screen Navigation (#94)
This commit is contained in:
parent
aafcd70531
commit
e4447129c1
2 changed files with 30 additions and 30 deletions
|
@ -28,7 +28,9 @@ import androidx.navigation.navOptions
|
|||
import com.x8bit.bitwarden.R
|
||||
import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect
|
||||
import com.x8bit.bitwarden.ui.platform.components.PlaceholderComposable
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.GeneratorScreen
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.GENERATOR_ROUTE
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.generatorDestination
|
||||
import com.x8bit.bitwarden.ui.tools.feature.generator.navigateToGenerator
|
||||
import com.x8bit.bitwarden.ui.vault.feature.vault.VAULT_ROUTE
|
||||
import com.x8bit.bitwarden.ui.vault.feature.vault.navigateToVault
|
||||
import com.x8bit.bitwarden.ui.vault.feature.vault.vaultDestination
|
||||
|
@ -271,35 +273,6 @@ private fun NavController.vaultUnlockedNavBarScreenNavOptions(): NavOptions =
|
|||
* For an example of how to setup these nav extensions, see NIA project.
|
||||
*/
|
||||
|
||||
// #region Generator
|
||||
/**
|
||||
* TODO: move to generator package (BIT-148)
|
||||
*/
|
||||
private const val GENERATOR_ROUTE = "generator"
|
||||
|
||||
/**
|
||||
* Add generator destination to the nav graph.
|
||||
*
|
||||
* TODO: move to generator package (BIT-148)
|
||||
*/
|
||||
private fun NavGraphBuilder.generatorDestination() {
|
||||
composable(GENERATOR_ROUTE) {
|
||||
GeneratorScreen()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to the generator screen. Note this will only work if generator screen was added
|
||||
* via [generatorDestination].
|
||||
*
|
||||
* TODO: move to generator package (BIT-148)
|
||||
*
|
||||
*/
|
||||
private fun NavController.navigateToGenerator(navOptions: NavOptions? = null) {
|
||||
navigate(GENERATOR_ROUTE, navOptions)
|
||||
}
|
||||
// #endregion Generator
|
||||
|
||||
// #region Send
|
||||
/**
|
||||
* TODO: move to send package (BIT-149)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.x8bit.bitwarden.ui.tools.feature.generator
|
||||
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.compose.composable
|
||||
|
||||
/**
|
||||
* The functions below pertain to entry into the [GeneratorScreen].
|
||||
*/
|
||||
const val GENERATOR_ROUTE: String = "generator"
|
||||
|
||||
/**
|
||||
* Navigate to the [GeneratorScreen].
|
||||
*/
|
||||
fun NavController.navigateToGenerator(navOptions: NavOptions? = null) {
|
||||
navigate(GENERATOR_ROUTE, navOptions)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add generator destination to the root nav graph.
|
||||
*/
|
||||
fun NavGraphBuilder.generatorDestination() {
|
||||
composable(GENERATOR_ROUTE) {
|
||||
GeneratorScreen()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue