store recipient model instead of recipients string in conversation

This commit is contained in:
Moez Bhatti
2017-08-22 19:51:01 -07:00
parent a32dd041ee
commit edba4eadbe
5 changed files with 48 additions and 6 deletions
@@ -0,0 +1,11 @@
package com.moez.QKSMS.data.sync
import android.net.Uri
class RecipientColumns {
companion object {
val URI = Uri.parse("content://mms-sms/canonical-address/")
}
}
@@ -32,7 +32,7 @@ internal object SyncManager {
.flatMap { cursor -> cursor.asFlowable() }
.map { cursor -> Conversation(cursor) }
.distinct { conversation -> conversation.id }
.doOnNext { conversation -> realm?.insert(conversation) }
.doOnNext { conversation -> realm?.insertOrUpdate(conversation) }
.map { conversation -> conversation.id }
.concatMap { threadId ->
val uri = Uri.withAppendedPath(MessageColumns.URI, threadId.toString())
@@ -42,7 +42,7 @@ internal object SyncManager {
}
.filter { message -> message.type == "sms" || message.type == "mms" }
.distinct { message -> message.id }
.doOnNext { message -> realm?.insert(message) }
.doOnNext { message -> realm?.insertOrUpdate(message) }
.count()
.toFlowable()
.doOnNext {