From a88410faaf47a3d599a706a1464d4b09d2e5b5ef Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Wed, 15 Feb 2023 10:07:32 -0500 Subject: [PATCH] Fix incorrect quick react emojis for story replies. --- .../viewer/reply/composer/StoryReplyComposer.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/stories/viewer/reply/composer/StoryReplyComposer.kt b/app/src/main/java/org/thoughtcrime/securesms/stories/viewer/reply/composer/StoryReplyComposer.kt index 0637d22f4..c9d57dedf 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/stories/viewer/reply/composer/StoryReplyComposer.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/stories/viewer/reply/composer/StoryReplyComposer.kt @@ -178,14 +178,15 @@ class StoryReplyComposer @JvmOverloads constructor( } private fun getReactionEmojis(): List> { - val reactionEmoji = SignalStore.emojiValues().reactions - val recentEmoji = RecentEmojiPageModel(context, ReactWithAnyEmojiBottomSheetDialogFragment.REACTION_STORAGE_KEY).emoji - val emoji = (reactionEmoji + recentEmoji).distinct() - val displayEmoji: List = emoji + val reactionDisplayEmoji: List = SignalStore.emojiValues().reactions.map { Emoji(it) } + val canonicalReactionEmoji: List = reactionDisplayEmoji.map { EmojiSource.latest.variationsToCanonical[it.value] ?: it.value } + val canonicalRecentReactionEmoji: Set = LinkedHashSet(RecentEmojiPageModel(context, ReactWithAnyEmojiBottomSheetDialogFragment.REACTION_STORAGE_KEY).emoji) - canonicalReactionEmoji.toSet() + + val recentDisplayEmoji: List = canonicalRecentReactionEmoji .mapNotNull { canonical -> EmojiSource.latest.canonicalToVariations[canonical] } .map { Emoji(it) } - return EmojiReactionsPageModel(emoji, displayEmoji).toMappingModels() + return EmojiReactionsPageModel(canonicalReactionEmoji + canonicalRecentReactionEmoji, reactionDisplayEmoji + recentDisplayEmoji).toMappingModels() } private fun onEmojiToggleClicked() {