-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Move to v2 subscription messaging (FE BE) #7381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Move to v2 subscription messaging (FE BE) #7381
Conversation
| return@withContext subscriptionsDataStore.subscriptionFeatures | ||
| ?.let(featuresAdapter::fromJson) | ||
| ?.get(basePlanId) ?: emptySet() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing V2 fallback when tier flag toggled OFF
The flag transition logic has an asymmetry that could cause issues during rollback. When tierMessagingEnabled is ON, getFeatures falls back from V2 to V1 if V2 is empty. However, when the flag is OFF, it only reads from V1 with no fallback to V2. Combined with the fetcher which exclusively populates V2 when flag is ON (and V1 when flag is OFF), this means: if a user's app ran with the flag ON (V2 populated, V1 empty), and the flag is later toggled OFF remotely, getFeatures returns an empty set until the app restarts and the fetcher repopulates V1. This could temporarily hide subscription offers from affected users during emergency flag rollbacks.
Please tell me if this was useful or not with a 👍 or 👎.
Additional Locations (1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected scenario: Users are in legacy version, we will enable FF for v2.
- Transition should work
- We offer a fallback to cover FF change during runtime
Moving from v2 -> v1, not expected. If happens, restarting the app will fix. I think tradeoff is acceptable
2178318 to
8e20b1c
Compare
| * with the new tier-based payload structure supporting Plus/Pro tiers. | ||
| * The flag is exposed to FE via getFeatureConfig. | ||
| */ | ||
| @Toggle.DefaultValue(DefaultFeatureValue.FALSE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Planning to change this to True before merging. Keeping false to facilitate testing scenario.
lmac012
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works as expected 👌
| fun refreshSubscriptionPlanFeatures(): Toggle | ||
|
|
||
| @Toggle.DefaultValue(DefaultFeatureValue.TRUE) | ||
| fun useClientWithCacheForFeatures(): Toggle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this Toggle since we stopped using it in this PR.
| class SubscriptionFeaturesFetcher @Inject constructor( | ||
| @AppCoroutineScope private val appCoroutineScope: CoroutineScope, | ||
| private val playBillingManager: PlayBillingManager, | ||
| private val subscriptionsService: SubscriptionsService, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency is not used anymore

Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1212502267333651?focus=true
Description
Supports BE v2 features endpoint
Enables FE V2 messaging
Introduces FF for transition
Steps to test this PR
Feature 1
applicationIdSuffix ".debug"inbuild.gradle) so it can obtain subscripton products and plans from Play StoreFeature 2
tierMessagingEnabledFeature 3
applicationIdSuffix ".debug"inbuild.gradle) so it can obtain subscripton products and plans from Play StoretierMessagingEnabledUI changes
Note
Adds tier-based subscription messaging backed by v2 features/entitlements, with storage and runtime fallbacks to legacy features behind a flag.
privacyPro.tierMessagingEnabledto gate tier-based payloads and FE exposure viagetFeatureConfig(useGetSubscriptionTierOptions).featuresV2(sku)returning tiered features; introduceEntitlement-driven flow.AuthRepositoryadds v2 entitlements persistence (set/getFeaturesV2) and falls back to v1 features when needed;SubscriptionsDataStoreaddssubscriptionEntitlementskey.getSubscriptionOffernow returnsSubscriptionOfferwithtierandentitlements(legacyfeaturesderived); newgetEntitlementsForPlanwith v2-first, v1 fallback.getFeaturesderives from entitlements for current plan.getSubscriptionTierOptionsand tier-based JSON payload building inSubscriptionWebViewViewModel.getFeatureConfignow includesuseGetSubscriptionTierOptionsflag.SubscriptionFeaturesFetcherfetches v2 entitlements when flag on; otherwise fetches legacy features.Written by Cursor Bugbot for commit 8e20b1c. This will update automatically on new commits. Configure here.