mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Fix case where Conversation isn't returned and can't send message
This commit is contained in:
@@ -39,6 +39,8 @@ class SendMessage @Inject constructor(
|
||||
messageRepo.sendMms(params.subId, params.threadId, params.addresses, params.body, params.attachments)
|
||||
}
|
||||
}
|
||||
// If this was the first message sent in the conversation, the conversation might not exist yet
|
||||
.doOnNext { messageRepo.getOrCreateConversation(params.threadId) }
|
||||
.doOnNext { messageRepo.updateConversations(params.threadId) }
|
||||
.doOnNext { messageRepo.markUnarchived(params.threadId) }
|
||||
}
|
||||
|
||||
@@ -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