Commit 445b6db8 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Pin message action

parent f4ea66f8
......@@ -235,6 +235,17 @@ class ChatRoomPresenter @Inject constructor(private val view: ChatRoomView,
}
}
fun pinMessage(messageId: String) {
launchUI(strategy) {
//TODO: Check permissions.
try {
client.pinMessage(messageId)
} catch (e: RocketChatException) {
Timber.e(e)
}
}
}
private suspend fun listenMessages(roomId: String) {
launch(CommonPool + strategy.jobs) {
for (message in client.messagesChannel) {
......
......@@ -115,6 +115,7 @@ class ChatRoomAdapter(private val serverUrl: String,
R.id.action_menu_msg_reply -> presenter.citeMessage(serverUrl, roomType, roomName, id, "", true)
R.id.action_menu_msg_copy -> presenter.copyMessage(id)
R.id.action_menu_msg_edit -> presenter.editMessage(roomId, id, getOriginalMessage())
R.id.action_menu_msg_pin -> presenter.pinMessage(id)
else -> TODO("Not implemented")
}
}
......
......@@ -27,10 +27,10 @@
<!--android:icon="@drawable/ic_share_black_24px"-->
<!--android:title="@string/action_msg_share" />-->
<!--<item-->
<!--android:id="@+id/action_menu_msg_pin"-->
<!--android:icon="@drawable/ic_pin_black_24dp"-->
<!--android:title="@string/action_msg_pin" />-->
<item
android:id="@+id/action_menu_msg_pin"
android:icon="@drawable/ic_pin_black_24dp"
android:title="@string/action_msg_pin" />
<!--<item-->
<!--android:id="@+id/action_menu_msg_star"-->
......
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