DefaultConsentRepository

class DefaultConsentRepository(remote: ConsentRemoteDataSource, local: ConsentPreferencesDataSource, buildInfoRepository: BuildInfoRepository, diagnostics: DiagnosticsReporter, collection: TelemetryCollection, requestScope: CoroutineScope = CoroutineScope(context = SupervisorJob() + Dispatchers.Main.immediate)) : ConsentRepository(source)

Implementation of ConsentRepository that delegates UMP work to a remote data source.

Parameters

diagnostics

breadcrumbs that trace the consent lifecycle; the repository reports no analytics events.

collection

applies the person's consent to the telemetry SDKs' collection switches.

requestScope

scope that owns the shared, process-wide consent round trip. It defaults to the immediate main dispatcher because UMP requires its entry points to be called from the main thread.

Constructors

Link copied to clipboard
constructor(remote: ConsentRemoteDataSource, local: ConsentPreferencesDataSource, buildInfoRepository: BuildInfoRepository, diagnostics: DiagnosticsReporter, collection: TelemetryCollection, requestScope: CoroutineScope = CoroutineScope(context = SupervisorJob() + Dispatchers.Main.immediate))

Functions

Link copied to clipboard
open suspend override fun applyConsentSettings(settings: ConsentSettings)

Applies the provided consent settings to Firebase services.

Link copied to clipboard
open suspend override fun applyInitialConsent()

Reads the stored consent choices and applies them to Firebase services. Unset choices are granted in release builds and refused in debug builds.

Link copied to clipboard
open suspend override fun requestConsent(host: ConsentHost, showIfRequired: Boolean = true)

Requests consent, sharing one UMP round trip between callers that ask at the same time, since overlapping requests drive the SDK into the failure path that crashes the process from its own executor. A host that is finishing or destroyed is rejected before UMP is called.