hide reactions when not supported by server

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-04-04 22:31:36 +02:00 committed by Marcel Hibbe
parent 4abe8ae41d
commit c19dd5fc71
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
2 changed files with 31 additions and 24 deletions

View file

@ -2436,7 +2436,7 @@ class ChatController(args: Bundle) :
MessageActionsDialog( MessageActionsDialog(
this, this,
message, message,
conversationUser?.userId, conversationUser,
currentConversation, currentConversation,
isShowMessageDeletionButton(message) isShowMessageDeletionButton(message)
).show() ).show()

View file

@ -29,13 +29,15 @@ import com.nextcloud.talk.BuildConfig
import com.nextcloud.talk.R import com.nextcloud.talk.R
import com.nextcloud.talk.controllers.ChatController import com.nextcloud.talk.controllers.ChatController
import com.nextcloud.talk.databinding.DialogMessageActionsBinding import com.nextcloud.talk.databinding.DialogMessageActionsBinding
import com.nextcloud.talk.models.database.UserEntity
import com.nextcloud.talk.models.database.CapabilitiesUtil
import com.nextcloud.talk.models.json.chat.ChatMessage import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.models.json.conversations.Conversation import com.nextcloud.talk.models.json.conversations.Conversation
class MessageActionsDialog( class MessageActionsDialog(
private val chatController: ChatController, private val chatController: ChatController,
private val message: ChatMessage, private val message: ChatMessage,
private val userId: String?, private val user: UserEntity?,
private val currentConversation: Conversation?, private val currentConversation: Conversation?,
private val showMessageDeletionButton: Boolean private val showMessageDeletionButton: Boolean
) : BottomSheetDialog(chatController.activity!!) { ) : BottomSheetDialog(chatController.activity!!) {
@ -53,8 +55,8 @@ class MessageActionsDialog(
initMenuReplyToMessage(message.replyable) initMenuReplyToMessage(message.replyable)
initMenuReplyPrivately( initMenuReplyPrivately(
message.replyable && message.replyable &&
userId?.isNotEmpty() == true && user?.userId?.isNotEmpty() == true &&
userId != "?" && user?.userId != "?" &&
message.user.id.startsWith("users/") && message.user.id.startsWith("users/") &&
message.user.id.substring(ACTOR_LENGTH) != currentConversation?.actorId && message.user.id.substring(ACTOR_LENGTH) != currentConversation?.actorId &&
currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL currentConversation?.type != Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
@ -69,26 +71,31 @@ class MessageActionsDialog(
} }
private fun initEmojiBar() { private fun initEmojiBar() {
dialogMessageActionsBinding.emojiThumbsUp.setOnClickListener { if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions")) {
dismiss() dialogMessageActionsBinding.emojiThumbsUp.setOnClickListener {
} dismiss()
dialogMessageActionsBinding.emojiThumbsDown.setOnClickListener { }
dismiss() dialogMessageActionsBinding.emojiThumbsDown.setOnClickListener {
} dismiss()
dialogMessageActionsBinding.emojiLaugh.setOnClickListener { }
dismiss() dialogMessageActionsBinding.emojiLaugh.setOnClickListener {
} dismiss()
dialogMessageActionsBinding.emojiHeart.setOnClickListener { }
dismiss() dialogMessageActionsBinding.emojiHeart.setOnClickListener {
} dismiss()
dialogMessageActionsBinding.emojiConfused.setOnClickListener { }
dismiss() dialogMessageActionsBinding.emojiConfused.setOnClickListener {
} dismiss()
dialogMessageActionsBinding.emojiSad.setOnClickListener { }
dismiss() dialogMessageActionsBinding.emojiSad.setOnClickListener {
} dismiss()
dialogMessageActionsBinding.emojiMore.setOnClickListener { }
dismiss() dialogMessageActionsBinding.emojiMore.setOnClickListener {
dismiss()
}
dialogMessageActionsBinding.emojiBar.visibility = View.VISIBLE
} else {
dialogMessageActionsBinding.emojiBar.visibility = View.GONE
} }
} }