properly set the thread title if it contains no messages

This commit is contained in:
tibbi 2020-04-08 22:31:15 +02:00
parent ef09a8871a
commit fb45d68835
3 changed files with 14 additions and 4 deletions

View file

@ -1,12 +1,12 @@
package com.simplemobiletools.smsmessenger.models
import android.provider.Telephony
import android.text.TextUtils
import com.simplemobiletools.smsmessenger.extensions.getThreadTitle
data class Message(
val id: Int, val body: String, val type: Int, val participants: ArrayList<Contact>, val date: Int, val read: Boolean, val thread: Int
) : ThreadItem() {
fun isReceivedMessage() = type == Telephony.Sms.MESSAGE_TYPE_INBOX
fun getThreadTitle() = TextUtils.join(", ", participants.map { it.name }.toTypedArray())
fun getThreadTitle() = participants.getThreadTitle()
}