:library:feature:faq
Purpose
Owns the FAQ surface end to end: the catalog behind it, the screen that lists it, and the contact, review, and store actions around it. This module replaced :library:feature:help in 3.0.0.
Owns
FaqScreenand the statelessFaqScreenContent,FaqViewModel, and their state and event contracts.helpPage(), the registration ofHelpRoute, withFaqMenuActionsin its app bar.FaqRepositoryandDefaultFaqRepository, which normalize both sources, prefer the remote catalog, and fall back to the resources bundled in the host.FaqRemoteDataSource,FaqLocalDataSource, the catalog DTOs, and the DTO mappers underdata/remote/mappers.FaqItemandFaqIdindata/models,QuestionCard,ContactUsCard,FaqNativeAdCard, and the overflow menu.The nine question and nine answer placeholder resources a host fills in.
FaqConstants.FAQ_BASE_URLandfaqCatalogUrl, which build the catalogue address for the build type.
Does not own
Open-source licenses, owned by
:library:feature:licenses; the overflow menu only navigates toLicensesRoute.In-app review implementation, owned by
:library:integration:review.HTTP client construction, owned by
:library:core:network.Host identity strings, supplied as overridable defaults by
:library:core:common.The questions and answers themselves, and the native ad unit. Both come from the host. See Host requirements.
Host requirements
Two things the module renders but does not contain. Neither fails the build when it is missing, so both are worth checking before shipping a host: the FAQ degrades silently at runtime, the ad binding throws.
The fallback FAQ, question_1–question_9
FaqRepository prefers the remote catalog and falls back to the bundled one whenever the remote call throws or yields no questions, which also covers a catalog whose shape this module cannot map. The bundled catalog is nine question/answer pairs read from host resources:
| Question | Answer |
|---|---|
question_1 | summary_preference_faq_1 |
| … | … |
question_9 | summary_preference_faq_9 |
This module declares all eighteen as empty, untranslatable placeholders in res/values/untranslatable_strings.xml, purely so it compiles on its own. They are slots, not copy: the host declares the text and translates it, the way :sample:feature:faq does. A host that does not gets a FAQ screen showing nine blank rows the moment the remote catalog is unavailable, with nothing in the build output to say why.
Provide fewer than nine only if the host is fine with the remainder rendering blank; the count is fixed here, not derived from what the host declares.
The FAQ native ad unit
FaqScreen resolves an AdsConfig from Koin under the AdsQualifiers.HELP_NATIVE_AD qualifier. Unlike the FAQ strings this one is not optional: the lookup throws and the screen fails to compose when no host has registered it, so every host must, the way :sample:integration:ads does.
To opt out of the ad rather than the binding, register the config with a blank bannerAdUnitId. The screen already skips the slot when the id is blank or the user has ads switched off.
Depends on
:library:core:common,:library:core:datastore,:library:core:network, and:library:core:uifor shared configuration, persistence access, networking, and UI.:library:navigationfor the keys and the graph builder.:library:integration:reviewfor review prompts.No other feature module.
Used by
:library:apptoolkit, which callshelpPage()fromtoolkitPages(), and:sample:feature:faq, which fills in the questions.
Flow chart
flowchart TD
Page[helpPage: HelpRoute] --> Screen[FaqScreen]
Page --> Menu[FaqMenuActions]
Screen --> VM[FaqViewModel]
Screen --> Content[FaqScreenContent]
VM --> Repo[FaqRepository]
Repo --> Remote[FaqRemoteDataSource]
Remote --> Catalog[FAQ catalog endpoint]
Repo --> Local[FaqLocalDataSource]
Local --> Resources[Host question and answer resources]
Content --> Card[QuestionCard]
Content --> Contact[ContactUsCard]
VM --> Review[ForceInAppReviewUseCase]
Menu --> Licenses[navigate LicensesRoute]Architectural decisions
The catalog and the screen live in one module because they have no independent consumers: nothing renders the FAQ but this screen, and nothing uses this screen without the FAQ. Splitting them bought a module boundary and no separation.
The placeholder resources are declared
translatable="false"and left empty on purpose. Marking them translatable would make lint demand 25 translations of an empty string, andMissingTranslationis an error in this project.A host adds or rewords a question by changing its own FAQ module alone. Nothing in the library moves, which is the reason the content is not declared here.
There is no FAQ use case. Cleaning the catalog is transforming a data-source model into an application model, which is repository work, and the one thing a use case would have added is a layer the single caller does not need.
FaqViewModelreadsFaqRepositorydirectly.The screen is on
core.ui.screen.FaqRepository.getFaq()returns the questions or throws, andFaqViewModelmaps a failure withtoFailed, so an offline device sees the offline text and anything else the FAQ's own. Neither needs a dispatcher: Ktor suspends, and the bundled questions are string resources.The repository throws only when there is nothing to show. A failed catalog with bundled questions to fall back on is not an error, and a catalog that loaded empty is
Loadable.Empty, with Retry.FaqScreenContentlogs nothing and opens nothing. Every tap reachesFaqScreenas a named callback, which logs GA4 events (select_contentfor content selection, action events for buttons and overflow menu items) and opens the form, mail or store listing, since those need aContext.When the in-app review cannot show, the ViewModel sets
openStoreListingand the screen opens the store listing, then reports back withStoreListingOpened. A flag in state, not a one-off event, so it still happens when the review finishes during a configuration change.The feedback button stays in the screen's body rather than the shell's FAB slot: it belongs to this page only, and the page pads it by
contentPadding().Normalizing inside the repository, before the emptiness check rather than after it, is what makes the fallback correct: a remote catalog of nothing but blank rows now counts as empty and falls through to the local questions instead of rendering blank rows.
Public contracts
FaqScreen,helpPage(),FaqMenuActions,FaqViewModel,FaqUiState,FaqEvent,FaqRepository,FaqItem,FaqId,QuestionCard, andfaqModule.FaqScreenContentis internal.
Internal implementations
Catalog HTTP fetch, DTO mapping, local resource loading, the remote-then-local fallback, and the screen's ad slot and overflow menu.
Current risks
The nine slots are a fixed count. A host with more or fewer questions has to supply them through the remote catalog instead, because the local fallback is pinned to those resource names.