Commit 66ae235a authored by Leonardo Aramaki's avatar Leonardo Aramaki

Show real name instead of username on chat list

parent 32e8e70f
...@@ -289,8 +289,9 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -289,8 +289,9 @@ class ChatRoomsPresenter @Inject constructor(
private suspend fun getChatRoomsWithPreviews(chatRooms: List<ChatRoom>): List<ChatRoom> { private suspend fun getChatRoomsWithPreviews(chatRooms: List<ChatRoom>): List<ChatRoom> {
return chatRooms.map { return chatRooms.map {
if (it.lastMessage != null) { val lastMessage = it.lastMessage
it.copy(lastMessage = viewModelMapper.map(it.lastMessage!!).last().preview) if (lastMessage != null) {
it.copy(lastMessage = viewModelMapper.map(lastMessage).last().preview)
} else { } else {
it it
} }
......
...@@ -112,7 +112,15 @@ class ChatRoomsAdapter(private val context: Context, ...@@ -112,7 +112,15 @@ class ChatRoomsAdapter(private val context: Context,
} }
private fun bindName(chatRoom: ChatRoom, textView: TextView) { private fun bindName(chatRoom: ChatRoom, textView: TextView) {
textView.textContent = chatRoom.name textView.textContent = chatRoomName(chatRoom)
}
private fun chatRoomName(chatRoom: ChatRoom): String {
return if (settings.useRealName()) {
chatRoom.fullName ?: chatRoom.name
} else {
chatRoom.name
}
} }
private fun bindLastMessageDateTime(chatRoom: ChatRoom, textView: TextView) { private fun bindLastMessageDateTime(chatRoom: ChatRoom, textView: TextView) {
......
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