mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 13:48:52 +01:00
Fix null conversation title when phone number can't be formatted
This commit is contained in:
@@ -33,16 +33,9 @@ open class Conversation : RealmObject() {
|
|||||||
@Index var blocked: Boolean = false
|
@Index var blocked: Boolean = false
|
||||||
var draft: String = ""
|
var draft: String = ""
|
||||||
|
|
||||||
fun getTitle(): String {
|
fun getTitle() = recipients.joinToString { recipient ->
|
||||||
var title = ""
|
recipient.contact?.name?.takeIf { it.isNotBlank() }
|
||||||
recipients.forEachIndexed { index, recipient ->
|
?: PhoneNumberUtils.formatNumber(recipient.address, Locale.getDefault().country)
|
||||||
val name = recipient.contact?.name?.takeIf { it.isNotBlank() }
|
?: recipient.address
|
||||||
title += name ?: PhoneNumberUtils.formatNumber(recipient.address, Locale.getDefault().country)
|
|
||||||
if (index < recipients.size - 1) {
|
|
||||||
title += ", "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return title
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user