mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Init or stop posthog based on user consent
This commit is contained in:
+4
-3
@@ -115,15 +115,16 @@ class DefaultAnalyticsService @Inject constructor(
|
||||
}
|
||||
|
||||
private fun initOrStop() {
|
||||
userConsent?.let { _userConsent ->
|
||||
when (_userConsent) {
|
||||
userConsent?.let { userConsent ->
|
||||
when (userConsent) {
|
||||
true -> {
|
||||
analyticsProviders.onEach { it.init() }
|
||||
pendingUserProperties?.let {
|
||||
analyticsProviders.onEach { provider -> provider.updateUserProperties(it) }
|
||||
pendingUserProperties = null
|
||||
}
|
||||
}
|
||||
false -> {}
|
||||
false -> analyticsProviders.onEach { it.stop() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user