mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Use account display name in chat rooms list when displaying last sent message
This commit is contained in:
parent
803db048d7
commit
7f1216ec45
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 =
|
||||
coreContext.contactsManager.findContactByAddress(msg.fromAddress)?.fullName
|
||||
?: LinphoneUtils.getDisplayName(msg.fromAddress)
|
||||
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…
Add table
Reference in a new issue