mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-16 03:08:58 +03:00
Analytics: cleanup
This commit is contained in:
parent
a8108f2e17
commit
622483cf9f
1 changed files with 13 additions and 16 deletions
|
@ -26,7 +26,6 @@ import kotlinx.coroutines.GlobalScope
|
|||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
@ -99,26 +98,24 @@ class DefaultVectorAnalytics @Inject constructor(
|
|||
|
||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||
private fun observeAnalyticsId() {
|
||||
GlobalScope.launch {
|
||||
getAnalyticsId().onEach {
|
||||
if (it.isEmpty()) {
|
||||
posthog?.reset()
|
||||
} else {
|
||||
posthog?.identify(it)
|
||||
getAnalyticsId()
|
||||
.onEach { id ->
|
||||
if (id.isEmpty()) {
|
||||
posthog?.reset()
|
||||
} else {
|
||||
posthog?.identify(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
.launchIn(GlobalScope)
|
||||
}
|
||||
.launchIn(GlobalScope)
|
||||
}
|
||||
|
||||
@Suppress("EXPERIMENTAL_API_USAGE")
|
||||
private fun observeUserConsent() {
|
||||
GlobalScope.launch {
|
||||
getUserConsent().onEach {
|
||||
userConsent = it
|
||||
}
|
||||
.launchIn(GlobalScope)
|
||||
}
|
||||
getUserConsent()
|
||||
.onEach { consent ->
|
||||
userConsent = consent
|
||||
}
|
||||
.launchIn(GlobalScope)
|
||||
}
|
||||
|
||||
override fun capture(event: String, properties: Map<String, Any>?) {
|
||||
|
|
Loading…
Add table
Reference in a new issue