mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-16 19:18:52 +01:00
Remove link between messages and conversations
This commit is contained in:
@@ -28,9 +28,13 @@ import java.util.*
|
||||
open class Conversation : RealmObject() {
|
||||
|
||||
@PrimaryKey var id: Long = 0
|
||||
var recipients: RealmList<Recipient> = RealmList()
|
||||
@Index var archived: Boolean = false
|
||||
@Index var blocked: Boolean = false
|
||||
var recipients: RealmList<Recipient> = RealmList()
|
||||
var date: Long = 0
|
||||
var snippet: String = ""
|
||||
var read: Boolean = true
|
||||
var me: Boolean = false
|
||||
var draft: String = ""
|
||||
|
||||
fun getTitle() = recipients.joinToString { recipient ->
|
||||
|
||||
@@ -32,19 +32,7 @@ open class Message : RealmObject() {
|
||||
|
||||
@PrimaryKey var id: Long = 0
|
||||
|
||||
var conversation: Conversation? = null
|
||||
set(value) {
|
||||
field = value
|
||||
threadId = value?.id ?: 0
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a hack so that we can index by the threadId, and return distinct threadIds when
|
||||
* querying for all conversations for the MainActivity
|
||||
*/
|
||||
@Index
|
||||
@Deprecated("This is only here for Realm to access - it should be ignored in our codebase")
|
||||
var threadId: Long = 0
|
||||
@Index var threadId: Long = 0
|
||||
|
||||
// The MMS-SMS content provider returns messages where duplicate ids can exist. This is because
|
||||
// SMS and MMS are stored in separate tables. We can't use these ids as our realm message id
|
||||
@@ -136,8 +124,7 @@ open class Message : RealmObject() {
|
||||
.mapNotNull { it.text }
|
||||
.joinToString("\n") { text -> text }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: getCleansedSubject()
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: getCleansedSubject().takeIf { it.isNotEmpty() }
|
||||
?: "An MMS message"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user