Analytics: cleanup
This commit is contained in:
parent
a8108f2e17
commit
622483cf9f
|
@ -26,7 +26,6 @@ import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -99,27 +98,25 @@ class DefaultVectorAnalytics @Inject constructor(
|
||||||
|
|
||||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||||
private fun observeAnalyticsId() {
|
private fun observeAnalyticsId() {
|
||||||
GlobalScope.launch {
|
getAnalyticsId()
|
||||||
getAnalyticsId().onEach {
|
.onEach { id ->
|
||||||
if (it.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
posthog?.reset()
|
posthog?.reset()
|
||||||
} else {
|
} else {
|
||||||
posthog?.identify(it)
|
posthog?.identify(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.launchIn(GlobalScope)
|
.launchIn(GlobalScope)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||||
private fun observeUserConsent() {
|
private fun observeUserConsent() {
|
||||||
GlobalScope.launch {
|
getUserConsent()
|
||||||
getUserConsent().onEach {
|
.onEach { consent ->
|
||||||
userConsent = it
|
userConsent = consent
|
||||||
}
|
}
|
||||||
.launchIn(GlobalScope)
|
.launchIn(GlobalScope)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun capture(event: String, properties: Map<String, Any>?) {
|
override fun capture(event: String, properties: Map<String, Any>?) {
|
||||||
posthog
|
posthog
|
||||||
|
|
Loading…
Reference in New Issue