Repository navigation
Hide Patron upgrade for subscriptions managed on iOS or Web - #6443
joashrajin wants to merge 1 commit into
Conversation
Plus subscribers paying through iOS or the web could buy a second Patron subscription on Google Play. Hide the upgrade row for them and block the purchase as a second layer of defense.
|
Claude finished @joashrajin's task in 1m 11s —— View job No blocking issues. The account-details check and the shared Non-blocking
|
Generated by 🚫 Danger |
| // through Google Play, so buying here would create a duplicate subscription. | ||
| val signInState = userManager.getSignInState().asFlow().first() | ||
| if ((signInState as? SignInState.SignedIn)?.subscription?.isManagedOnAnotherPlatform == true) { | ||
| _state.update { value -> (value as? OnboardingUpgradeFeaturesState.Loaded)?.copy(purchaseFailed = true) ?: value } |
There was a problem hiding this comment.
(non-blocking) This guard isn't only a fallback. A Plus subscriber billed on iOS or the web can still reach it by tapping a Patron app icon in Appearance settings (AppearanceSettingsFragment.openOnboardingFlow → OnboardingFlow.Upsell). They go through the whole paywall, tap subscribe, and get the generic "purchase failed" snackbar with no explanation and nothing to retry. Consider adding a separate state, or a string such as "Your subscription is managed on iOS/web", so the user knows where to upgrade. It would also help to add a test for this branch. The test currently passes mock<UserManager>() with no stub for getSignInState(), so any future test that calls purchaseSelectedPlan will hit an NPE.
Description
Plus subscribers who pay through iOS or the web no longer see "Upgrade to Patron" on Android, and the Android purchase flow refuses to start for them.
Previously the row was shown to every Plus subscriber. Tapping it ran a brand-new Google Play Patron purchase. Google Play only knows about its own purchases, so no existing subscription was replaced and the user ended up paying for Plus on the original platform and Patron on Google Play.
Subscription.isManagedOnAnotherPlatform(iOS or Web) is now shared in the model module. The TV settings screen used a private copy of the same check.AccountDetailsViewModelhides the "Upgrade to Patron" row when the subscription is managed on another platform.OnboardingUpgradeFeaturesViewModel.purchaseSelectedPlanchecks the sign-in state before purchasing and bails out with the existing purchase-failed state, in case another entry point reaches the flow.Gift and Unknown platforms are intentionally still allowed to upgrade, since they are not billed elsewhere.
Fixes PCDROID-853
Testing Instructions
./gradlew :modules:features:profile:testDebugUnitTest :modules:services:model:testDebugUnitTest :modules:features:account:testDebugUnitTest.Screenshots or Screencast
Not applicable. The change only hides an existing row.
Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xmlI have tested any UI changes...