Skip to content

[PM-34123] feat: Update New item menu with item type selection screen#6854

Closed
SaintPatrck wants to merge 1 commit intonew-item-types/PM-32806_passportfrom
new-item-types/PM-34123_new-item-menu
Closed

[PM-34123] feat: Update New item menu with item type selection screen#6854
SaintPatrck wants to merge 1 commit intonew-item-types/PM-32806_passportfrom
new-item-types/PM-34123_new-item-menu

Conversation

@SaintPatrck
Copy link
Copy Markdown
Contributor

@SaintPatrck SaintPatrck commented Apr 29, 2026

🎟️ Tracking

PM-34123 — fourth Android Story under epic PM-32009 (New Item Types).

Stacked on #6853 (PM-32806 Passport)#6852 (PM-32808 DL)#6851 (PM-32810 Bank Account). Review and merge order: PM-32810 → PM-32808 → PM-32806 → PM-34123 → PM-35396.

📔 Objective

Replaces the existing "New" dropdown menu in the vault with a dedicated ItemTypeSelectionScreen when the pm-32009-new-item-types feature flag is enabled. The new screen lists all eight cipher types (Login, Card, Identity, Note, SSH Key, Bank Account, Driver's License, Passport) with a tap target per type leading into the appropriate AddEdit flow.

The existing dropdown (five legacy types) remains the only path when the flag is OFF, preserving production behavior. The selection screen is unreachable while the flag is disabled.

This brings Android in line with Web, Desktop, and Browser, which have already replaced their "New" dropdowns with dedicated selection surfaces — the dropdown becomes too tall once the eight types are added.

Behavior

  • Flag ON: tapping "New" emits VaultEvent.NavigateToItemTypeSelectionItemTypeSelectionScreen → AddEdit screen for the selected type.
  • Flag OFF: tapping "New" continues to open the legacy dropdown menu with the original five types only.

📸 Screenshots

UI screenshots will be added before this PR is moved out of draft.

The legacy "New" dropdown menu becomes too crowded once Bank Account,
Driver's License, and Passport cipher types are introduced. Sibling
clients (Web, Desktop, Browser) already replace the dropdown with a
dedicated selection screen, so this change brings Android in line.

Behavior is gated on the pm-32009-new-item-types feature flag:
- When ON, tapping "New" navigates to the dedicated
  ItemTypeSelectionScreen, which lists all eight cipher types and
  forwards the selection on to the AddEdit flow.
- When OFF, the existing dropdown remains exactly as it is today,
  and the new screen is unreachable.

Keeping the gate at the call site means we can roll the new UX out
independently of the per-type Stories that have already shipped, and
we preserve a clean rollback path until the new types are GA.
@SaintPatrck SaintPatrck added the ai-review-vnext Request a Claude code review using the vNext workflow label Apr 29, 2026
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development labels Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: REQUEST CHANGES

This PR introduces a new ItemTypeSelectionScreen that replaces the legacy "New" dropdown when the pm-32009-new-item-types feature flag is enabled, listing all eight cipher types. The MVVM/UDF wiring (state, action, event, navigation) follows established Bitwarden patterns and unit + screen tests cover the new flows. However, the change unconditionally bypasses the RESTRICT_ITEM_TYPES policy for users on the new flag, which is a regression from the legacy dropdown's behavior.

Code Review Details
  • ⚠️ : RESTRICT_ITEM_TYPES policy is bypassed on the new selection screen — CARD is shown to users whose org has the policy active, regressing legacy dropdown behavior
    • app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt:442

Comment on lines +442 to +445
if (isNewItemTypesEnabled) {
sendEvent(VaultEvent.NavigateToItemTypeSelection)
return
}
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.

⚠️ IMPORTANT: RESTRICT_ITEM_TYPES policy is bypassed when the new item types flag is enabled.

Details and fix

Before this PR, when RESTRICT_ITEM_TYPES is active for any organization the legacy dropdown excluded CARD (line 451 still does this). The early return now skips that filter entirely and unconditionally navigates to ItemTypeSelectionScreen, which renders all eight types (including CARD) regardless of policy state. The new test on VaultViewModelTest.kt:3637-3659 codifies this behavior: an active RESTRICT_ITEM_TYPES policy is asserted to still navigate straight through.

Because ItemTypeSelectionViewModel has no policy input and the AddEdit flow does not enforce RESTRICT_ITEM_TYPES either (only applyRestrictItemTypesPolicy in VaultDataExtensions.kt and the export/import flows do), an enterprise user under this policy can now reach the Card add-item screen by tapping NewCard.

Suggested fix: pass restrictItemTypesPolicyOrgIds (or a derived excludedTypes set) into ItemTypeSelectionState so the screen filters out CARD when the policy is active, mirroring the legacy dropdown's behavior.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 56.52174% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.86%. Comparing base (937920a) to head (8386162).

Files with missing lines Patch % Lines
...ature/itemtypeselection/ItemTypeSelectionScreen.kt 0.00% 38 Missing ⚠️
...den/ui/vault/feature/vault/VaultGraphNavigation.kt 14.28% 6 Missing ⚠️
...e/itemtypeselection/ItemTypeSelectionNavigation.kt 28.57% 5 Missing ⚠️
...re/itemtypeselection/ItemTypeSelectionViewModel.kt 98.21% 1 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                          @@
##           new-item-types/PM-32806_passport    #6854      +/-   ##
====================================================================
- Coverage                             83.91%   83.86%   -0.06%     
====================================================================
  Files                                   849      852       +3     
  Lines                                 61396    61508     +112     
  Branches                               8921     8924       +3     
====================================================================
+ Hits                                  51522    51584      +62     
- Misses                                 6830     6880      +50     
  Partials                               3044     3044              
Flag Coverage Δ
app-data 16.99% <0.00%> (-0.04%) ⬇️
app-ui-auth-tools 19.43% <0.00%> (-0.04%) ⬇️
app-ui-platform 15.34% <2.67%> (-0.03%) ⬇️
app-ui-vault 25.74% <55.35%> (+0.05%) ⬆️
authenticator 6.39% <0.00%> (-0.02%) ⬇️
lib-core-network-bridge 4.11% <0.00%> (-0.02%) ⬇️
lib-data-ui 0.98% <0.00%> (-0.01%) ⬇️

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.

@SaintPatrck SaintPatrck closed this May 7, 2026
@SaintPatrck SaintPatrck deleted the new-item-types/PM-34123_new-item-menu branch May 7, 2026 19:42
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: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