mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-1489 Analytics | Create object event (#142)
This commit is contained in:
parent
4afde82d8c
commit
97e0cfce11
5 changed files with 31 additions and 22 deletions
|
@ -30,7 +30,6 @@ object EventsDictionary {
|
|||
const val authScreenShow = "ScreenIndex"
|
||||
const val loginScreenShow = "ScreenLogin"
|
||||
const val searchScreenShow = "ScreenSearch"
|
||||
const val createObjectNavBar = "CreateObjectNavBar"
|
||||
const val createObjectCollectionsNavBar = "CreateObjectCollectionsNavBar"
|
||||
const val signupScreenShow = "ScreenAuthRegistration"
|
||||
const val invitationScreenShow = "ScreenAuthInvitation"
|
||||
|
@ -161,9 +160,9 @@ object EventsDictionary {
|
|||
const val objCreateMention = "Mention"
|
||||
const val objPowerTool = "Powertool"
|
||||
const val objTurnInto = "TurnInto"
|
||||
const val tabFavorites = "Favorites"
|
||||
const val screenSettings = "ScreenSettings"
|
||||
const val screenDeletion = "ScreenDeletion"
|
||||
const val navigation = "Navigation"
|
||||
}
|
||||
|
||||
object Type {
|
||||
|
@ -189,6 +188,14 @@ object EventsDictionary {
|
|||
const val paste = "Paste"
|
||||
const val openObject = "OpenObject"
|
||||
}
|
||||
|
||||
/**
|
||||
* This parameter is used to separate the use of the navigation bar from the dashboard or from the editor/sets
|
||||
*/
|
||||
object View {
|
||||
const val viewHome = "Home"
|
||||
const val viewNavbar = "Navbar"
|
||||
}
|
||||
}
|
||||
|
||||
object EventsPropertiesKey {
|
||||
|
@ -208,4 +215,5 @@ object EventsPropertiesKey {
|
|||
const val condition = "condition"
|
||||
const val align = "align"
|
||||
const val originalId = "originalId"
|
||||
const val view = "view"
|
||||
}
|
|
@ -3149,12 +3149,6 @@ class EditorViewModel(
|
|||
|
||||
Timber.d("onAddNewDocumentClicked, ")
|
||||
|
||||
viewModelScope.sendEvent(
|
||||
analytics = analytics,
|
||||
eventName = EventsDictionary.createObjectNavBar,
|
||||
props = Props(mapOf(EventsPropertiesKey.context to analyticsContext))
|
||||
)
|
||||
|
||||
val startTime = System.currentTimeMillis()
|
||||
jobs += viewModelScope.launch {
|
||||
createObject.execute(CreateObject.Param(type = null))
|
||||
|
@ -3164,7 +3158,8 @@ class EditorViewModel(
|
|||
analytics = analytics,
|
||||
type = result.type,
|
||||
storeOfObjectTypes = storeOfObjectTypes,
|
||||
route = EventsDictionary.Routes.objPowerTool,
|
||||
route = EventsDictionary.Routes.navigation,
|
||||
view = EventsDictionary.View.viewNavbar,
|
||||
startTime = startTime
|
||||
)
|
||||
proceedWithOpeningObject(result.objectId)
|
||||
|
|
|
@ -262,7 +262,8 @@ private fun propsForObjectEvents(
|
|||
route: String? = null,
|
||||
context: String? = null,
|
||||
originalId: String? = null,
|
||||
sourceObject: String? = null
|
||||
sourceObject: String? = null,
|
||||
view: String? = null
|
||||
): Props {
|
||||
val objType = sourceObject ?: OBJ_TYPE_CUSTOM
|
||||
val layout = layoutCode?.toInt()?.let { code ->
|
||||
|
@ -276,7 +277,8 @@ private fun propsForObjectEvents(
|
|||
EventsPropertiesKey.layout to layout,
|
||||
EventsPropertiesKey.route to route,
|
||||
EventsPropertiesKey.context to context,
|
||||
EventsPropertiesKey.originalId to originalId
|
||||
EventsPropertiesKey.originalId to originalId,
|
||||
EventsPropertiesKey.view to view
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -681,7 +683,8 @@ fun CoroutineScope.sendAnalyticsObjectCreateEvent(
|
|||
storeOfObjectTypes: StoreOfObjectTypes,
|
||||
type: String?,
|
||||
route: String,
|
||||
startTime: Long? = null
|
||||
startTime: Long? = null,
|
||||
view: String? = null
|
||||
) {
|
||||
this.launch {
|
||||
val objType = type?.let { storeOfObjectTypes.get(it) }
|
||||
|
@ -691,7 +694,8 @@ fun CoroutineScope.sendAnalyticsObjectCreateEvent(
|
|||
route = route,
|
||||
context = analytics.getContext(),
|
||||
originalId = analytics.getOriginalId(),
|
||||
sourceObject = objType?.sourceObject
|
||||
sourceObject = objType?.sourceObject,
|
||||
view = view
|
||||
),
|
||||
startTime = startTime,
|
||||
middleTime = System.currentTimeMillis()
|
||||
|
|
|
@ -897,8 +897,9 @@ class HomeScreenViewModel(
|
|||
analytics = analytics,
|
||||
type = result.type,
|
||||
storeOfObjectTypes = storeOfObjectTypes,
|
||||
route = EventsDictionary.Routes.objCreateHome,
|
||||
route = EventsDictionary.Routes.navigation,
|
||||
startTime = startTime,
|
||||
view = EventsDictionary.View.viewHome
|
||||
)
|
||||
navigate(Navigation.OpenObject(result.objectId))
|
||||
},
|
||||
|
|
|
@ -51,6 +51,7 @@ import com.anytypeio.anytype.presentation.editor.editor.model.BlockView
|
|||
import com.anytypeio.anytype.presentation.editor.model.TextUpdate
|
||||
import com.anytypeio.anytype.presentation.extension.ObjectStateAnalyticsEvent
|
||||
import com.anytypeio.anytype.presentation.extension.logEvent
|
||||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsObjectCreateEvent
|
||||
import com.anytypeio.anytype.presentation.extension.sendAnalyticsRelationValueEvent
|
||||
import com.anytypeio.anytype.presentation.navigation.AppNavigation
|
||||
import com.anytypeio.anytype.presentation.navigation.SupportNavigation
|
||||
|
@ -1191,19 +1192,19 @@ class ObjectSetViewModel(
|
|||
fun onAddNewDocumentClicked() {
|
||||
Timber.d("onAddNewDocumentClicked, ")
|
||||
|
||||
viewModelScope.sendEvent(
|
||||
analytics = analytics,
|
||||
eventName = EventsDictionary.createObjectNavBar,
|
||||
)
|
||||
val startTime = System.currentTimeMillis()
|
||||
jobs += viewModelScope.launch {
|
||||
createObject.execute(CreateObject.Param(type = null)).fold(
|
||||
onSuccess = { result ->
|
||||
sendAnalyticsObjectCreateEvent(
|
||||
startTime = startTime,
|
||||
objectType = result.type
|
||||
)
|
||||
proceedWithOpeningObject(result.objectId)
|
||||
sendAnalyticsObjectCreateEvent(
|
||||
analytics = analytics,
|
||||
startTime = startTime,
|
||||
storeOfObjectTypes = storeOfObjectTypes,
|
||||
type = result.type,
|
||||
route = EventsDictionary.Routes.navigation,
|
||||
view = EventsDictionary.View.viewNavbar
|
||||
)
|
||||
},
|
||||
onFailure = { e ->
|
||||
Timber.e(e, "Error while creating a new object")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue