[PM-33517] feat: Add Plan row to Settings and premium subscription management#6794
Conversation
Code Review: PM-33517 feat: Add Plan row to Settings and premium subscription managementPR: #6794 | Author: @SaintPatrck | Reviewed by: Claude Overall AssessmentWell-structured PR that extends the existing Findings🟡 suggestion — Pricing error forces navigation back for premium users
Suggestion: Consider only navigating back for 🟢 nit —
|
| coEvery { | ||
| mockBillingRepository.getPremiumPlanPricing() | ||
| } returns PremiumPlanPricingResult.Success( | ||
| monthlyRate = "$2.00", |
There was a problem hiding this comment.
❌ CRITICAL: Test will not compile -- PremiumPlanPricingResult.Success has no monthlyRate parameter
Details and fix
PremiumPlanPricingResult.Success only accepts annualPrice: Double, but this test constructs it with monthlyRate = "$2.00" (a String parameter that does not exist on the class).
Additionally, even if the parameter existed and compiled, handlePricingResultReceive uses onFreeContent which is a no-op when the viewState is Premium. The pricing result would be silently dropped, so the rate would remain as the placeholder "--" rather than updating to "$2.00".
This likely needs two fixes:
- Add a Premium branch to
handlePricingResultReceive(or a similar mechanism) so that the pricing fetch updates the rate for Premium users as well. - Update this test to use the correct constructor parameter (
annualPrice: Double) and assert the properly formatted rate.
| PlanState( | ||
| planMode = planMode, | ||
| viewState = if (isPremium) { | ||
| PlanState.ViewState.Premium( | ||
| rate = PLACEHOLDER_RATE, |
There was a problem hiding this comment.
Details and fix
The init block unconditionally fetches pricing via billingRepository.getPremiumPlanPricing(), but handlePricingResultReceive wraps its logic in onFreeContent, which is a no-op when viewState is Premium. The pricing result is silently dropped, and rate remains PLACEHOLDER_RATE ("--").
This means the "Billing amount" row in the Premium subscription card will display "-- per month" instead of the actual rate.
Consider adding a Premium branch in handlePricingResultReceive that updates ViewState.Premium.rate when the pricing result succeeds, similar to how the Free branch updates ViewState.Free.rate.
|
Great job! No new security vulnerabilities introduced in this pull request |
eda128d to
581f032
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## premium-upgrade/PM-33946-dynamic-pricing-impl #6794 +/- ##
=================================================================================
- Coverage 85.69% 85.66% -0.03%
=================================================================================
Files 828 831 +3
Lines 58730 59011 +281
Branches 8595 8633 +38
=================================================================================
+ Hits 50327 50553 +226
- Misses 5422 5468 +46
- Partials 2981 2990 +9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-33517
📔 Objective
Add a Plan row to the Settings screen and implement premium subscription management for existing premium users.
Stacked on #6793 (PM-33946 dynamic pricing)
Changes
PremiumViewState showing subscription details (billing amount, next renewal date)BillingRepository.getPortalUrl()ic_plan.xmldrawable for the settings row