1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 05:47:05 +09:00

DROID-3574 Analytics | ScreenTemplateSelector and ScreenTypeTemplateSelector events (#2369)

This commit is contained in:
Konstantin Ivanov 2025-04-30 10:14:37 +02:00 committed by Evgenii Kozlov
parent 678ac9a78e
commit 5c090be64a
4 changed files with 41 additions and 4 deletions

View file

@ -262,6 +262,7 @@ import com.anytypeio.anytype.presentation.editor.model.OnEditorDatePickerEvent.O
import com.anytypeio.anytype.presentation.extension.getFileDetailsForBlock
import com.anytypeio.anytype.presentation.extension.getTypeForObject
import com.anytypeio.anytype.presentation.extension.getUrlForFileContent
import com.anytypeio.anytype.presentation.extension.sendAnalyticsScreenTemplateSelectorEvent
import com.anytypeio.anytype.presentation.navigation.NavPanelState
import com.anytypeio.anytype.presentation.navigation.leftButtonClickAnalytics
import com.anytypeio.anytype.presentation.objects.getCreateObjectParams
@ -4661,7 +4662,7 @@ class EditorViewModel(
else EventsDictionary.relationChangeValue,
storeOfRelations = storeOfRelations,
relationKey = key,
spaceParams = provideParams(spaceManager.get())
spaceParams = provideParams(vmParams.space.id)
)
},
failure = {
@ -6831,7 +6832,11 @@ class EditorViewModel(
EventWrapper(
AppNavigation.Command.OpenTemplates(typeId = state.typeId)
)
)
).also {
viewModelScope.launch {
sendAnalyticsScreenTemplateSelectorEvent(analytics, provideParams(vmParams.space.id))
}
}
} else {
Timber.e("State of templates widget is invalid when clicked, should be SelectTemplateViewState.Activ")
}
@ -7526,7 +7531,7 @@ class EditorViewModel(
eventName = EventsDictionary.relationAdd,
storeOfRelations = storeOfRelations,
relationKey = view.key,
spaceParams = provideParams(spaceManager.get())
spaceParams = provideParams(vmParams.space.id)
)
action.invoke()
}

View file

@ -17,6 +17,7 @@ import com.anytypeio.anytype.analytics.base.EventsDictionary.duplicateTemplate
import com.anytypeio.anytype.analytics.base.EventsDictionary.duplicateView
import com.anytypeio.anytype.analytics.base.EventsDictionary.editTemplate
import com.anytypeio.anytype.analytics.base.EventsDictionary.logScreenEditType
import com.anytypeio.anytype.analytics.base.EventsDictionary.logScreenTemplateSelector
import com.anytypeio.anytype.analytics.base.EventsDictionary.objectCreate
import com.anytypeio.anytype.analytics.base.EventsDictionary.objectCreateLink
import com.anytypeio.anytype.analytics.base.EventsDictionary.objectDuplicate
@ -1503,6 +1504,17 @@ fun CoroutineScope.logEvent(
props = buildProps(route = route, spaceParams = spaceParams)
)
}
ObjectStateAnalyticsEvent.SCREEN_TYPE_TEMPLATE_SELECTOR -> {
if (state is ObjectState.DataView.TypeSet) {
scope.sendEvent(
analytics = analytics,
eventName = EventsDictionary.logScreenTypeTemplateSelector,
startTime = startTime,
middleTime = middleTime,
props = buildProps(spaceParams = spaceParams)
)
}
}
}
}
@ -1557,7 +1569,8 @@ enum class ObjectStateAnalyticsEvent {
DUPLICATE_TEMPLATE,
DELETE_TEMPLATE,
SET_AS_DEFAULT_TYPE,
CHANGE_DEFAULT_TEMPLATE
CHANGE_DEFAULT_TEMPLATE,
SCREEN_TYPE_TEMPLATE_SELECTOR
}
fun CoroutineScope.sendEditWidgetsEvent(
@ -2112,6 +2125,22 @@ fun CoroutineScope.sendAnalyticsSelectTemplateEvent(
)
}
fun CoroutineScope.sendAnalyticsScreenTemplateSelectorEvent(
analytics: Analytics,
spaceParams: AnalyticSpaceHelperDelegate.Params
) {
sendEvent(
analytics = analytics,
eventName = logScreenTemplateSelector,
props = Props(
buildMap {
put(EventsPropertiesKey.permissions, spaceParams.permission)
put(EventsPropertiesKey.spaceType, spaceParams.spaceType)
}
)
)
}
fun CoroutineScope.sendAnalyticsCreateTemplateEvent(
analytics: Analytics,
details: Map<Id, Struct>,

View file

@ -2131,6 +2131,7 @@ class ObjectSetViewModel(
selectedTypeFlow.value = type
}
logEvent(ObjectStateAnalyticsEvent.SHOW_TEMPLATES)
logEvent(ObjectStateAnalyticsEvent.SCREEN_TYPE_TEMPLATE_SELECTOR)
}
fun onTypeTemplatesWidgetAction(action: TypeTemplatesWidgetUIAction) {