Unverified Commit af2a52f0 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge branch 'develop' into feature/compress-image

parents e2029191 18e06ae0
package chat.rocket.android.chatroom.adapter package chat.rocket.android.chatroom.adapter
import android.app.AlertDialog
import android.content.Context
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import android.view.MenuItem import android.view.MenuItem
import android.view.ViewGroup import android.view.ViewGroup
...@@ -18,7 +20,8 @@ class ChatRoomAdapter( ...@@ -18,7 +20,8 @@ class ChatRoomAdapter(
private val roomName: String? = null, private val roomName: String? = null,
private val presenter: ChatRoomPresenter? = null, private val presenter: ChatRoomPresenter? = null,
private val enableActions: Boolean = true, private val enableActions: Boolean = true,
private val reactionListener: EmojiReactionListener? = null private val reactionListener: EmojiReactionListener? = null,
private val context: Context? = null
) : RecyclerView.Adapter<BaseViewHolder<*>>() { ) : RecyclerView.Adapter<BaseViewHolder<*>>() {
private val dataSet = ArrayList<BaseUiModel<*>>() private val dataSet = ArrayList<BaseUiModel<*>>()
...@@ -233,7 +236,16 @@ class ChatRoomAdapter( ...@@ -233,7 +236,16 @@ class ChatRoomAdapter(
presenter?.unpinMessage(id) presenter?.unpinMessage(id)
} }
} }
R.id.action_message_delete -> presenter?.deleteMessage(roomId, id) R.id.action_message_delete -> {
context?.let {
val builder = AlertDialog.Builder(it)
builder.setTitle(it.getString(R.string.msg_delete_message))
.setMessage(it.getString(R.string.msg_delete_description))
.setPositiveButton(it.getString(R.string.msg_ok)) { _, _ -> presenter?.deleteMessage(roomId, id) }
.setNegativeButton(it.getString(R.string.msg_cancel)) { _, _ -> }
.show()
}
}
R.id.action_menu_msg_react -> presenter?.showReactions(id) R.id.action_menu_msg_react -> presenter?.showReactions(id)
else -> TODO("Not implemented") else -> TODO("Not implemented")
} }
......
...@@ -257,7 +257,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -257,7 +257,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
chatRoomType, chatRoomType,
chatRoomName, chatRoomName,
presenter, presenter,
reactionListener = this@ChatRoomFragment reactionListener = this@ChatRoomFragment,
context = context
) )
recycler_view.adapter = adapter recycler_view.adapter = adapter
if (dataSet.size >= 30) { if (dataSet.size >= 30) {
......
...@@ -132,6 +132,9 @@ ...@@ -132,6 +132,9 @@
// TODO: Add proper translation. // TODO: Add proper translation.
<string name="msg_search">Search</string> <string name="msg_search">Search</string>
<string name="msg_message_copied">Mensaje copiado</string> <string name="msg_message_copied">Mensaje copiado</string>
// TODO: Add proper translation.
<string name="msg_delete_message">Delete Message</string>
<string name="msg_delete_description">Are you sure you want to delete this message</string>
<!-- Create channel messages --> <!-- Create channel messages -->
// TODO: Add proper translation. // TODO: Add proper translation.
......
...@@ -132,6 +132,9 @@ ...@@ -132,6 +132,9 @@
// TODO: Add proper translation. // TODO: Add proper translation.
<string name="msg_search">Search</string> <string name="msg_search">Search</string>
<string name="msg_message_copied">Message copié</string> <string name="msg_message_copied">Message copié</string>
// TODO: Add proper translation.
<string name="msg_delete_message">Delete Message</string>
<string name="msg_delete_description">Are you sure you want to delete this message</string>
<!-- Create channel messages --> <!-- Create channel messages -->
// TODO: Add proper translation. // TODO: Add proper translation.
......
...@@ -123,6 +123,8 @@ ...@@ -123,6 +123,8 @@
// TODO: Add proper translation. // TODO: Add proper translation.
<string name="msg_search">Search</string> <string name="msg_search">Search</string>
<string name="msg_message_copied">संदेश कॉपी किया गया</string> <string name="msg_message_copied">संदेश कॉपी किया गया</string>
<string name="msg_delete_message">संदेश को हटाएं</string>
<string name="msg_delete_description">क्या आप निश्चित रूप से यह संदेश हटाना चाहते हैं</string>
<!-- Create channel messages --> <!-- Create channel messages -->
// TODO: Add proper translation. // TODO: Add proper translation.
......
...@@ -119,6 +119,9 @@ ...@@ -119,6 +119,9 @@
<string name="msg_channel_name">Nome do chat</string> <string name="msg_channel_name">Nome do chat</string>
<string name="msg_search">Buscar</string> <string name="msg_search">Buscar</string>
<string name="msg_message_copied">Mensagem copiada</string> <string name="msg_message_copied">Mensagem copiada</string>
// TODO: Add proper translation.
<string name="msg_delete_message">Delete Message</string>
<string name="msg_delete_description">Are you sure you want to delete this message</string>
<!-- Create channel messages --> <!-- Create channel messages -->
<string name="msg_private_channel">Privado</string> <string name="msg_private_channel">Privado</string>
......
...@@ -117,6 +117,9 @@ ...@@ -117,6 +117,9 @@
<string name="msg_several_users_are_typing">Несколько пользователей печатают…</string> <string name="msg_several_users_are_typing">Несколько пользователей печатают…</string>
<string name="msg_no_search_found">Результатов не найдено</string> <string name="msg_no_search_found">Результатов не найдено</string>
<string name="msg_message_copied">Сообщение скопировано</string> <string name="msg_message_copied">Сообщение скопировано</string>
// TODO: Add proper translation.
<string name="msg_delete_message">Delete Message</string>
<string name="msg_delete_description">Are you sure you want to delete this message</string>
<string name="msg_channel_name">Назва каналу</string> <string name="msg_channel_name">Назва каналу</string>
<string name="msg_search">Пошук</string> <string name="msg_search">Пошук</string>
......
...@@ -133,6 +133,8 @@ ...@@ -133,6 +133,8 @@
<string name="msg_channel_created_successfully">Channel created successfully</string> <string name="msg_channel_created_successfully">Channel created successfully</string>
<string name="msg_message_copied">Message copied</string> <string name="msg_message_copied">Message copied</string>
<string name="msg_delete_message">Delete Message</string>
<string name="msg_delete_description">Are you sure you want to delete this message</string>
<!-- System messages --> <!-- System messages -->
<string name="message_room_name_changed">Room name changed to: %1$s by %2$s</string> <string name="message_room_name_changed">Room name changed to: %1$s by %2$s</string>
......
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