mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Analytics: simpler API
This commit is contained in:
parent
869b5ad55b
commit
a8108f2e17
4 changed files with 7 additions and 7 deletions
|
@ -37,7 +37,7 @@ interface VectorAnalytics {
|
|||
/**
|
||||
* Store the fact that the user has been asked for their consent
|
||||
*/
|
||||
suspend fun setDidAskUserConsent(didAskUserConsent: Boolean)
|
||||
suspend fun setDidAskUserConsent()
|
||||
|
||||
/**
|
||||
* Return a Flow of String, used for analytics Id
|
||||
|
|
|
@ -52,8 +52,8 @@ class DefaultVectorAnalytics @Inject constructor(
|
|||
return analyticsStore.didAskUserConsentFlow
|
||||
}
|
||||
|
||||
override suspend fun setDidAskUserConsent(didAskUserConsent: Boolean) {
|
||||
analyticsStore.setDidAskUserConsent(didAskUserConsent)
|
||||
override suspend fun setDidAskUserConsent() {
|
||||
analyticsStore.setDidAskUserConsent()
|
||||
}
|
||||
|
||||
override fun getAnalyticsId(): Flow<String> {
|
||||
|
|
|
@ -61,9 +61,9 @@ class AnalyticsStore @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
suspend fun setDidAskUserConsent(newDidAskUserConsent: Boolean) {
|
||||
suspend fun setDidAskUserConsent() {
|
||||
context.dataStore.edit { settings ->
|
||||
settings[didAskUserConsent] = newDidAskUserConsent
|
||||
settings[didAskUserConsent] = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class AnalyticsConsentViewModel @AssistedInject constructor(
|
|||
analytics.setUserConsent(action.userConsent)
|
||||
if (!action.userConsent) {
|
||||
// User explicitly changed the default value, let's avoid reverting to the default value
|
||||
analytics.setDidAskUserConsent(true)
|
||||
analytics.setDidAskUserConsent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class AnalyticsConsentViewModel @AssistedInject constructor(
|
|||
private fun handleOnScreenLeft() {
|
||||
// Whatever the state of the box, consider the user acknowledge it
|
||||
viewModelScope.launch {
|
||||
analytics.setDidAskUserConsent(true)
|
||||
analytics.setDidAskUserConsent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue