Fix formatting of senders and receivers
This commit is contained in:
parent
a5d6e7724c
commit
6fef121599
|
@ -45,8 +45,20 @@ class MessageDetailsDialog(val activity: BaseSimpleActivity, val message: Messag
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Message.getReceiverOrSenderPhoneNumbers(): String {
|
private fun Message.getReceiverOrSenderPhoneNumbers(): String {
|
||||||
return participants.joinToString(", ") {
|
return if (isReceivedMessage()) {
|
||||||
it.phoneNumbers.first().value
|
formatContactInfo(senderName, senderPhoneNumber)
|
||||||
|
} else {
|
||||||
|
participants.joinToString(", ") {
|
||||||
|
formatContactInfo(it.name, it.phoneNumbers.first().value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun formatContactInfo(name: String, phoneNumber: String): String {
|
||||||
|
return if (name != phoneNumber) {
|
||||||
|
"$name ($phoneNumber)"
|
||||||
|
} else {
|
||||||
|
phoneNumber
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue