DefaultFaqRepository

class DefaultFaqRepository(localDataSource: FaqLocalDataSource, remoteDataSource: FaqRemoteDataSource, catalogUrl: String, productId: String, diagnostics: DiagnosticsReporter) : FaqRepository(source)

Implementation of FaqRepository that manages the retrieval of FAQ items from both remote and local data sources.

Prioritizes remote data from a specified catalog and product, falling back to the bundled local questions when the remote fetch fails or yields nothing usable.

Both sources are normalized before they are considered: entries are trimmed, blanks are dropped and repeated ids collapse to their first occurrence. Normalizing here rather than downstream 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.

It needs no dispatcher: the remote calls suspend inside Ktor, and the local questions are string resources, which the system already holds in memory.

Constructors

Link copied to clipboard
constructor(localDataSource: FaqLocalDataSource, remoteDataSource: FaqRemoteDataSource, catalogUrl: String, productId: String, diagnostics: DiagnosticsReporter)

Functions

Link copied to clipboard
open suspend override fun getFaq(): List<FaqItem>

Returns the questions to show, or an empty list when there are none. Safe to call from the main thread.