From e6b55922d018c2c8f458ca1a17e8fadebd13a580 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 10 Dec 2025 10:15:09 +0100 Subject: [PATCH] WIP analyze why emoji is not sent as styled emoji MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is something wrong with sending the Emoji Variation Selector. I debugged and saw that there are differences between web and android: from web: emoji ❤️ code U+2764 code U+FE0F from Android: emoji ❤ code U+2764 So this is about Emoji Variation Selector (VS-16). The emojis that are send from android are not styled (they do not include the Emoji Variation Selector). If i append FE0F to the classic emojis, it is fixed. But it seems the challenge is to decide when to append the Emoji Variation Selector. i quickly tried to append the style if there is not already one while sending. Works for classic emojis to append the style but other styled emojis are duplicated... pausing for now due to other important things.. Signed-off-by: Marcel Hibbe --- .../talk/adapters/messages/Reaction.kt | 11 ++++++++++ .../reactions/ReactionsRepositoryImpl.kt | 20 +++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt index d44f47eca42..61b30a90e3d 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt @@ -7,6 +7,7 @@ package com.nextcloud.talk.adapters.messages import android.content.Context +import android.util.Log import android.view.View import android.view.ViewGroup import android.widget.LinearLayout @@ -32,6 +33,16 @@ class Reaction { binding.reactionsEmojiWrapper.removeAllViews() if (message.reactions != null && message.reactions!!.isNotEmpty()) { + message.reactions!!.forEach { + val emoji = it.key + + Log.d("emoji", emoji) + + emoji.codePoints().forEach { cp -> + Log.d("code", "U+${cp.toString(16).uppercase()}") + } + } + binding.reactionsEmojiWrapper.visibility = View.VISIBLE binding.reactionsEmojiWrapper.setOnLongClickListener { diff --git a/app/src/main/java/com/nextcloud/talk/repositories/reactions/ReactionsRepositoryImpl.kt b/app/src/main/java/com/nextcloud/talk/repositories/reactions/ReactionsRepositoryImpl.kt index 2da7e51492e..f2e0433fa07 100644 --- a/app/src/main/java/com/nextcloud/talk/repositories/reactions/ReactionsRepositoryImpl.kt +++ b/app/src/main/java/com/nextcloud/talk/repositories/reactions/ReactionsRepositoryImpl.kt @@ -32,6 +32,22 @@ class ReactionsRepositoryImpl @Inject constructor( val credentials: String = ApiUtils.getCredentials(currentUser.username, currentUser.token)!! override fun addReaction(roomToken: String, message: ChatMessage, emoji: String): Observable { + + fun forceEmojiStyle(text: String): String { + if (text.isEmpty()) return text + + val cps = text.codePoints().toArray() + val lastCp = cps.last() + + return if (lastCp != 0xFE0F) { + text + "\uFE0F" + } else { + text + } + } + + val styledEmoji = forceEmojiStyle(emoji) + return ncApi.sendReaction( credentials, ApiUtils.getUrlForMessageReaction( @@ -39,9 +55,9 @@ class ReactionsRepositoryImpl @Inject constructor( roomToken, message.id ), - emoji + styledEmoji ).map { - val model = mapToReactionAddedModel(message, emoji, it.ocs?.meta!!) + val model = mapToReactionAddedModel(message, styledEmoji, it.ocs?.meta!!) persistAddedModel(model, roomToken) return@map model }