Skip to content

[PM-42025] fix: Show a toast after a vault item is saved - #2993

Open
andrebispo5 wants to merge 5 commits into
pm-41957-new-folder-added-snackbarfrom
pm-42025-license-saved-snackbar
Open

[PM-42025] fix: Show a toast after a vault item is saved#2993
andrebispo5 wants to merge 5 commits into
pm-41957-new-folder-added-snackbarfrom
pm-42025-license-saved-snackbar

Conversation

@andrebispo5

@andrebispo5 andrebispo5 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-42025

📔 Objective

  • Saving a license showed no "License saved" toast. Turns out no item type showed one; QA just happened to catch it on the license.
  • Nothing was wired up for it. itemAdded() also fires when you cancel out of the editor, so the toast couldn't just hang off the existing delegate methods.
  • Added an itemSaved(type:) delegate call that only fires after the item actually saves, plus a per-type title so each type gets its own wording.
  • The vault list, group list, and item view screens all show it now.
  • Found a second problem while testing: the item view rebuilds its whole state whenever the cipher changes, so saving wiped its own toast. That's fixed too, which also steadies the existing "Item saved" toast on that screen.

📸 Screenshots

Before

Screen.Recording.2026-08-26.at.12.57.58.mov

After

Screen.Recording.2026-08-26.at.13.03.43.mov

@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:bug Change Type - Bug labels Aug 26, 2026
@andrebispo5
andrebispo5 marked this pull request as ready for review August 26, 2026 12:20
@andrebispo5
andrebispo5 requested review from a team and matt-livefront as code owners August 26, 2026 12:20
Copilot AI lite review requested due to automatic review settings August 26, 2026 12:20
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the new itemSaved(type:) delegate hook on CipherItemOperationDelegate, its three implementations (VaultListProcessor, VaultGroupProcessor, ViewItemProcessor), the per-type CipherType.savedToastTitle mapping with its eight new localization keys, and the streamCipherDetails toast carry-over in ViewItemProcessor. The delegate default is a no-op, so the two non-adopting conformers (VaultItemSelectionProcessor, VaultAutofillListProcessor) stay silent in extension flows as expected, and calling itemSaved only after addCipher/updateCipher return keeps the toast off the cancel path that itemAdded() shares. The savedToastTitle switch has no default, so a future CipherType case fails to compile rather than silently falling through, and the eight keys are unique in en.lproj/Localizable.strings with no naming collisions. Carrying state.toast onto newState preserves the toast's id, so ToastView's .task timer is not restarted by an incoming cipher update.

Code Review Details
  • ❓ : Editing via a vault list row's ellipsis → Edit shows no saved toast, since DefaultVaultItemMoreOptionsHelper is not a CipherItemOperationDelegate
    • BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessor.swift:862

Copilot AI left a comment

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.

Pull request overview

Adds a new “item saved” delegate signal and per-item-type toast copy so users receive a confirmation toast after successfully saving a vault item (add or update), and prevents the View Item screen from losing its toast when cipher updates stream in.

Changes:

  • Introduces CipherItemOperationDelegate.itemSaved(type:) and triggers it only after successful add/update in AddEditItemProcessor.
  • Adds CipherType.savedToastTitle and new localized strings to provide per-type “X saved” toast titles.
  • Updates Vault list/group/view item processors (and tests) to display and preserve the appropriate save toast.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
BitwardenShared/UI/Vault/VaultItem/ViewItem/ViewItemProcessorTests.swift Adds coverage for itemSaved(type:) toast and toast persistence on .appeared.
BitwardenShared/UI/Vault/VaultItem/ViewItem/ViewItemProcessor.swift Preserves toast across cipher detail state rebuilds; shows per-type toast on save.
BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessorTests.swift Adds tests asserting save notifies delegate with saved type; ensures cancel doesn’t.
BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessor.swift Adds new delegate callback and invokes it after successful add/update.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessorTests.swift Adds test verifying list shows per-type saved toast.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessor.swift Implements itemSaved(type:) to show per-type toast.
BitwardenShared/UI/Vault/Vault/VaultGroup/VaultGroupProcessorTests.swift Adds test verifying group shows per-type saved toast and refreshes.
BitwardenShared/UI/Vault/Vault/VaultGroup/VaultGroupProcessor.swift Implements itemSaved(type:) to show per-type toast + refresh.
BitwardenShared/Core/Vault/Models/Enum/CipherTypeTests.swift Adds unit test for savedToastTitle mapping.
BitwardenShared/Core/Vault/Models/Enum/CipherType.swift Adds savedToastTitle mapping from CipherType to localized toast title.
BitwardenResources/Localizations/en.lproj/Localizable.strings Adds new English localization keys for per-type “saved” toasts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +2441 to +2442
/// `receive(_:)` with `.dismiss()` navigates to the `.dismiss()` route without notifying the
/// delegate that the item was saved, so that cancelling doesn't show a confirmation toast.
state.toast = Toast(title: Localizations.itemDeleted)
}

func itemSaved(type: CipherType) {

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.

QUESTION: Was the more-options "Edit" path intentionally left without a toast?

Details

The vault list and group list reach the editor by two routes. Tapping a row goes through ViewItemProcessor, which now shows the toast. But the row's ellipsis → Edit goes through DefaultVaultItemMoreOptionsHelper:

// VaultItemMoreOptionsHelper.swift:230
case let .edit(cipherView):
    self.coordinator.navigate(to: .editItem(cipherView), context: self)

VaultCoordinator resolves that context with context as? CipherItemOperationDelegate (VaultCoordinator.swift:232), and DefaultVaultItemMoreOptionsHelper does not conform to that protocol, so AddEditItemProcessor.delegate is nil and itemSaved(type:) never fires.

Net effect after this change: adding an item from the vault list shows a toast, editing via row → view → edit shows a toast, but editing via row → ellipsis → Edit → Save shows nothing. Before this PR all three were silent, so the inconsistency is new.

The helper already has a handleDisplayToast channel it uses for copy/archive/unarchive, so wiring the save confirmation through it is one option — happy to defer if this path is planned as follow-up work.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.54%. Comparing base (d6afc9d) to head (8b84dcb).

Files with missing lines Patch % Lines
...t/VaultItem/AddEditItem/AddEditItemProcessor.swift 75.00% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           pm-41957-new-folder-added-snackbar    #2993      +/-   ##
======================================================================
+ Coverage                               79.52%   79.54%   +0.01%     
======================================================================
  Files                                    1169     1169              
  Lines                                   75112    75141      +29     
======================================================================
+ Hits                                    59733    59769      +36     
+ Misses                                  15379    15372       -7     

☔ View full report in Codecov by Harness.
📢 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.

@andrebispo5
andrebispo5 force-pushed the pm-42025-license-saved-snackbar branch from 2edc24a to 8b84dcb Compare August 27, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants