Load parts during message sync

This commit is contained in:
Moez Bhatti
2018-01-14 20:03:39 -05:00
parent 4cc98e1cc1
commit 3ca5bfe6d7
6 changed files with 15 additions and 68 deletions
@@ -142,20 +142,6 @@ class MessageRepository @Inject constructor(
.findAllSorted("date")
}
fun loadParts(id: Long) {
Realm.getDefaultInstance()?.use { realm ->
realm.where(Message::class.java).equalTo("id", id).findFirst()?.let { message ->
realm.executeTransaction {
val parts = realm.copyToRealmOrUpdate(context.contentResolver.query(CursorToPart.CONTENT_URI, null,
"${Telephony.Mms.Part.MSG_ID} = ?", arrayOf(message.contentId.toString()), null)
.map { cursorToPart.map(it) })
message.parts = RealmList<MmsPart>().apply { addAll(parts) }
}
}
}
}
/**
* Retrieves the list of messages which should be shown in the notification
* for a given conversation