Skip to content

[PM-36044] feat: Gate premium upgrade banner to US App Store users#2593

Merged
andrebispo5 merged 3 commits into
mainfrom
pm-36044/premium-upgrade-gatekeep
Apr 29, 2026
Merged

[PM-36044] feat: Gate premium upgrade banner to US App Store users#2593
andrebispo5 merged 3 commits into
mainfrom
pm-36044/premium-upgrade-gatekeep

Conversation

@andrebispo5
Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

The premium upgrade action card in the vault list now only appears to users whose App Store storefront is the United States. This prevents the banner from showing in regions where the upgrade flow is not available.

A new StorefrontService (backed by StoreKit 2's Storefront.current) was introduced to abstract the storefront check, keeping it injectable and testable.

@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:feature labels Apr 29, 2026
@andrebispo5 andrebispo5 marked this pull request as ready for review April 29, 2026 09:26
Copilot AI review requested due to automatic review settings April 29, 2026 09:26
@andrebispo5 andrebispo5 requested a review from a team as a code owner April 29, 2026 09:26
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

This PR gates the premium upgrade action card in the vault list to only appear for users whose App Store storefront is the United States, by introducing an injectable StorefrontService backed by StoreKit 2.

Changes:

  • Add StorefrontService / DefaultStorefrontService (StoreKit 2 storefront country check) with unit tests.
  • Inject storefrontService through ServiceContainer/Services and use it in VaultListProcessor to hide the banner for non‑US storefronts.
  • Update existing vault list tests and mock service container wiring to support the new dependency.

Reviewed changes

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

Show a summary per file
File Description
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessor.swift Adds US-storefront gating to shouldShowPremiumUpgradeActionCard computation.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessorTests.swift Adds coverage for the new non‑US storefront behavior and wires in the mock.
BitwardenShared/UI/Vault/Vault/VaultCoordinator.swift Extends coordinator services constraint to include HasStorefrontService.
BitwardenShared/Core/Platform/Services/Services.swift Adds HasStorefrontService and includes it in the global Services typealias.
BitwardenShared/Core/Platform/Services/ServiceContainer.swift Stores and provides storefrontService, and instantiates DefaultStorefrontService() in the main container initializer.
BitwardenShared/Core/Platform/Services/TestHelpers/ServiceContainer+Mocks.swift Adds storefrontService to the mock container factory for tests.
BitwardenShared/Core/Billing/Services/StorefrontService.swift Introduces the new service abstraction backed by Storefront.current?.countryCode.
BitwardenShared/Core/Billing/Services/StorefrontServiceTests.swift Adds unit tests for US/non‑US/nil storefront scenarios.

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

Comment on lines 255 to +260
if await services.configService.getFeatureFlag(.premiumUpgradePath) {
let shouldShow = await services.stateService.shouldShowPremiumUpgradeBanner()
let hasEnoughItems = await (try? services.vaultRepository
.hasMinimumCipherCount(Constants.minimumPremiumUpgradeBannerCipherCount)) ?? false
state.shouldShowPremiumUpgradeActionCard = shouldShow && hasEnoughItems
let isUSStorefront = await services.storefrontService.isUSStorefront()
state.shouldShowPremiumUpgradeActionCard = shouldShow && hasEnoughItems && isUSStorefront
@github-actions
Copy link
Copy Markdown
Contributor

Logo
Checkmarx One – Scan Summary & Details2e5c3f65-45bc-45ce-90f8-46626ed82366

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.17%. Comparing base (2373dce) to head (ccce508).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2593   +/-   ##
=======================================
  Coverage   87.17%   87.17%           
=======================================
  Files        1886     1888    +2     
  Lines      166863   166908   +45     
=======================================
+ Hits       145463   145508   +45     
  Misses      21400    21400           

☔ 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 merged commit 4a15ccf into main Apr 29, 2026
21 checks passed
@andrebispo5 andrebispo5 deleted the pm-36044/premium-upgrade-gatekeep branch April 29, 2026 19:57
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.

3 participants