HttpManifestSource

Default ManifestSource: fetches the manifest over HTTP (via an injectable ManifestFetcher), decodes JSON, and validates it through the portable, conformance-locked core ManifestService. Polling is a coroutine loop on the supplied scope. Pure Kotlin/JVM — no Android dependency.

The cadence comes exclusively from the manifest's polling object (active interval while a break is active, idle otherwise — resolvePollingDecision). When the manifest carries no polling object, no loop is started: the manifest is fetched exactly once per session. setActive cancels and restarts a running loop with the interval the new state dictates.

Constructors

Link copied to clipboard
constructor(scope: CoroutineScope, fetcher: ManifestFetcher = OkHttpManifestFetcher())

Properties

Link copied to clipboard

The cadence polling is currently running at, or null when it is not running or the implementation does not track it.

Functions

Link copied to clipboard
open override fun destroy()

Release resources (stop polling, drop state).

Link copied to clipboard
open suspend override fun fetchManifest(): BreakManifest

Fetch + parse the manifest once; suspends until it resolves. Throws on fetch/parse failure.

Link copied to clipboard
open override fun reset()

Reset session state (stop polling, drop URL + cached manifest) before a new session.

Link copied to clipboard
open override fun setActive(active: Boolean)

Hint that a break is (in)active, so the source can adjust its poll cadence.

Link copied to clipboard

Provide the customer manifest-response interceptor (and a diagnostic sink for when it throws). The SDK forwards OptiViewAdsConfig.interceptManifestResponse here at construction; sources apply it after parsing, on the initial fetch and every poll. Default no-op so custom sources need not support it.

Link copied to clipboard

Provide the customer manifest-request interceptor (and a diagnostic sink for when it throws). The SDK forwards OptiViewAdsConfig.interceptManifestRequest here at construction; sources apply it before the network fetch, on the initial fetch and every poll. Default no-op so custom sources need not support it.

Link copied to clipboard
open override fun setManifestUrl(url: String)

Set the manifest URL for the current session (call before fetchManifest/startPolling).

Link copied to clipboard
open override fun startPolling(onUpdate: (BreakManifest) -> Unit, onError: (Throwable) -> Unit)

Start the poll loop at the cadence the manifest's polling object dictates (no loop when it has none), delivering every re-fetched manifest to onUpdate and every failed poll to onError.

Link copied to clipboard

Evidence for the most recent failed read, consumed by the caller raising DA-MANIFEST-FETCH-FAILED. Defaults to null so a custom source keeps working without implementing it — it loses the evidence, not the diagnostic.