Skip to content

Conversation

@SaintPatrck
Copy link
Contributor

@SaintPatrck SaintPatrck commented Sep 19, 2025

🎟️ Tracking

PM-25825

πŸ“” Objective

Implement navigation for the Import items screen.

Upon completion of the import process a Snackbar or Dialog is displayed to inform the user of the result.

If the import and re-sync is successful a Snackbar is displayed, informing the user how many items were imported.

If the import is successful but sync fails, a Snackbar is displayed, along with an option to retry sync.

If the import process cannot complete, a dialog is displayed prompting the user to try again or contact support.

Additionally, the VAULT_SYNC_FAILED Snackbar relay has been removed as it is no longer necessary.

πŸ“Έ Screenshots

Screen_recording_20250922_152043.mp4

@github-actions
Copy link
Contributor

github-actions bot commented Sep 19, 2025

Logo
Checkmarx One – Scan Summary & Details – d14970f2-3bf6-4714-be56-4a96d6c289ae

Great job! No new security vulnerabilities introduced in this pull request

@SaintPatrck SaintPatrck added the hold do not merge yet label Sep 19, 2025
david-livefront and others added 7 commits September 19, 2025 13:58
…Vault screen

This commit refactors the navigation flow by removing the direct navigation options to "My Vault" and "Import Items" from the main Vault screen and related areas.

Specific changes include:
- Removed `onNavigateToMyVault` and `onNavigateToImportItems` parameters and their usages from `VaultNavigation.kt`, `VaultScreen.kt`, `VaultGraphNavigation.kt`, and `VaultUnlockedNavBarScreen.kt`.
- Removed `NavigateToMyVault` and `NavigateToImportItems` events from `VaultViewModel.kt`.
- Updated `ImportItemsNavigation.kt` to rename `navigateToImportItemsGraph` to `navigateToImportItemsScreen` and removed `onNavigateToMyVault` from `importItemsDestination`.
- Modified `ImportItemsViewModel.kt` and `ImportItemsScreen.kt` to handle sync failures with a "Try Again" option and display snackbars for import/sync status, removing the automatic navigation to the vault after import.
- Adjusted tests in `ImportItemsViewModelTest.kt`, `ImportItemsScreenTest.kt`, and `VaultUnlockedNavBarScreenTest.kt` to reflect these navigation and UI changes.
- Updated `SettingsNavigation.kt` to remove `onNavigateToMyVault` parameter from `settingsGraph`.
- Removed `navigateToVaultGraphRoot` from `VaultGraphNavigation.kt`.
This commit refactors the navigation to the import logins screen.
The `onNavigateToImportLogins` parameter is now passed down from the `settingsGraph` to the `importItemsDestination`.
This makes the navigation more explicit and easier to follow.
This commit removes an unused import of `NavHostController` from `VaultUnlockedNavBarNavigation.kt`.
@SaintPatrck SaintPatrck marked this pull request as ready for review September 22, 2025 19:27
@SaintPatrck SaintPatrck changed the title Add ImportItems navigation [PM-25825] Add ImportItems navigation Sep 22, 2025
data = BitwardenSnackbarData(
message = BitwardenString.syncing_complete.asText(),
),
relay = SnackbarRelay.LOGINS_IMPORTED,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this VM sending this to itself?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just send the ShowBasicSnackbar event here?

onNavigateToFolders = { onNavigateToFoldersCalled = true },
onNavigateToImportLogins = { onNavigateToImportLoginsCalled = true },
onNavigateToImportItems = { onNavigateToImportItemsCalled = true },

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we drop this newline

private fun createViewModel(): VaultSettingsViewModel = VaultSettingsViewModel(
firstTimeActionManager = firstTimeActionManager,
snackbarRelayManager = snackbarRelayManager,
featureFlagManager = featureFlagManager,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we have a test for when the flag is set or not set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed!

message = BitwardenString
.your_items_have_been_successfully_imported_but_could_not_sync_vault
.asText(),
actionLabel = BitwardenString.try_again.asText(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing here, would this event be needed anywhere. I assume that if the import process fails, we would not navigate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Now that we're not navigating we can trigger these locally. πŸš€

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sweet, same thing for the failure too, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct. We no longer need the snackbar relay manager or the VAULT_SYNC_FAILURE either, since everything is contained in the VM.

This commit refactors the `ImportItemsViewModel` to remove its dependency on `SnackbarRelayManager`. Snackbar events are now sent directly as `ImportItemsEvent`s.

This change simplifies the ViewModel's logic and removes the need for `SnackbarRelayManager` in this context. Tests have been updated to reflect these changes.

#5915 (comment)
The `ImportItemsClick` action in `VaultSettingsViewModelTest` now checks the `CredentialExchangeProtocolImport` feature flag.
- If the flag is disabled, it emits `NavigateToImportVault`.
- If the flag is enabled, it emits `NavigateToImportItems`.

#5915 (comment)
This commit removes an unnecessary blank line from the `VaultSettingsScreenTest.kt` file.

#5915 (comment)
@SaintPatrck SaintPatrck removed the hold do not merge yet label Sep 22, 2025
LOGINS_IMPORTED,
SEND_DELETED,
SEND_UPDATED,
VAULT_SYNC_FAILED,
Copy link
Collaborator

Choose a reason for hiding this comment

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

πŸ‘

@codecov
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

❌ Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.
βœ… Project coverage is 84.25%. Comparing base (ad46d8d) to head (7fda17d).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../ui/vault/feature/importitems/ImportItemsScreen.kt 41.66% 7 Missing ⚠️
...ui/platform/feature/settings/SettingsNavigation.kt 75.00% 1 Missing ⚠️
.../feature/settings/vault/VaultSettingsNavigation.kt 0.00% 1 Missing ⚠️
...form/feature/settings/vault/VaultSettingsScreen.kt 0.00% 0 Missing and 1 partial ⚠️
...e/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5915      +/-   ##
==========================================
+ Coverage   84.23%   84.25%   +0.01%     
==========================================
  Files         729      713      -16     
  Lines       54011    53671     -340     
  Branches     7389     7395       +6     
==========================================
- Hits        45497    45221     -276     
+ Misses       5912     5854      -58     
+ Partials     2602     2596       -6     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SaintPatrck SaintPatrck added this pull request to the merge queue Sep 22, 2025
Merged via the queue into main with commit 8a2bcfa Sep 22, 2025
9 checks passed
@SaintPatrck SaintPatrck deleted the cxf/app/import-logins-navigation branch September 22, 2025 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants