[PR #6954] [MERGED] [PM-37814] feat: Add debug flag to disable self-host premium check #86791

Closed
opened 2026-05-23 01:01:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6954
Author: @SaintPatrck
Created: 5/20/2026
Status: Merged
Merged: 5/20/2026
Merged by: @SaintPatrck

Base: mainHead: premium-upgrade/pm-37814-debug-disable-self-host-premium-check


📝 Commits (4)

  • 656d1cd [PM-37814] feat: Add debug flag to disable self-host premium check
  • 538e08b [PM-37814] fix: React to debug self-host bypass flag in Settings
  • 333dd18 [PM-37814] refactor: Single-source isSelfHosted from its StateFlow
  • eeefc02 refactor: Expose isSelfHosted as val on PremiumStateManager

📊 Changes

11 files changed (+203 additions, -36 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/di/BillingModule.kt (+3 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManager.kt (+12 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerImpl.kt (+19 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModel.kt (+1 -2)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsViewModel.kt (+11 -17)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerTest.kt (+81 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModelTest.kt (+34 -0)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsViewModelTest.kt (+26 -17)
📝 core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt (+11 -0)
📝 ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt (+4 -0)
📝 ui/src/main/res/values/strings_non_localized.xml (+1 -0)

📄 Description

🎟️ Tracking

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

📔 Objective

Three Bitwarden internal dev/QA environments — vault.qa.bitwarden.pw, qa-team.sh.bitwarden.pw, and vault.usdev.bitwarden.pw — are classified as self-hosted, which causes the existing Premium Upgrade self-host gating to hide the flow and prevent QA from exercising it on those environments.

This adds a debug-only feature flag (debug-disable-self-host-premium-check) that, when enabled in the debug menu, treats self-hosted environments as cloud for premium upgrade purposes. The flag defaults off, only surfaces in builds where the debug menu is available, and leaves cloud environments completely unaffected.

Ports the iOS approach in bitwarden/ios#2657 for cross-platform parity. Like iOS, the mechanism is pure flag-based — no URL whitelist — so QA can use it against any self-hosted setup they need to test.

The gating decision is exposed as a StateFlow on PremiumStateManager and observed by Settings, so the Plan row reacts the moment the toggle flips (no environment-switch or screen re-entry required).

📸 Screenshots

https://github.com/user-attachments/assets/327afeba-db3b-45cf-a292-ab103fe8811a


🔄 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/6954 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 5/20/2026 **Status:** ✅ Merged **Merged:** 5/20/2026 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `main` ← **Head:** `premium-upgrade/pm-37814-debug-disable-self-host-premium-check` --- ### 📝 Commits (4) - [`656d1cd`](https://github.com/bitwarden/android/commit/656d1cd765e57dc75bd7bd73e1637fa6dcf4b46c) [PM-37814] feat: Add debug flag to disable self-host premium check - [`538e08b`](https://github.com/bitwarden/android/commit/538e08ba646d0de3393b5d1d69bf41ae6591109d) [PM-37814] fix: React to debug self-host bypass flag in Settings - [`333dd18`](https://github.com/bitwarden/android/commit/333dd18046ec5d0bae0823bd7445b88f27902f69) [PM-37814] refactor: Single-source isSelfHosted from its StateFlow - [`eeefc02`](https://github.com/bitwarden/android/commit/eeefc0229ebbe6cf78a33b39a756d8700edabf97) refactor: Expose isSelfHosted as val on PremiumStateManager ### 📊 Changes **11 files changed** (+203 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/di/BillingModule.kt` (+3 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManager.kt` (+12 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerImpl.kt` (+19 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModel.kt` (+1 -2) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsViewModel.kt` (+11 -17) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/billing/manager/PremiumStateManagerTest.kt` (+81 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/premium/plan/PlanViewModelTest.kt` (+34 -0) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/settings/SettingsViewModelTest.kt` (+26 -17) 📝 `core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt` (+11 -0) 📝 `ui/src/main/kotlin/com/bitwarden/ui/platform/components/debug/FeatureFlagListItems.kt` (+4 -0) 📝 `ui/src/main/res/values/strings_non_localized.xml` (+1 -0) </details> ### 📄 Description ## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-37814 ## 📔 Objective Three Bitwarden internal dev/QA environments — `vault.qa.bitwarden.pw`, `qa-team.sh.bitwarden.pw`, and `vault.usdev.bitwarden.pw` — are classified as self-hosted, which causes the existing Premium Upgrade self-host gating to hide the flow and prevent QA from exercising it on those environments. This adds a debug-only feature flag (`debug-disable-self-host-premium-check`) that, when enabled in the debug menu, treats self-hosted environments as cloud for premium upgrade purposes. The flag defaults off, only surfaces in builds where the debug menu is available, and leaves cloud environments completely unaffected. Ports the iOS approach in [bitwarden/ios#2657](https://github.com/bitwarden/ios/pull/2657) for cross-platform parity. Like iOS, the mechanism is pure flag-based — no URL whitelist — so QA can use it against any self-hosted setup they need to test. The gating decision is exposed as a `StateFlow` on `PremiumStateManager` and observed by Settings, so the Plan row reacts the moment the toggle flips (no environment-switch or screen re-entry required). ## 📸 Screenshots https://github.com/user-attachments/assets/327afeba-db3b-45cf-a292-ab103fe8811a --- <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-23 01:01:14 -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#86791