Commit 11b54eda authored by aniket's avatar aniket

Merge branch 'develop' into aniket/feat/create-new-channel

parents 9f9c2ace ca99f416
...@@ -37,7 +37,7 @@ class MessageViewHolder( ...@@ -37,7 +37,7 @@ class MessageViewHolder(
if (data.isTemporary) Color.GRAY else Color.BLACK if (data.isTemporary) Color.GRAY else Color.BLACK
) )
data.message.let { data.message.let {
text_edit_indicator.isVisible = it.isSystemMessage() && it.editedBy != null text_edit_indicator.isVisible = !it.isSystemMessage() && it.editedBy != null
image_star_indicator.isVisible = it.starred?.isNotEmpty() ?: false image_star_indicator.isVisible = it.starred?.isNotEmpty() ?: false
} }
} }
......
...@@ -153,7 +153,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -153,7 +153,7 @@ class ChatRoomPresenter @Inject constructor(
if (offset == 0L) { if (offset == 0L) {
val localMessages = messagesRepository.getByRoomId(chatRoomId) val localMessages = messagesRepository.getByRoomId(chatRoomId)
val oldMessages = mapper.map(localMessages, RoomViewModel(roles = chatRoles, val oldMessages = mapper.map(localMessages, RoomViewModel(roles = chatRoles,
isBroadcast = chatIsBroadcast)) isBroadcast = chatIsBroadcast, isRoom = true))
if (oldMessages.isNotEmpty()) { if (oldMessages.isNotEmpty()) {
view.showMessages(oldMessages) view.showMessages(oldMessages)
loadMissingMessages() loadMissingMessages()
...@@ -194,7 +194,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -194,7 +194,7 @@ class ChatRoomPresenter @Inject constructor(
} }
messagesRepository.saveAll(messages) messagesRepository.saveAll(messages)
view.showMessages(mapper.map(messages, RoomViewModel(roles = chatRoles, view.showMessages(mapper.map(messages, RoomViewModel(roles = chatRoles,
isBroadcast = chatIsBroadcast))) isBroadcast = chatIsBroadcast, isRoom = true)))
} }
fun sendMessage(chatRoomId: String, text: String, messageId: String?) { fun sendMessage(chatRoomId: String, text: String, messageId: String?) {
...@@ -373,7 +373,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -373,7 +373,7 @@ class ChatRoomPresenter @Inject constructor(
if (messages.result.isNotEmpty()) { if (messages.result.isNotEmpty()) {
val models = mapper.map(messages.result, RoomViewModel( val models = mapper.map(messages.result, RoomViewModel(
roles = chatRoles, isBroadcast = chatIsBroadcast)) roles = chatRoles, isBroadcast = chatIsBroadcast, isRoom = true))
messagesRepository.saveAll(messages.result) messagesRepository.saveAll(messages.result)
launchUI(strategy) { launchUI(strategy) {
......
...@@ -4,5 +4,6 @@ import chat.rocket.core.model.ChatRoomRole ...@@ -4,5 +4,6 @@ import chat.rocket.core.model.ChatRoomRole
data class RoomViewModel( data class RoomViewModel(
val roles: List<ChatRoomRole>, val roles: List<ChatRoomRole>,
val isBroadcast: Boolean = false val isBroadcast: Boolean = false,
val isRoom: Boolean = false
) )
\ No newline at end of file
...@@ -120,7 +120,7 @@ class ViewModelMapper @Inject constructor( ...@@ -120,7 +120,7 @@ class ViewModelMapper @Inject constructor(
private fun isBroadcastReplyAvailable(roomViewModel: RoomViewModel, message: Message): Boolean { private fun isBroadcastReplyAvailable(roomViewModel: RoomViewModel, message: Message): Boolean {
val senderUsername = message.sender?.username val senderUsername = message.sender?.username
return roomViewModel.isBroadcast && return roomViewModel.isRoom && roomViewModel.isBroadcast &&
!message.isSystemMessage() && !message.isSystemMessage() &&
senderUsername != currentUsername senderUsername != currentUsername
} }
......
...@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME ...@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionSha256Sum=9af7345c199f1731c187c96d3fe3d31f5405192a42046bafa71d846c3d9adacb
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