Skip to content

[PM-39767] feat: Persist Premium upgrade pending state across syncs and app restarts - #2916

Draft
KatherineInCode wants to merge 1 commit into
mainfrom
pm-39767/upgrade-state
Draft

[PM-39767] feat: Persist Premium upgrade pending state across syncs and app restarts#2916
KatherineInCode wants to merge 1 commit into
mainfrom
pm-39767/upgrade-state

Conversation

@KatherineInCode

Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

First of four stacked PRs addressing QA follow-up findings on PM-39767. This PR is the foundation only — no UI changes.

Today, whether a Premium upgrade is "pending" is tracked entirely by an ephemeral, per-checkout-attempt Combine subscription. Two consequences: (1) if a sync attempt fails outright, that failure is silently swallowed and indistinguishable from "still waiting, no error" — both produce the same .pending status; (2) a later, completely unrelated sync (e.g. Settings > Vault > Sync Now, or a sync triggered from the web vault) has no way to resolve a pending upgrade, since nothing generic is listening for it.

This PR moves pending/failure state into BillingService/BillingStateService, persisted per-account (AppSettingsStore-backed, survives app relaunch), and adds a start() subscription — following the existing AuthenticatorSyncService pattern — that reacts to any successful sync completing, not just the one that originated the checkout attempt. ServiceContainer gains one line kicking this off, mirroring how authenticatorSyncService.start() is already wired up. No AppProcessor or coordinator changes.

This PR has no user-visible behavior on its own — nothing yet reads the new state. Later PRs in the stack build the CTA visibility, "Sync unsuccessful" callout, and celebration-sheet UI on top of it.

📸 Screenshots

Not applicable — no UI changes.

…nd app restarts

Premium upgrade status ("pending"/"confirmed") was only tracked by an
ephemeral, per-checkout-attempt Combine subscription, and any sync failure
was silently swallowed and indistinguishable from "still waiting, no error."
This meant a later, unrelated sync (e.g. Settings > Vault > Sync Now, or a
sync triggered from the web vault) could never resolve a pending upgrade,
and there was no way to know a sync attempt had actually failed versus just
not finished yet.

BillingService now persists pending/failure state per-account via
BillingStateService, and watches sync completions generically (not just the
originating checkout attempt) so any successful sync can resolve a pending
upgrade. This is the foundation PR in a stack; later PRs build the CTA,
"Sync unsuccessful," and celebration-sheet UI on top of this state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:password-manager Bitwarden Password Manager app context t:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant