Skip to content

[PM-33849] feat: Add Premium Upgrade view#2523

Open
andrebispo5 wants to merge 22 commits intomainfrom
pm-33849/premium-upgrade-view
Open

[PM-33849] feat: Add Premium Upgrade view#2523
andrebispo5 wants to merge 22 commits intomainfrom
pm-33849/premium-upgrade-view

Conversation

@andrebispo5
Copy link
Copy Markdown
Contributor

@andrebispo5 andrebispo5 commented Apr 6, 2026

🎟️ Tracking

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

📔 Objective

Adds the Premium Upgrade view that allows users to upgrade to a premium plan via Stripe checkout.

Changes

  • New PremiumUpgrade feature (BitwardenShared/UI/Billing/PremiumUpgrade/):
    • PremiumUpgradeView - Displays premium pricing, features list, and upgrade button
    • PremiumUpgradeProcessor - Handles upgrade button tap by creating a Stripe checkout session
    • PremiumUpgradeCoordinator / PremiumUpgradeModule - Navigation management
    • PremiumUpgradeAction, PremiumUpgradeEffect, PremiumUpgradeRoute, PremiumUpgradeState
  • Vault integration: Added .premiumUpgrade route and .upgradeToPremium action to VaultList
  • Testing: Added BillingAPIService mock support to ServiceContainer
  • Localization: Added 8 new strings for premium upgrade UI

📸 Screenshots

New
Simulator Screenshot - iPhone 17 Pro - 2026-04-06 at 17 42 19

Copilot AI review requested due to automatic review settings April 6, 2026 17:40
@andrebispo5 andrebispo5 requested review from a team and matt-livefront as code owners April 6, 2026 17:40
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:misc Change Type - ¯\_(ツ)_/¯ t:feature labels Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

Logo
Checkmarx One – Scan Summary & Detailsfc8fd993-f037-4080-a61a-25bc2d36d2a7

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 Billing UI flow for upgrading to Premium via Stripe checkout, and wires it into the Vault tab navigation so users can reach the upgrade screen from the vault list.

Changes:

  • Introduces a new PremiumUpgrade feature (view/state/processor/coordinator/module) that requests a Stripe checkout session and opens the returned URL.
  • Integrates Premium Upgrade navigation into the Vault tab (VaultRoute, VaultCoordinator, VaultListAction/VaultListProcessor).
  • Extends test infrastructure to support mocking BillingAPIService and adds unit tests + localization strings for the new UI.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
GlobalTestHelpers/MockAppModule.swift Adds mock coordinator/module support for the Premium Upgrade flow in tests.
BitwardenShared/UI/Vault/Vault/VaultRoute.swift Adds a new .premiumUpgrade route for Vault navigation.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessor.swift Handles new .upgradeToPremium action by navigating to the upgrade route.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListAction.swift Adds upgradeToPremium action to trigger the Premium Upgrade flow.
BitwardenShared/UI/Vault/Vault/VaultCoordinator.swift Presents the Premium Upgrade coordinator when navigating to .premiumUpgrade.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeView.swift New SwiftUI screen showing pricing/features and launching Stripe checkout.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeState.swift New state backing the Premium Upgrade UI (loading + checkout URL).
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeRoute.swift Defines the route(s) for the Premium Upgrade coordinator (dismiss).
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeProcessorTests.swift Unit tests for checkout session creation, error handling, and actions.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeProcessor.swift Implements the async checkout session request + navigation actions.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeModule.swift Adds a module factory method to build the Premium Upgrade coordinator.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeEffect.swift Defines the effect(s) for triggering checkout session creation.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeCoordinatorTests.swift Unit tests for coordinator start and dismiss navigation behavior.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeCoordinator.swift Coordinator that installs the Premium Upgrade view and handles dismiss.
BitwardenShared/UI/Billing/PremiumUpgrade/PremiumUpgradeAction.swift Actions for cancel + clearing the opened checkout URL.
BitwardenShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift Adds optional mock injection for BillingAPIService in test containers.
BitwardenShared/Core/Platform/Services/Services.swift Reorders HasBillingAPIService in the shared Services typealias.
BitwardenShared/Core/Platform/Services/ServiceContainer.swift Adds billingAPIServiceOverride and uses it when resolving billingAPIService.
BitwardenResources/Localizations/en.lproj/Localizable.strings Adds new English strings for Premium Upgrade UI text.
BitwardenKit/Application/TestHelpers/ServiceContainer.swift Minor typealias ordering cleanup for test services.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +67 to +73
defer { state.isLoading = false }
do {
state.isLoading = true
let response = try await services.billingAPIService.createCheckoutSession()
state.checkoutURL = response.checkoutSessionUrl
} catch {
services.errorReporter.log(error: error)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

state.isLoading is cleared via defer, but because the catch path awaits coordinator.showErrorAlert, the loading state will remain true until after the alert flow completes. This can leave the UI disabled/spinning while the error alert is onscreen. Consider setting isLoading = false before awaiting the error alert (or avoid defer and explicitly reset loading in both success and failure paths).

Suggested change
defer { state.isLoading = false }
do {
state.isLoading = true
let response = try await services.billingAPIService.createCheckoutSession()
state.checkoutURL = response.checkoutSessionUrl
} catch {
services.errorReporter.log(error: error)
do {
state.isLoading = true
let response = try await services.billingAPIService.createCheckoutSession()
state.isLoading = false
state.checkoutURL = response.checkoutSessionUrl
} catch {
services.errorReporter.log(error: error)
state.isLoading = false

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +32
/// An optional override for the billing API service, used for testing.
var billingAPIServiceOverride: BillingAPIService?

Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

billingAPIServiceOverride introduces a mutable test-only escape hatch on the production ServiceContainer. To keep the override from being modified outside test helpers, consider tightening access (e.g., private(set) / private) and injecting the override via an initializer or a dedicated test-only API (possibly behind #if DEBUG).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks forgot to delete this.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 87.47100% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.96%. Comparing base (ece60f7) to head (408ecd6).

Files with missing lines Patch % Lines
...miumUpgrade/PremiumUpgradeView+SnapshotTests.swift 0.00% 18 Missing ⚠️
...Shared/Core/Billing/Models/Enum/BillingError.swift 0.00% 8 Missing ⚠️
...UI/Billing/PremiumUpgrade/PremiumUpgradeView.swift 92.66% 8 Missing ⚠️
...wardenShared/UI/Vault/Vault/VaultCoordinator.swift 12.50% 7 Missing ⚠️
.../Billing/PremiumUpgrade/PremiumUpgradeModule.swift 0.00% 6 Missing ⚠️
...ed/Core/Billing/Services/BillingServiceTests.swift 94.64% 3 Missing ⚠️
GlobalTestHelpers/MockAppModule.swift 25.00% 3 Missing ⚠️
...ing/PremiumUpgrade/PremiumUpgradeCoordinator.swift 95.65% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2523      +/-   ##
==========================================
- Coverage   87.08%   85.96%   -1.12%     
==========================================
  Files        1862     2104     +242     
  Lines      165404   180636   +15232     
==========================================
+ Hits       144042   155290   +11248     
- Misses      21362    25346    +3984     

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

@andrebispo5 andrebispo5 marked this pull request as draft April 6, 2026 20:41
@andrebispo5 andrebispo5 removed the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 6, 2026
@github-actions github-actions bot added the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 6, 2026
@andrebispo5 andrebispo5 removed the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 7, 2026
# Conflicts:
#	BitwardenShared/UI/Vault/Vault/VaultList/VaultListAction.swift
#	BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessor.swift
@github-actions github-actions bot added the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 8, 2026
@andrebispo5 andrebispo5 removed the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 8, 2026
@github-actions github-actions bot added the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 8, 2026
@andrebispo5 andrebispo5 marked this pull request as ready for review April 9, 2026 10:08
@andrebispo5 andrebispo5 removed the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 9, 2026
@github-actions github-actions bot added the t:misc Change Type - ¯\_(ツ)_/¯ label Apr 9, 2026
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:feature t:misc Change Type - ¯\_(ツ)_/¯

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants