Use account display name in chat rooms list when displaying last sent message
This commit is contained in:
parent
773a2ee317
commit
5b529e8e3a
1 changed files with 11 additions and 2 deletions
|
@ -234,9 +234,18 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelI
|
|||
private fun formatLastMessage(msg: ChatMessage?): String {
|
||||
if (msg == null) return ""
|
||||
|
||||
val account = coreContext.core.accountList.find { account ->
|
||||
account.params.identityAddress?.asStringUriOnly() == msg.fromAddress.asStringUriOnly()
|
||||
}
|
||||
val localDisplayName = account?.params?.identityAddress?.displayName
|
||||
|
||||
val sender: String =
|
||||
if (msg.isOutgoing && localDisplayName != null) {
|
||||
localDisplayName
|
||||
} else {
|
||||
coreContext.contactsManager.findContactByAddress(msg.fromAddress)?.fullName
|
||||
?: LinphoneUtils.getDisplayName(msg.fromAddress)
|
||||
}
|
||||
var body = ""
|
||||
for (content in msg.contents) {
|
||||
if (content.isFile || content.isFileTransfer) body += content.name + " "
|
||||
|
|
Loading…
Reference in a new issue