DefaultAdsPreferencesDataSource

Ads preference stored in the shared settings Preferences DataStore.

Owns the single eagerly started adsEnabled StateFlow. Constructing this class more than once per process starts a second collector over the same preference, so it is registered as a singleton and reached through the graph rather than built on demand.

Constructors

Link copied to clipboard
constructor(dataStore: DataStore<Preferences>, dispatchers: DispatcherProvider, defaultAdsEnabled: Boolean)

Properties

Link copied to clipboard
open override val adsEnabled: StateFlow<Boolean>

Shared ads preference. Disabled until storage answers and while its read is failing.

Link copied to clipboard
open override val defaultAdsEnabled: Boolean
Link copied to clipboard
open override val reduceAds: Flow<Boolean>

Emits whether App Open ads should be suppressed.

Functions

Link copied to clipboard
open override fun ads(default: Boolean): Flow<Boolean>

Emits the ads preference with a caller-supplied default.

Link copied to clipboard
open override fun close()

Stops the sharing coroutine backing adsEnabled.

Link copied to clipboard
open suspend override fun saveAds(isChecked: Boolean)
Link copied to clipboard
open suspend override fun saveReduceAds(isChecked: Boolean)