allowing nullable posthog properties to be submitted
- fixes crash when attempting to identify with empty properties - will need rebasing with https://github.com/matrix-org/matrix-analytics-events/pull/20
This commit is contained in:
parent
741f9fabbb
commit
d77e18f810
|
@ -179,7 +179,7 @@ class DefaultVectorAnalytics @Inject constructor(
|
||||||
posthog?.identify(REUSE_EXISTING_ID, identity.getProperties().toPostHogProperties(), IGNORED_OPTIONS)
|
posthog?.identify(REUSE_EXISTING_ID, identity.getProperties().toPostHogProperties(), IGNORED_OPTIONS)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Map<String, Any>?.toPostHogProperties(): Properties? {
|
private fun Map<String, Any?>?.toPostHogProperties(): Properties? {
|
||||||
if (this == null) return null
|
if (this == null) return null
|
||||||
|
|
||||||
return Properties().apply {
|
return Properties().apply {
|
||||||
|
|
|
@ -18,5 +18,5 @@ package im.vector.app.features.analytics.itf
|
||||||
|
|
||||||
interface VectorAnalyticsEvent {
|
interface VectorAnalyticsEvent {
|
||||||
fun getName(): String
|
fun getName(): String
|
||||||
fun getProperties(): Map<String, Any>?
|
fun getProperties(): Map<String, Any?>?
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,9 @@ data class Identity(
|
||||||
|
|
||||||
override fun getName() = "Identity"
|
override fun getName() = "Identity"
|
||||||
|
|
||||||
override fun getProperties(): Map<String, Any>? {
|
override fun getProperties(): Map<String, Any?>? {
|
||||||
return mutableMapOf<String, Any>().apply {
|
return mutableMapOf<String, Any?>().apply {
|
||||||
ftueUseCaseSelection?.let { put("ftueUseCaseSelection", it.name) }
|
put("ftueUseCaseSelection", null)
|
||||||
}.takeIf { it.isNotEmpty() }
|
}.takeIf { it.isNotEmpty() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue