mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: migrate preferences to DataStore and decouple core:domain for KMP (#4731)
This commit is contained in:
parent
87fdaa26ff
commit
b9b68d2779
113 changed files with 1790 additions and 1320 deletions
|
|
@ -58,7 +58,7 @@ import kotlinx.coroutines.flow.launchIn
|
|||
import kotlinx.coroutines.flow.onEach
|
||||
import org.meshtastic.core.analytics.BuildConfig
|
||||
import org.meshtastic.core.analytics.DataPair
|
||||
import org.meshtastic.core.prefs.analytics.AnalyticsPrefs
|
||||
import org.meshtastic.core.repository.AnalyticsPrefs
|
||||
import javax.inject.Inject
|
||||
import co.touchlab.kermit.Logger as KermitLogger
|
||||
|
||||
|
|
@ -109,11 +109,10 @@ constructor(
|
|||
KermitLogger.setMinSeverity(if (BuildConfig.DEBUG) Severity.Debug else Severity.Info)
|
||||
|
||||
// Initial consent state
|
||||
updateAnalyticsConsent(analyticsPrefs.analyticsAllowed)
|
||||
updateAnalyticsConsent(analyticsPrefs.analyticsAllowed.value)
|
||||
|
||||
// Subscribe to analytics preference changes
|
||||
analyticsPrefs
|
||||
.getAnalyticsAllowedChangesFlow()
|
||||
analyticsPrefs.analyticsAllowed
|
||||
.onEach { allowed -> updateAnalyticsConsent(allowed) }
|
||||
.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
|
||||
}
|
||||
|
|
@ -122,7 +121,7 @@ constructor(
|
|||
* Ensures that Datadog and Firebase SDKs are initialized if allowed. This is called lazily when consent is granted.
|
||||
*/
|
||||
private fun ensureInitialized() {
|
||||
if (!analyticsPrefs.analyticsAllowed || isInTestLab) return
|
||||
if (!analyticsPrefs.analyticsAllowed.value || isInTestLab) return
|
||||
|
||||
if (!Datadog.isInitialized()) {
|
||||
initDatadog(context as Application)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue