[PR #6931] [PM-36969] feat: Surface subscription substate to premium gates #75464

Open
opened 2026-05-17 00:58:18 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6931
Author: @SaintPatrck
Created: 5/15/2026
Status: 🔄 Open

Base: mainHead: premium-upgrade/pm-36969-subscription-status-flow


📝 Commits (1)

  • 7a0a914 [PM-36969] feat: Surface subscription substate to premium gates

📊 Changes

16 files changed (+609 additions, -53 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManager.kt (+13 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerImpl.kt (+105 -15)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/BillingRepository.kt (+3 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/BillingRepositoryImpl.kt (+14 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/model/PremiumSubscriptionStatus.kt (+1 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/model/SubscriptionResult.kt (+7 -0)
app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/model/SubscriptionStatusState.kt (+28 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/util/BitwardenSubscriptionResponseJsonExtensions.kt (+1 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModel.kt (+111 -5)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/util/PremiumSubscriptionStatusExtensions.kt (+3 -8)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerImplTest.kt (+161 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/billing/repository/BillingRepositoryTest.kt (+43 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/billing/repository/util/BitwardenSubscriptionResponseJsonExtensionsTest.kt (+13 -10)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanScreenTest.kt (+5 -4)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModelTest.kt (+99 -4)
📝 ui/src/main/res/values/strings.xml (+2 -2)

📄 Description

🎟️ Tracking

📔 Objective

The server keeps Profile.Premium=true during the grace window after a subscription enters a recovery or terminal Stripe state. Surfaces that gate purely on isPremium either suppress the Plan-screen badge that would explain the user's situation, or hide the upgrade CTA users need to recover their account.

Adds PremiumStateManager.subscriptionStatusStateFlow (Loading/NoSubscription/Available/Error) so callers can derive "effectively premium" from both the account flag and the Stripe substate. The upgrade banner now flips back on when the active subscription is in a trouble state (past_due, update_payment, canceled, paused) even while the server still reports premium. The Plan screen routes free-with-trouble-substate users to the Premium view so they see the right badge and Manage/Resubscribe affordances.

Renames OVERDUE_PAYMENT → UPDATE_PAYMENT so the badge label matches the Figma frame. A new SubscriptionResult.NotFound maps the 404 returned for users without a GatewaySubscriptionId to "free, show upgrade CTA" instead of an error dialog.

📸 Screenshots


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6931 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 5/15/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `premium-upgrade/pm-36969-subscription-status-flow` --- ### 📝 Commits (1) - [`7a0a914`](https://github.com/bitwarden/android/commit/7a0a91444703c360b9b3e57ce272b14ef2afbcd8) [PM-36969] feat: Surface subscription substate to premium gates ### 📊 Changes **16 files changed** (+609 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManager.kt` (+13 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerImpl.kt` (+105 -15) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/BillingRepository.kt` (+3 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/BillingRepositoryImpl.kt` (+14 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/model/PremiumSubscriptionStatus.kt` (+1 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/model/SubscriptionResult.kt` (+7 -0) ➕ `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/model/SubscriptionStatusState.kt` (+28 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/repository/util/BitwardenSubscriptionResponseJsonExtensions.kt` (+1 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModel.kt` (+111 -5) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/util/PremiumSubscriptionStatusExtensions.kt` (+3 -8) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerImplTest.kt` (+161 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/billing/repository/BillingRepositoryTest.kt` (+43 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/billing/repository/util/BitwardenSubscriptionResponseJsonExtensionsTest.kt` (+13 -10) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanScreenTest.kt` (+5 -4) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModelTest.kt` (+99 -4) 📝 `ui/src/main/res/values/strings.xml` (+2 -2) </details> ### 📄 Description ## 🎟️ Tracking - https://bitwarden.atlassian.net/browse/PM-36969 - https://bitwarden.atlassian.net/browse/PM-36970 - https://bitwarden.atlassian.net/browse/PM-37093 - https://bitwarden.atlassian.net/browse/PM-37177 - https://bitwarden.atlassian.net/browse/PM-37180 - https://bitwarden.atlassian.net/browse/PM-37181 ## 📔 Objective The server keeps `Profile.Premium=true` during the grace window after a subscription enters a recovery or terminal Stripe state. Surfaces that gate purely on `isPremium` either suppress the Plan-screen badge that would explain the user's situation, or hide the upgrade CTA users need to recover their account. Adds `PremiumStateManager.subscriptionStatusStateFlow` (`Loading`/`NoSubscription`/`Available`/`Error`) so callers can derive "effectively premium" from both the account flag and the Stripe substate. The upgrade banner now flips back on when the active subscription is in a trouble state (`past_due`, `update_payment`, `canceled`, `paused`) even while the server still reports premium. The Plan screen routes free-with-trouble-substate users to the Premium view so they see the right badge and Manage/Resubscribe affordances. Renames `OVERDUE_PAYMENT → UPDATE_PAYMENT` so the badge label matches the Figma frame. A new `SubscriptionResult.NotFound` maps the 404 returned for users without a `GatewaySubscriptionId` to "free, show upgrade CTA" instead of an error dialog. ## 📸 Screenshots <!-- TBD --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-17 00:58:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#75464