mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Merge pull request #676 from benwaffle/emoji-count
Display all reacted emojis
This commit is contained in:
@@ -402,18 +402,14 @@ class MessagesAdapter @Inject constructor(
|
||||
val hasReactions = reactions.isNotEmpty()
|
||||
|
||||
if (hasReactions) {
|
||||
val reactionCounts = reactions.groupBy { it.emoji }
|
||||
.mapValues { it.value.size }
|
||||
.toList()
|
||||
.sortedByDescending { it.second } // Sort by count, most reactions first
|
||||
val uniqueEmojis = reactions.map { it.emoji }.distinct()
|
||||
val totalCount = reactions.size
|
||||
|
||||
// For now, show just the first (most popular) reaction
|
||||
val topReaction = reactionCounts.first()
|
||||
val reactionText = if (topReaction.second == 1) {
|
||||
topReaction.first
|
||||
// Show unique emojis followed by total count
|
||||
val reactionText = if (totalCount == 1) {
|
||||
uniqueEmojis.first()
|
||||
} else {
|
||||
// Use a non-breaking space to keep the emoji and count together
|
||||
"${topReaction.first}\u00A0${topReaction.second}"
|
||||
"${uniqueEmojis.joinToString("")}\u00A0$totalCount"
|
||||
}
|
||||
|
||||
holder.reactionText?.text = reactionText
|
||||
|
||||
Reference in New Issue
Block a user