Skip to content

[PM-32009] feat: Add add/edit and view UI for new cipher types#6829

Draft
SaintPatrck wants to merge 4 commits intonew-item-types/phase-01-04_infrastructurefrom
new-item-types/phase-05-07_cipher-type-ui
Draft

[PM-32009] feat: Add add/edit and view UI for new cipher types#6829
SaintPatrck wants to merge 4 commits intonew-item-types/phase-01-04_infrastructurefrom
new-item-types/phase-05-07_cipher-type-ui

Conversation

@SaintPatrck
Copy link
Copy Markdown
Contributor

@SaintPatrck SaintPatrck commented Apr 23, 2026

🎟️ Tracking

PM-32009

📔 Objective

Second of three stacked PRs. Builds the Compose add/edit forms, view screens, and associated handlers for Bank Account, Driver's License, and Passport on top of the infrastructure landed in #6828.

Kept separate from the vault-integration PR so reviewers can focus on screen-level concerns — field layouts, masking, handlers, and ViewModel state — without also triaging listing/search/navigation changes.

Why it looks the way it does

  • Bank Account account number and PIN default to hidden with reveal controls, matching the existing Card type's treatment of sensitive fields. Copy actions are wired through the same handler pattern so future auditing and analytics stay consistent.
  • Driver's License and Passport use month/year pickers (rather than a free-form date field) because issuance/expiration at the document level is typically known only to month precision, and this avoids introducing a day-level schema the server doesn't track.
  • Per-type handler classes (Vault…TypeHandlers) isolate each new type's action plumbing from VaultAddEditViewModel and VaultItemViewModel, which already carry significant complexity for Login/Card/Identity/SecureNote. Keeping new surface area out of those files reduces merge risk with parallel cipher-type work.
  • Nothing is user-visible yet: the feature flag from [PM-32009] feat: Add infrastructure for new vault item types #6828 still gates entry points. This PR can merge independently of the vault-integration PR.

Stacked on: #6828
Followed by: new-item-types/phase-08-11_vault-integration (vault listing, search, item-type selection)

📸 Screenshots

To be added before marking ready for review.

…nd Passport cipher types

Implements Phases 5-7 of the new item types feature: Compose add/edit
forms, view screens, ViewModel actions/handlers, and handler classes
for all three new cipher types. Includes hidden field masking for
Bank Account (account number, PIN), copy actions, account type
dropdown, and month/year date pickers for Driver's License and
Passport date fields.
Fix typographic apostrophes in 5 driver's license strings, sort
import statements alphabetically in 5 files, document hardcoded
strings in VaultBankAccountTypeExtensions as SDK/network values,
and add 6 VaultItemViewModel tests for Bank Account view actions.
Add 9 missing ViewModel action tests: 3 for Driver's License
(MiddleName, IssuingState, LicenseClass) and 6 for Passport
(DobYear, PassportType, IssuingCountry, IssuingAuthority,
IssueYear, ExpirationYear). Re-add month/year string resources
that were lost during prior string edits.
@SaintPatrck SaintPatrck added the ai-review-vnext Request a Claude code review using the vNext workflow label Apr 23, 2026
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:feature Change Type - Feature Development labels Apr 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the Phase 5–7 UI implementation for Bank Account, Driver's License, and Passport cipher types. The changes introduce add/edit Compose screens, view screens, per-type handler classes, and ViewModel wiring, faithfully mirroring established patterns from the existing Card/Identity/SshKey types (updateContent helpers, create-factory handler data classes, Action.ItemType sealed hierarchy, rememberSaveable visibility toggles for sensitive fields). Feature flag gating from #6828 is preserved — the new types remain correctly excluded from CreateVaultItemType options when NewItemTypes is disabled, as verified by the updated VaultViewModelTest and VaultItemListingViewModelTest. Test coverage for the new ViewModel action branches is broad; bank-account copy/visibility flows have clipboard and state-update assertions.

Code Review Details
  • 🎨 : Passport screen composes month/year labels via stringResource(...) + " - " + stringResource(...), which breaks localization and is inconsistent with VaultAddEditDriversLicenseItems.kt using expiration_month / expiration_year directly
    • app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditPassportItems.kt:80

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 24.85755% with 1055 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.19%. Comparing base (5f659d4) to head (acd414c).

Files with missing lines Patch % Lines
.../vault/feature/item/VaultItemBankAccountContent.kt 0.00% 209 Missing ⚠️
...vault/feature/addedit/VaultAddEditPassportItems.kt 0.00% 174 Missing ⚠️
.../ui/vault/feature/item/VaultItemPassportContent.kt 0.00% 157 Missing ⚠️
...lt/feature/addedit/VaultAddEditBankAccountItems.kt 0.00% 123 Missing ⚠️
...ult/feature/item/VaultItemDriversLicenseContent.kt 0.00% 115 Missing ⚠️
...feature/addedit/VaultAddEditDriversLicenseItems.kt 0.00% 104 Missing ⚠️
...warden/ui/vault/feature/item/VaultItemViewModel.kt 70.58% 21 Missing and 9 partials ⚠️
...dedit/handlers/VaultAddEditPassportTypeHandlers.kt 51.85% 26 Missing ⚠️
...it/handlers/VaultAddEditBankAccountTypeHandlers.kt 52.00% 24 Missing ⚠️
...bitwarden/ui/vault/feature/item/VaultItemScreen.kt 22.22% 21 Missing ⚠️
... and 5 more
Additional details and impacted files
@@                              Coverage Diff                              @@
##           new-item-types/phase-01-04_infrastructure    #6829      +/-   ##
=============================================================================
- Coverage                                      85.32%   84.19%   -1.13%     
=============================================================================
  Files                                            834      847      +13     
  Lines                                          59179    60462    +1283     
  Branches                                        8611     8711     +100     
=============================================================================
+ Hits                                           50492    50904     +412     
- Misses                                          5708     6556     +848     
- Partials                                        2979     3002      +23     
Flag Coverage Δ
app-data 16.99% <0.00%> (-0.41%) ⬇️
app-ui-auth-tools 19.77% <0.00%> (-0.49%) ⬇️
app-ui-platform 15.08% <0.00%> (-0.38%) ⬇️
app-ui-vault 25.90% <24.85%> (+0.06%) ⬆️
authenticator 6.49% <0.00%> (-0.18%) ⬇️
lib-core-network-bridge 4.15% <0.00%> (-0.10%) ⬇️
lib-data-ui 1.00% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Comment on lines +80 to +81
label = stringResource(id = BitwardenString.date_of_birth) + " - " +
stringResource(id = BitwardenString.month),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎨 SUGGESTED: String concatenation for field labels hampers localization and is inconsistent with the sibling screen.

Details and fix

The six month/year labels in this file build their text by concatenating two stringResource(...) calls with a hard-coded " - " separator (e.g. lines 80–81, 106–107, 190–191, 216–217, 235–236, 261–262). Two problems:

  1. Localization — concatenating translated fragments with a hard-coded separator produces labels that cannot be reordered for languages with different word order (e.g. Japanese, German compounds). The established pattern elsewhere in the module is a single, fully-translated string per label.
  2. Inconsistency with VaultAddEditDriversLicenseItems.kt — the sibling screen uses BitwardenString.expiration_month / expiration_year directly (line 132, 157). VaultAddEditPassportItems.kt builds "Expiration date - Month" the hard way despite the same string resources existing.

Minimal fix: use the existing expiration_month / expiration_year resources for the expiration rows, and introduce dedicated strings (e.g. date_of_birth_month, date_of_birth_year, issue_month, issue_year) for the DOB and issue rows — or use a parameterized format string ("%1$s - %2$s") so translators can control ordering.

@github-actions
Copy link
Copy Markdown
Contributor

Logo
Checkmarx One – Scan Summary & Details946f1c33-6708-4fd5-a7ee-2fda2605501c

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant