private fun reactToMessage(reaction: Reaction, message: Message) { val channelState = channelState.value ?: return  if (message.ownReactions.any { it.messageId == reaction.messageId && it.type == reaction.type }) { chatClient.deleteReaction( messageId = message.id, reactionType = reaction.type, cid = channelState.cid ).enqueue() } else { chatClient.sendReaction( reaction = reaction, enforceUnique = enforceUniqueReactions, cid = channelState.cid ).enqueue() } }
Triggered when the user chooses the [React] action for the currently selected message. If the message already has that reaction, from the current user, we remove it. Otherwise we add a new reaction.