From 8a30ee1c44098b3996cad133d2fbf29cd716abcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Zag=C3=B3rski?= Date: Wed, 20 Nov 2024 11:20:52 +0100 Subject: [PATCH] fix: Countly crash [WPB-14415] (#3649) Co-authored-by: Oussama Hassine --- .../feature/analytics/AnonymousAnalyticsRecorderImpl.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/analytics-enabled/src/main/kotlin/com/wire/android/feature/analytics/AnonymousAnalyticsRecorderImpl.kt b/core/analytics-enabled/src/main/kotlin/com/wire/android/feature/analytics/AnonymousAnalyticsRecorderImpl.kt index 46e9d2ce23e..bee5ab38855 100644 --- a/core/analytics-enabled/src/main/kotlin/com/wire/android/feature/analytics/AnonymousAnalyticsRecorderImpl.kt +++ b/core/analytics-enabled/src/main/kotlin/com/wire/android/feature/analytics/AnonymousAnalyticsRecorderImpl.kt @@ -25,6 +25,7 @@ import com.wire.android.feature.analytics.model.AnalyticsEventConstants import com.wire.android.feature.analytics.model.AnalyticsSettings import ly.count.android.sdk.Countly import ly.count.android.sdk.CountlyConfig +import ly.count.android.sdk.UtilsInternalLimits class AnonymousAnalyticsRecorderImpl : AnonymousAnalyticsRecorder { @@ -73,8 +74,13 @@ class AnonymousAnalyticsRecorderImpl : AnonymousAnalyticsRecorder { Countly.sharedInstance().onStop() } + /** + * We need to change our segmentation map to [MutableMap] because + * Countly is doing additional operations on it. + * See [UtilsInternalLimits.removeUnsupportedDataTypes] + */ override fun sendEvent(event: AnalyticsEvent) { - Countly.sharedInstance().events().recordEvent(event.key, event.toSegmentation()) + Countly.sharedInstance().events().recordEvent(event.key, event.toSegmentation().toMutableMap()) } override fun halt() {