Skip to content
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 @@ -65,7 +65,7 @@ import com.x8bit.bitwarden.ui.tools.feature.send.addedit.navigateToAddEditSend
import com.x8bit.bitwarden.ui.vault.feature.addedit.VaultAddEditArgs
import com.x8bit.bitwarden.ui.vault.feature.addedit.navigateToVaultAddEdit
import com.x8bit.bitwarden.ui.vault.feature.addedit.util.toVaultItemCipherType
import com.x8bit.bitwarden.ui.vault.feature.exportitems.ExportItemsRoute
import com.x8bit.bitwarden.ui.vault.feature.exportitems.ExportItemsGraphRoute
import com.x8bit.bitwarden.ui.vault.feature.exportitems.exportItemsGraph
import com.x8bit.bitwarden.ui.vault.feature.exportitems.navigateToExportItemsGraph
import com.x8bit.bitwarden.ui.vault.feature.itemlisting.navigateToVaultItemListingAsRoot
Expand Down Expand Up @@ -142,7 +142,7 @@ fun RootNavScreen(
is RootNavState.VaultUnlockedForProviderGetCredentials,
-> VaultUnlockedGraphRoute

is RootNavState.CredentialExchangeExport -> ExportItemsRoute
is RootNavState.CredentialExchangeExport -> ExportItemsGraphRoute
RootNavState.OnboardingAccountLockSetup -> SetupUnlockRoute.AsRoot
RootNavState.OnboardingAutoFillSetup -> SetupAutofillRoute.AsRoot
RootNavState.OnboardingBrowserAutofillSetup -> SetupBrowserAutofillRoute.AsRoot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,36 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.navigation
import com.bitwarden.annotation.OmitFromCoverage
import com.x8bit.bitwarden.ui.vault.feature.exportitems.reviewexport.navigateToReviewExport
import com.x8bit.bitwarden.ui.vault.feature.exportitems.reviewexport.reviewExportDestination
import com.x8bit.bitwarden.ui.vault.feature.exportitems.selectaccount.SelectAccountRoute
import com.x8bit.bitwarden.ui.vault.feature.exportitems.selectaccount.selectAccountDestination
import com.x8bit.bitwarden.ui.vault.feature.exportitems.verifypassword.navigateToVerifyPassword
import com.x8bit.bitwarden.ui.vault.feature.exportitems.verifypassword.verifyPasswordDestination
import kotlinx.serialization.Serializable

/**
* The type-safe route for the export items graph.
* The type-safe route for the root of the export items feature graph.
*
* This route serves as the entry point for the entire export items flow.
*/
@OmitFromCoverage
@Serializable
data object ExportItemsRoute
data object ExportItemsGraphRoute
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ‘


/**
* Add export items destinations to the nav graph.
* Adds the export items feature graph to the NavGraphBuilder.
*
* This graph encompasses the entire flow for exporting items from the vault,
* including account selection, password verification, and reviewing the export details.
*
* @param navController The [NavController] used for navigating within this graph and back to
* previous screens.
*/
fun NavGraphBuilder.exportItemsGraph(
navController: NavController,
) {
navigation<ExportItemsRoute>(
navigation<ExportItemsGraphRoute>(
startDestination = SelectAccountRoute,
) {
selectAccountDestination(
Expand All @@ -37,17 +47,22 @@ fun NavGraphBuilder.exportItemsGraph(
verifyPasswordDestination(
onNavigateBack = { navController.popBackStack() },
onPasswordVerified = {
// TODO: [PM-26111] Navigate to confirm export screen.
navController.navigateToReviewExport()
},
)
reviewExportDestination(navController = navController)
}
}

/**
* Navigate to the export items graph.
* Navigates to the main export items graph.
*
* This function provides a convenient and type-safe way to initiate the export items flow.
*
* @param navOptions Optional [NavOptions] to apply to this navigation action.
*/
fun NavController.navigateToExportItemsGraph(
navOptions: NavOptions? = null,
) {
navigate(route = ExportItemsRoute, navOptions = navOptions)
navigate(route = ExportItemsGraphRoute, navOptions = navOptions)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@file:OmitFromCoverage

package com.x8bit.bitwarden.ui.vault.feature.exportitems.reviewexport

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import com.bitwarden.annotation.OmitFromCoverage
import com.bitwarden.ui.platform.base.util.composableWithPushTransitions
import kotlinx.serialization.Serializable

/**
* The type-safe route for the Review Export screen.
*
* This route is used to navigate to the screen where the user can review the items
* that will be exported from their vault. This screen operates on the currently
* active user context for determining which items to review for export.
*/
@OmitFromCoverage
@Serializable
data object ReviewExportRoute

/**
* Defines the destination for the Review Export screen within the navigation graph.
*
* This extension function on [NavGraphBuilder] sets up the [ReviewExportScreen]
* composable for the [ReviewExportRoute], using push transitions.
*
* @param navController The [NavController] used for handling back navigation from the screen.
*/
fun NavGraphBuilder.reviewExportDestination(
navController: NavController,
) {
composableWithPushTransitions<ReviewExportRoute> {
ReviewExportScreen(
onNavigateBack = { navController.popBackStack() },
)
}
}

/**
* Navigates to the Review Export screen.
*
* This extension function on [NavController] provides a type-safe way to navigate
* to the [ReviewExportRoute].
*
* @param navOptions Optional [NavOptions] for this navigation action.
*/
fun NavController.navigateToReviewExport(
navOptions: NavOptions? = null,
) {
navigate(route = ReviewExportRoute, navOptions = navOptions)
}
Loading