DefaultUsageAndDiagnosticsRepository

Persists reporting and advertising consents, then applies the stored bundle to the consent SDKs. Applying after each write keeps SDK state current even when the settings screen is closed. Unset choices default to enabled in release builds and disabled in debug builds.

DataStore is main-safe, so this needs no dispatcher. A read or write that fails fails with a StorageException.

Constructors

Link copied to clipboard
constructor(dataSource: UsageAndDiagnosticsPreferencesDataSource, buildInfoRepository: BuildInfoRepository, diagnostics: DiagnosticsReporter, consentRepository: ConsentRepository)

Functions

Link copied to clipboard
open override fun observeSettings(): Flow<UsageAndDiagnosticsSettings>

Emits all usage and diagnostics related consent values.

Link copied to clipboard
open suspend override fun setAdPersonalizationConsent(granted: Boolean)
Link copied to clipboard
open suspend override fun setAdStorageConsent(granted: Boolean)
Link copied to clipboard
open suspend override fun setAdUserDataConsent(granted: Boolean)
Link copied to clipboard
open suspend override fun setAll(settings: UsageAndDiagnosticsSettings)

Stores every value of settings together, for whole-bundle answers such as "Allow all", so observeSettings never reports a mix of the old and new choices in between.

Link copied to clipboard
open suspend override fun setAnalyticsConsent(granted: Boolean)
Link copied to clipboard
open suspend override fun setUsageAndDiagnostics(enabled: Boolean)