:library:feature:support
Purpose
Presents donation/support products and coordinates purchases through the billing integration.
Owns
Feature event builders and their bounded keys in
ui/analytics; screens only report events.SupportScreenand the statelessSupportScreenContent,SupportViewModel, and their state (SupportUiState,DonationOption) and event (SupportEvent) contracts.supportPage(), the registration ofSupportRoute, which the overflow menu'ssupportUs()entry opens.Donation product IDs, the
ProductDetailshelpers inui/utils, and the mapping of Play's products toDonationOptioninui/mappers.
Does not own
Google Play BillingClient lifecycle, owned by
:library:integration:billing.Generic shared UI/ad primitives, owned by
:library:core:ui.
Depends on
:library:core:common,:library:core:network, and:library:core:uifor shared billing/Firebase contracts, errors, and Compose foundations.:library:integration:billingfor Play Billing access.:library:navigationfor the key and the graph builder.
Used by
:library:apptoolkit, which callssupportPage()fromtoolkitPages().
Flow chart
flowchart TD
Page[supportPage: SupportRoute] --> Screen[SupportScreen]
Screen --> VM[SupportViewModel]
Screen --> Content[SupportScreenContent]
VM -->|query donation IDs| Billing[BillingRepository]
Billing --> Play[Play BillingClient]
Play -->|product details| ProductFlow[Replaying productDetails Flow]
ProductFlow --> VM
VM -->|toDonationOptions| Options[Loadable of DonationOption map]
Options --> Content
Content -->|onDonate| Screen
Screen -->|SupportEvent.Donate with the activity| VM
VM -->|launch one-time purchase| Billing
Play -->|purchase callback| Billing
Billing -->|consume completed donation| Play
Billing --> Result[PurchaseResult Flow]
Result --> VM
VM --> Messages[UiMessage queue]
Messages --> Host[MessageHost]Architectural decisions
Donation product IDs live in
data/models, billing-SDK mapping lives indata, presentation constants and rendering live inui, and feature bindings live indi.The support feature depends on the billing contract, not
BillingClient.BillingRepositoryexposes Play'sProductDetails, soSupportViewModelkeeps them privately for the launch and maps them toDonationOption, which is all the screen sees.Product IDs belong to the feature because they define the donation catalog. Connection lifecycle, retries, purchase recovery, and consumption belong to the billing integration.
The screen is on
core.ui.screen.donationOptionsis aLoadablethat stays loading until the first query publishes, then isEmptywhen Play returned no products andReadyotherwise.SupportEvent.QueryProductDetailsis sent on start and by the failure state's Retry.BillingRepositoryreports a failed product query throughpurchaseResult, not by throwing. A failure that arrives while the options are still loading therefore becomesLoadable.Failedwith Retry. Once the options show, a failed purchase is an error message and the options stay.A thrown query failure goes through
toFailed, so an offline device sees the offline text. Billing errors are reported under the support screen'sSupportandSupportViewModelnames.Purchase results are messages shown by
MessageHostin the page's snackbar host, above the shell's bottom chrome.The purchase needs the activity, which the screen reads from
LocalActivity.currentand sends inSupportEvent.Donate. The ViewModel drops its reference once Play has it.A purchase launch is guarded against invalid activities and duplicate taps. The buttons stay disabled until a result arrives, or for 20 seconds so an absent SDK callback cannot leave the page busy.
SupportScreenContentopens nothing. The donation and web ad taps reachSupportScreenas callbacks, and each button logs the same GA4 tap event as before through itsga4Event.
Public contracts
SupportScreen,SupportComposable,supportPage(),SupportViewModel,SupportUiState,DonationOption,SupportEvent,SupportNativeAdCard,supportModuleand the donation product IDs.SupportScreenContentis internal.
Internal implementations
Product grouping/formatting and donation UI behavior.
Current risks
Billing contracts/results exist in common, integration, and support namespaces, creating overlapping concepts that can be confused during changes.
PurchaseResult.Failed carries Play's English debug message, which the page shows as it is. The billing integration has no typed failure reason the page could translate.