skipping account selection when only one exists on RootNav

This commit is contained in:
Andre Rosado 2025-10-20 15:10:37 +01:00
parent 4ff2f8163a
commit 855c54daa0
No known key found for this signature in database
GPG Key ID: 99F68267CCD45AA9
2 changed files with 25 additions and 2 deletions

View File

@ -68,6 +68,7 @@ import com.x8bit.bitwarden.ui.vault.feature.addedit.util.toVaultItemCipherType
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.exportitems.verifypassword.navigateToVerifyPassword
import com.x8bit.bitwarden.ui.vault.feature.itemlisting.navigateToVaultItemListingAsRoot
import com.x8bit.bitwarden.ui.vault.model.VaultAddEditType
import com.x8bit.bitwarden.ui.vault.model.VaultItemListingType
@ -142,7 +143,10 @@ fun RootNavScreen(
is RootNavState.VaultUnlockedForProviderGetCredentials,
-> VaultUnlockedGraphRoute
is RootNavState.CredentialExchangeExport -> ExportItemsGraphRoute
is RootNavState.CredentialExchangeExport,
is RootNavState.CredentialExchangeExportSkipAccountSelection,
-> ExportItemsGraphRoute
RootNavState.OnboardingAccountLockSetup -> SetupUnlockRoute.AsRoot
RootNavState.OnboardingAutoFillSetup -> SetupAutofillRoute.AsRoot
RootNavState.OnboardingBrowserAutofillSetup -> SetupBrowserAutofillRoute.AsRoot
@ -288,6 +292,13 @@ fun RootNavScreen(
is RootNavState.CredentialExchangeExport -> {
navController.navigateToExportItemsGraph(rootNavOptions)
}
is RootNavState.CredentialExchangeExportSkipAccountSelection -> {
navController.navigateToVerifyPassword(
userId = currentState.userId,
navOptions = rootNavOptions,
)
}
}
}
}

View File

@ -89,8 +89,12 @@ class RootNavViewModel @Inject constructor(
}
specialCircumstance is SpecialCircumstance.CredentialExchangeExport -> {
if (userState.accounts.size == 1) {
RootNavState.CredentialExchangeExportSkipAccountSelection(userId = userState.accounts.first().userId)
} else {
RootNavState.CredentialExchangeExport
}
}
userState.activeAccount.isVaultUnlocked &&
userState.shouldShowRemovePassword(authState = action.authState) -> {
@ -424,6 +428,14 @@ sealed class RootNavState : Parcelable {
*/
@Parcelize
data object CredentialExchangeExport : RootNavState()
/**
* App should begin the export items flow, skipping the account selection screen.
*/
@Parcelize
data class CredentialExchangeExportSkipAccountSelection(
val userId: String,
) : RootNavState()
}
/**