Commit fefae728 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Skip adding reactions that is already posted

parent 4c208955
......@@ -53,7 +53,9 @@ abstract class BaseViewHolder<T : BaseViewModel<*>>(
}
override fun onReactionAdded(messageId: String, emoji: Emoji) {
reactionListener?.onReactionAdded(messageId, emoji)
if (!adapter.contains(emoji.shortname)) {
reactionListener?.onReactionAdded(messageId, emoji)
}
}
}
val context = itemView.context
......
......@@ -71,6 +71,9 @@ class MessageReactionsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>()
notifyItemRangeRemoved(0, oldSize)
}
fun contains(reactionShortname: String) =
reactions.firstOrNull { it.shortname == reactionShortname} != null
class SingleReactionViewHolder(view: View,
private val listener: EmojiReactionListener?)
: RecyclerView.ViewHolder(view), View.OnClickListener {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment