forked from upstream-mirrors/quik
load contact from realm if possible
This commit is contained in:
@@ -5,14 +5,14 @@ import io.realm.annotations.PrimaryKey
|
||||
|
||||
open class Contact() : RealmObject() {
|
||||
|
||||
@PrimaryKey var id: Long = 0
|
||||
@PrimaryKey var recipientId: Long = 0
|
||||
var address: String = ""
|
||||
|
||||
/**
|
||||
* For inflating the contact using the cursor
|
||||
*/
|
||||
constructor(id: Long, address: String) : this() {
|
||||
this.id = id
|
||||
this.recipientId = id
|
||||
this.address = address
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ open class Conversation() : RealmObject() {
|
||||
|
||||
Flowable.fromIterable(cursor.getString(ConversationColumns.RECIPIENT_IDS).split(" "))
|
||||
.map { id -> id.toLong() }
|
||||
.map { id -> contacts.getContactBlocking(id) }
|
||||
.filter { contact -> contact.id != 0L }
|
||||
.map { id -> contacts.getContact(id) }
|
||||
.filter { contact -> contact.recipientId != 0L }
|
||||
.blockingSubscribe { contact -> this.contacts.add(contact) }
|
||||
|
||||
snippet = cursor.getString(ConversationColumns.SNIPPET) ?: ""
|
||||
|
||||
Reference in New Issue
Block a user