forked from upstream-mirrors/quik
Fix case where Conversation isn't returned and can't send message
This commit is contained in:
@@ -23,23 +23,24 @@ import io.realm.RealmObject
|
||||
import io.realm.annotations.Index
|
||||
import io.realm.annotations.PrimaryKey
|
||||
|
||||
open class Conversation : RealmObject() {
|
||||
open class Conversation(
|
||||
@PrimaryKey var id: Long = 0,
|
||||
@Index var archived: Boolean = false,
|
||||
@Index var blocked: Boolean = false,
|
||||
var recipients: RealmList<Recipient> = RealmList(),
|
||||
var count: Int = 0,
|
||||
var date: Long = 0,
|
||||
var snippet: String = "",
|
||||
var read: Boolean = true,
|
||||
var me: Boolean = false,
|
||||
var draft: String = "",
|
||||
|
||||
@PrimaryKey var id: Long = 0
|
||||
@Index var archived: Boolean = false
|
||||
@Index var blocked: Boolean = false
|
||||
var recipients: RealmList<Recipient> = RealmList()
|
||||
var count: Int = 0
|
||||
var date: Long = 0
|
||||
var snippet: String = ""
|
||||
var read: Boolean = true
|
||||
var me: Boolean = false
|
||||
var draft: String = ""
|
||||
|
||||
// For group chats, the user is allowed to set a custom title for the conversation
|
||||
var name: String = ""
|
||||
// For group chats, the user is allowed to set a custom title for the conversation
|
||||
var name: String = ""
|
||||
) : RealmObject() {
|
||||
|
||||
fun getTitle(): String {
|
||||
return name.takeIf { it.isNotBlank() } ?: recipients.joinToString { recipient -> recipient.getDisplayName() }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ import io.realm.RealmObject
|
||||
import io.realm.annotations.PrimaryKey
|
||||
import java.util.*
|
||||
|
||||
open class Recipient : RealmObject() {
|
||||
|
||||
@PrimaryKey var id: Long = 0
|
||||
var address: String = ""
|
||||
var contact: Contact? = null
|
||||
var lastUpdate: Long = 0
|
||||
open class Recipient(
|
||||
@PrimaryKey var id: Long = 0,
|
||||
var address: String = "",
|
||||
var contact: Contact? = null,
|
||||
var lastUpdate: Long = 0
|
||||
) : RealmObject() {
|
||||
|
||||
/**
|
||||
* Return a string that can be displayed to represent the name of this contact
|
||||
|
||||
Reference in New Issue
Block a user