mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2763 Vault | Tech | Add basic analytics events (#1640)
This commit is contained in:
parent
2c00bf1a12
commit
d67644b062
4 changed files with 44 additions and 4 deletions
|
@ -169,6 +169,10 @@ object EventsDictionary {
|
|||
const val clickOnboarding = "ClickOnboarding"
|
||||
const val clickLogin = "ClickLogin"
|
||||
|
||||
// Vault events
|
||||
|
||||
const val screenVault = "ScreenOnboarding"
|
||||
|
||||
// About-app screen
|
||||
|
||||
const val MENU_HELP = "MenuHelp"
|
||||
|
@ -304,7 +308,8 @@ object EventsDictionary {
|
|||
const val screenSettings = "ScreenSettings"
|
||||
const val firstSession = "FirstSession"
|
||||
const val beforeLogout = "BeforeLogout"
|
||||
const val menu = "menu"
|
||||
const val menu = "Menu"
|
||||
const val general = "General"
|
||||
const val dataView = "dataview"
|
||||
const val block = "block"
|
||||
const val bookmark = "bookmark"
|
||||
|
|
|
@ -200,6 +200,7 @@ class SelectObjectTypeFragment : BaseBottomSheetComposeFragment() {
|
|||
}.onFailure {
|
||||
Timber.e(it, "Error while processing clipboard")
|
||||
}
|
||||
vm.onResume()
|
||||
}
|
||||
|
||||
private fun proceedWithCommand(command: Command) {
|
||||
|
|
|
@ -5,6 +5,9 @@ import androidx.lifecycle.ViewModelProvider
|
|||
import androidx.lifecycle.viewModelScope
|
||||
import com.anytypeio.anytype.analytics.base.Analytics
|
||||
import com.anytypeio.anytype.analytics.base.EventsDictionary
|
||||
import com.anytypeio.anytype.analytics.base.EventsPropertiesKey
|
||||
import com.anytypeio.anytype.analytics.base.sendEvent
|
||||
import com.anytypeio.anytype.analytics.props.Props
|
||||
import com.anytypeio.anytype.core_models.EMPTY_QUERY
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.Key
|
||||
|
@ -449,6 +452,19 @@ class SelectObjectTypeViewModel(
|
|||
}
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
viewModelScope.launch {
|
||||
analytics.sendEvent(
|
||||
eventName = EventsDictionary.screenVault,
|
||||
props = Props(
|
||||
map = mapOf(
|
||||
EventsPropertiesKey.type to EventsDictionary.Type.menu
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class Factory @Inject constructor(
|
||||
private val params: Params,
|
||||
private val getObjectTypes: GetObjectTypes,
|
||||
|
|
|
@ -3,6 +3,11 @@ package com.anytypeio.anytype.presentation.vault
|
|||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.anytypeio.anytype.analytics.base.Analytics
|
||||
import com.anytypeio.anytype.analytics.base.EventsDictionary
|
||||
import com.anytypeio.anytype.analytics.base.EventsPropertiesKey
|
||||
import com.anytypeio.anytype.analytics.base.sendEvent
|
||||
import com.anytypeio.anytype.analytics.props.Props
|
||||
import com.anytypeio.anytype.core_models.Id
|
||||
import com.anytypeio.anytype.core_models.ObjectWrapper
|
||||
import com.anytypeio.anytype.core_models.Wallpaper
|
||||
|
@ -40,7 +45,8 @@ class VaultViewModel(
|
|||
private val getVaultSettings: GetVaultSettings,
|
||||
private val setVaultSettings: SetVaultSettings,
|
||||
private val observeVaultSettings: ObserveVaultSettings,
|
||||
private val setVaultSpaceOrder: SetVaultSpaceOrder
|
||||
private val setVaultSpaceOrder: SetVaultSpaceOrder,
|
||||
private val analytics: Analytics
|
||||
) : BaseViewModel() {
|
||||
|
||||
val spaces = MutableStateFlow<List<VaultSpaceView>>(emptyList())
|
||||
|
@ -135,6 +141,16 @@ class VaultViewModel(
|
|||
}
|
||||
|
||||
fun onResume() {
|
||||
viewModelScope.launch {
|
||||
analytics.sendEvent(
|
||||
eventName = EventsDictionary.screenVault,
|
||||
props = Props(
|
||||
map = mapOf(
|
||||
EventsPropertiesKey.type to EventsDictionary.Type.general
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
viewModelScope.launch {
|
||||
getVaultSettings.async(Unit).onSuccess { settings ->
|
||||
if (settings.showIntroduceVault) {
|
||||
|
@ -171,7 +187,8 @@ class VaultViewModel(
|
|||
private val getVaultSettings: GetVaultSettings,
|
||||
private val setVaultSettings: SetVaultSettings,
|
||||
private val setVaultSpaceOrder: SetVaultSpaceOrder,
|
||||
private val observeVaultSettings: ObserveVaultSettings
|
||||
private val observeVaultSettings: ObserveVaultSettings,
|
||||
private val analytics: Analytics
|
||||
) : ViewModelProvider.Factory {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel> create(
|
||||
|
@ -185,7 +202,8 @@ class VaultViewModel(
|
|||
getVaultSettings = getVaultSettings,
|
||||
setVaultSettings = setVaultSettings,
|
||||
setVaultSpaceOrder = setVaultSpaceOrder,
|
||||
observeVaultSettings = observeVaultSettings
|
||||
observeVaultSettings = observeVaultSettings,
|
||||
analytics = analytics
|
||||
) as T
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue