forked from upstream-mirrors/quik
Sync subId when syncing message
This commit is contained in:
@@ -46,6 +46,7 @@ class CursorToMessageImpl @Inject constructor(
|
||||
Mms.READ,
|
||||
Mms.THREAD_ID,
|
||||
Mms.LOCKED,
|
||||
Mms.SUBSCRIPTION_ID,
|
||||
|
||||
Sms.ADDRESS,
|
||||
Sms.BODY,
|
||||
@@ -84,6 +85,7 @@ class CursorToMessageImpl @Inject constructor(
|
||||
dateSent = cursor.getLong(columnsMap.dateSent)
|
||||
read = cursor.getInt(columnsMap.read) != 0
|
||||
locked = cursor.getInt(columnsMap.locked) != 0
|
||||
subId = cursor.getInt(columnsMap.subId)
|
||||
|
||||
when (type) {
|
||||
"sms" -> {
|
||||
|
||||
@@ -24,6 +24,10 @@ import io.realm.RealmMigration
|
||||
|
||||
class QkRealmMigration : RealmMigration {
|
||||
|
||||
companion object {
|
||||
const val SCHEMA_VERSION: Long = 2
|
||||
}
|
||||
|
||||
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
||||
var version = oldVersion
|
||||
|
||||
@@ -34,6 +38,13 @@ class QkRealmMigration : RealmMigration {
|
||||
version++
|
||||
}
|
||||
|
||||
if (version == 1L) {
|
||||
realm.schema.get("Message")
|
||||
?.addField("subId", Int::class.java)
|
||||
|
||||
version++
|
||||
}
|
||||
|
||||
if (version < newVersion) {
|
||||
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user