From e4b755ced8d0851c36acf49848bc94ae1de6cfbc Mon Sep 17 00:00:00 2001 From: Clark Chen Date: Thu, 18 Jan 2024 14:45:58 -0500 Subject: [PATCH] Correctly count message events for notification heuristic. --- .../securesms/notifications/SlowNotificationHeuristics.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/SlowNotificationHeuristics.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/SlowNotificationHeuristics.kt index 034746643c..28182db88c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/SlowNotificationHeuristics.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/SlowNotificationHeuristics.kt @@ -176,7 +176,7 @@ object SlowNotificationHeuristics { Log.d(TAG, "insufficient data for message latency") return false } - val eventCount = metrics.count { it.name == SignalLocalMetrics.MessageLatency.NAME_HIGH } + val eventCount = metrics.find { it.name == SignalLocalMetrics.MessageLatency.NAME_HIGH }?.count ?: 0 if (eventCount < messageThreshold) { Log.d(TAG, "not enough messages for message latency") return false