From a2568f165918622609c1965f3fad727b9b147794 Mon Sep 17 00:00:00 2001 From: Ben Iofel Date: Tue, 26 Aug 2025 22:32:22 -0400 Subject: [PATCH] simplify target matching --- .../com/moez/QKSMS/util/EmojiReactionUtils.kt | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/data/src/main/java/com/moez/QKSMS/util/EmojiReactionUtils.kt b/data/src/main/java/com/moez/QKSMS/util/EmojiReactionUtils.kt index 5aa7f3bb..728ed297 100644 --- a/data/src/main/java/com/moez/QKSMS/util/EmojiReactionUtils.kt +++ b/data/src/main/java/com/moez/QKSMS/util/EmojiReactionUtils.kt @@ -78,25 +78,12 @@ object EmojiReactionUtils { .limit(50) // TODO: should we keep this limit? .findAll() - val exactMatch = messages.find { message -> + val match = messages.find { message -> message.getText(false).trim() == originalMessageText.trim() } - if (exactMatch != null) { - Timber.d("Found exact match for reaction target: message ID ${exactMatch.id}") - return exactMatch - } - - // Try partial match (in case of truncation) - val partialMatch = messages.find { message -> - val text = message.getText(false).trim() - text.isNotEmpty() && ( - text.contains(originalMessageText.trim(), ignoreCase = true) || - originalMessageText.trim().contains(text, ignoreCase = true) - ) - } - if (partialMatch != null) { - Timber.d("Found partial match for reaction target: message ID ${partialMatch.id}") - return partialMatch + if (match != null) { + Timber.d("Found match for reaction target: message ID ${match.id}") + return match } Timber.w("No target message found for reaction text: '$originalMessageText'")