[PM-32807] feat: wire Driver's License through BitwardenSdk#2577
Draft
SaintPatrck wants to merge 5 commits into
Draft
[PM-32807] feat: wire Driver's License through BitwardenSdk#2577SaintPatrck wants to merge 5 commits into
SaintPatrck wants to merge 5 commits into
Conversation
…M-32809 Part 1/3) First of three vertical slices for PM-32809. Establishes the type- level foundation for the Bank Account cipher type without touching the vault-list plumbing (Part 2/3) or the add/edit/view UI surfaces (Part 3/3). Included: - `FeatureFlag.newItemTypes` (`pm-32009-new-item-types`) added to the flag registry. Gates the epic's three new cipher types at the flag layer; default OFF. - `CipherType.bankAccount = 6` added alongside `allCases`, `localizedName`, `allowedFieldTypes` (text / hidden / boolean — `.linked` is excluded per US-1.1), and the new `iconPlaceholder` helper that centralizes icon routing for PM-34128's eventual asset swap. - `CipherType.init(type:)` and `CipherType.init(_:)` become failable (`init?`) with `@unknown default: return nil`, so future SDK bumps no longer force a closed-switch compile break on unrelated PRs. Cascade `?? .secureNote` fallbacks land at the five existing call sites (`CipherItemState` clone / existing / apply, `CipherView+ Update.updatedView`, `CipherRequestModel`, `BitwardenSdk+Vault` response-model inits, `ExportVaultService` restricted-type filter). - `canCreateCasesBase` / `canCreateCasesWithNewItemTypes` constants plus the flag-aware `canCreateCases(isNewItemTypesEnabled:)` helper. The legacy static `canCreateCases` is gone; Part 2/3 wires the helper through `VaultRepository.getItemTypesUserCanCreate()`. - `BankAccountType` raw-value enum (Checking / Savings / CD / LineOfCredit / InvestmentBrokerage / MoneyMarket / Other). Ships without `Menuable` conformance in Part 1 — that conformance (and the seven display-name localization keys it depends on) lands in Part 3/3 when the menu field consumes it. - `CipherBankAccountModel` API model (Codable, Equatable, Sendable) with an explicit memberwise init defaulting every parameter to `nil`. Carries the serialization-tripwire docstring so future-you knows the model must never reach the wire directly — only through SDK encryption once the SDK exposes `BankAccount` / `BankAccountView`. - `CipherDetailsResponseModel` / `CipherMiniResponseModel` each gain `var bankAccount: CipherBankAccountModel? = nil` with the swiftformat/swiftlint pins that keep the `= nil` alive, so the synthesized memberwise init remains source-compatible with all pre-PM-32009 test call sites. - `NewItemTypesSdkBridge` (stateless enum shim) centralizes SDK- availability gating. `isBankAccountAvailable` is the single switch to flip when the SDK dependency is bumped; `sdkCipherTypeForBank Account()` and `appCipherTypeForBankAccount(_:)` route the conversions. PRs 2 and 3 (Driver's License, Passport) will extend this shim. - `BitwardenSdk.CipherType(_:)` becomes failable with a Debug-build `assertionFailure` tripwire on the `.bankAccount → nil` path so accidentally enabling the flag before SDK readiness is caught in development. - `ViewItemState.navigationTitle` gets a `.bankAccount` arm using `Localizations.viewBankAccount`; `CipherItemState.navigationTitle` uses `Localizations.newItem` / `Localizations.edit` as Part 1 placeholders — Part 3/3 replaces those with `newBankAccount` / `editBankAccount`. - `LinkedIdType.getLinkedIdType(for:)` gains an empty-array arm for `.bankAccount` so the exhaustive switch keeps compiling. Tests: `BankAccountTypeTests` (raw values, ordering, JSON round-trip), `CipherBankAccountModelTests` (memberwise init, Codable round-trip), expanded `CipherTypeTests` (`canCreateCasesBase`, `canCreateCasesWithNewItemTypes`, `canCreateCases(isNewItemTypesEnabled:)`, `.bankAccount` on `allowedFieldTypes` / `localizedName` / `allCases`). Localization: ONLY `TypeBankAccount` and `ViewBankAccount` added. Field labels, account-type display names, and processor alert strings are deferred to the Part 2/3 and Part 3/3 slices that introduce the UI consuming them. SDK dependency: `BitwardenSdk` currently stops at `CipherType.sshKey = 5` with no `BankAccount` / `BankAccountView`. All SDK-facing paths are gated through `NewItemTypesSdkBridge` and TODO-marked with `PM-32009 Blocked on SDK`. The flag must remain OFF until the SDK is bumped — coordinate with PM-34060 (Nick Krantz's cross-platform SDK work). Ticket: PM-32809 (Part 1/3)
Folds in the two non-blocking nits from review Round 2: - `CipherItemState.swift`: Add the parallel `// TODO: PM-32809 Part 3/3` comment to the `.add → .bankAccount` branch so both the new/edit placeholder strings get picked up atomically when Part 3/3 swaps in `Localizations.newBankAccount` / `Localizations.editBankAccount`. - `BankAccountType.swift`: Drop the unused `import BitwardenResources`. The `Menuable` conformance (which needs the localization keys) is deferred to Part 3/3; the raw enum in Part 1 doesn't need the import. Also tightens three cascade breaks that appeared after the previous build pass — all stem from `CipherType.bankAccount` becoming a case on an exhaustive switch / a renamed static: - `View.swift`, `VaultListState.swift`, `VaultGroupState.swift`: the three default-parameter sites that previously pointed at the legacy `CipherType.canCreateCases` static (now removed in favor of the flag-aware helper) now seed from `CipherType.canCreateCasesBase`. The processors continue to override these defaults via `VaultRepository.getItemTypesUserCanCreate()` — that wiring lands in Part 2/3. - `AddEditItemView.swift` (`itemTypeSection`) and `ViewItemDetailsView.swift` (`itemInformationSection`): add an `EmptyView()` placeholder for `.bankAccount` so the exhaustive switch compiles. Creation is flag-gated upstream, so these branches are unreachable until Part 3/3 wires the real `AddEditBankAccountItemView` / `ViewBankAccountItemView` — TODOs pinned at both sites. Ticket: PM-32809 (Part 1/3)
Relies solely on the `newItemTypes` feature flag to gate bank account creation end-to-end. Adds the final PM-34128 bank account icon asset.
Stages the CipherType.bankAccount case and SDK bridge arms so the upcoming sdk-swift release (2.0.0-6370-96753eef) is a drop-in bump.
Stages the CipherType.driversLicense case and SDK bridge arms so the upcoming sdk-swift release is a drop-in bump. Field list per the finalized UI design; pending server contract confirmation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## vault/pm-32809-ios-bank-account-sdk-bridge #2577 +/- ##
=============================================================================
Coverage ? 41.72%
=============================================================================
Files ? 590
Lines ? 32485
Branches ? 0
=============================================================================
Hits ? 13554
Misses ? 18931
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fd12e9a to
63e43de
Compare
3fc9490 to
27546dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎟️ Tracking
📔 Objective
Stage the
CipherType.driversLicensecase and SDK bridge arms for Driver's License so the sdk-swift bump lands this type as a drop-in. Held withholduntil the SDK release is available. Field list follows the finalized UI design (including day components for dates); pending server contract confirmation.