Init or stop posthog based on user consent
This commit is contained in:
parent
c9f432051b
commit
3b4bff61e9
3 changed files with 10 additions and 9 deletions
|
|
@ -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() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue