ManifestSource

interface ManifestSource

The manifest fetch + poll boundary. The portable :ads-sdk-core ManifestService only parses + validates a decoded manifest (so its validation stays conformance-locked across platforms); the actual network fetch and the polling timer are platform concerns and live behind this interface. HttpManifestSource is the default implementation (OkHttp + coroutine poll loop); tests and the conformance driver supply a fake.

This mirrors the additional responsibilities the web ManifestService carries on top of parsing (setManifestUrl / fetchManifest / startPolling / setActive / reset), keeping the orchestrator's call sites identical to the TS reference.

Inheritors

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
abstract fun destroy()

Release resources (stop polling, drop state).

Link copied to clipboard
abstract suspend fun fetchManifest(): BreakManifest

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

Link copied to clipboard
abstract fun reset()

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

Link copied to clipboard
abstract 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
abstract fun setManifestUrl(url: String)

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

Link copied to clipboard
abstract 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.