[PM-36044] feat: Gate premium upgrade banner to US App Store users#2593
Conversation
There was a problem hiding this comment.
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
storefrontServicethroughServiceContainer/Servicesand use it inVaultListProcessorto 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.
| 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 |
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|

🎟️ 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'sStorefront.current) was introduced to abstract the storefront check, keeping it injectable and testable.