Only store necessary strings in AvatarView, instead of realm model (contact or recipient)

This commit is contained in:
Moez Bhatti
2018-04-07 15:52:05 -04:00
parent 04950bc8c8
commit 98cc36beeb
11 changed files with 58 additions and 51 deletions
+1 -7
View File
@@ -18,12 +18,10 @@
*/
package model
import android.telephony.PhoneNumberUtils
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.Index
import io.realm.annotations.PrimaryKey
import java.util.*
open class Conversation : RealmObject() {
@@ -38,9 +36,5 @@ open class Conversation : RealmObject() {
var me: Boolean = false
var draft: String = ""
fun getTitle() = recipients.joinToString { recipient ->
recipient.contact?.name?.takeIf { it.isNotBlank() }
?: PhoneNumberUtils.formatNumber(recipient.address, Locale.getDefault().country)
?: recipient.address
}
fun getTitle() = recipients.joinToString { recipient -> recipient.getDisplayName() }
}