Support switching subscription tier plans#7652
Support switching subscription tier plans#7652cmonfortep wants to merge 3 commits intofeature/cristian/subscription/support_new_tierfrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
...ons-impl/src/main/java/com/duckduckgo/subscriptions/impl/ui/SubscriptionSettingsViewModel.kt
Show resolved
Hide resolved
...ions-impl/src/main/java/com/duckduckgo/subscriptions/impl/ui/SubscriptionSettingsActivity.kt
Outdated
Show resolved
Hide resolved
bf132e8 to
a20118d
Compare
subscriptions/subscriptions-impl/src/main/res/layout/activity_subscription_settings.xml
Show resolved
Hide resolved
...scriptions-impl/src/main/java/com/duckduckgo/subscriptions/impl/repository/AuthRepository.kt
Show resolved
Hide resolved
...scriptions-impl/src/main/java/com/duckduckgo/subscriptions/impl/repository/AuthRepository.kt
Show resolved
Hide resolved
| SubscriptionTier.PRO -> "Pro" | ||
| SubscriptionTier.UNKNOWN -> "Plus" // fallback | ||
| } | ||
| val periodName = if (billingPeriod.equals("monthly", ignoreCase = true)) "Monthly" else "Yearly" |
There was a problem hiding this comment.
We're missing translations here
| val type = when (subscription.productId) { | ||
| MONTHLY_PLAN_US, MONTHLY_PLAN_ROW -> Monthly | ||
| else -> Yearly | ||
| } |
There was a problem hiding this comment.
This has to be updated to use subscription.billingPeriod. New plan ids are now mapped to yearly, which leads to incorrect copy being shown on settings screen.
5880409 to
80fa88f
Compare
a20118d to
3413456
Compare
| null | ||
| } | ||
|
|
||
| // Use firstOrNull() for UI display |
There was a problem hiding this comment.
Monthly Pro plans incorrectly detected as Yearly duration
High Severity
The type (duration) detection at line 99 only checks for Plus monthly plan IDs (MONTHLY_PLAN_US, MONTHLY_PLAN_ROW). Pro monthly plan IDs like MONTHLY_PRO_PLAN_US fall through to the else -> Yearly branch. This causes monthly Pro subscribers to see yearly renewal copy on the settings screen. It also feeds an incorrect currentDuration into isPendingPlanDowngrade, potentially mislabeling tier changes as upgrades or downgrades. This was flagged by a reviewer as needing to use subscription.billingPeriod instead.
Please tell me if this was useful or not with a 👍 or 👎.



Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1213036807834788?focus=true
Description
Adds logic to support tier switching plans, and FE integration
Steps to test this PR
See Asana task: https://app.asana.com/1/137249556945/project/72649045549333/task/1213073996670202?focus=true
UI changes
Note
Medium Risk
Touches subscription purchase/switch flows and persistent subscription state (new
pendingPlansstorage), which could affect billing behavior and UI messaging if parsing/mapping is incorrect; changes are localized and covered by added tests.Overview
Enables tier/plan switching from the subscriptions web flow by adding a new JS message (
subscriptionChangeSelected) that maps requested plan changes to the appropriate Google PlaySubscriptionReplacementMode(upgrade prorated, downgrade deferred, within-tier without proration) and routes the command throughSubscriptionsWebViewActivityintoSubscriptionsManager.switchSubscriptionPlan.Extends subscription data handling to include server-provided
pendingPlans: addsPendingPlandomain/DTOs, persists them inSubscriptionsDataStore(JSON via Moshi), populates them on purchase confirmation andrefreshSubscriptionData, and exposes UI-facing helpers likeSubscription.hasPendingChange/effectiveTier. A newprivacyPro.showPendingPlanHinttoggle gates showing a pending upgrade/downgrade hint in Subscription Settings.Updates tier purchase surface details: adds Pro free-trial offer IDs and combines free-trial offer lists, adjusts
upgradeToProUrlquery params, refines Subscription Settings UI (replaces tier pill drawables with text label, limits “switch plan” to Plus/Google), and tweaks a few subscription/feedback strings.Written by Cursor Bugbot for commit 3413456. This will update automatically on new commits. Configure here.