forked from upstream-mirrors/quik
Sync subId when syncing message
This commit is contained in:
@@ -23,7 +23,7 @@ android {
|
||||
compileSdkVersion 25
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 25
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ android {
|
||||
compileSdkVersion 27
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ android {
|
||||
compileSdkVersion 27
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ interface CursorToMessage : Mapper<Pair<Cursor, CursorToMessage.MessageColumns>,
|
||||
val read by lazy { getColumnIndex(Mms.READ) }
|
||||
val threadId by lazy { getColumnIndex(Mms.THREAD_ID) }
|
||||
val locked by lazy { getColumnIndex(Mms.LOCKED) }
|
||||
val subId by lazy { getColumnIndex(Mms.SUBSCRIPTION_ID) }
|
||||
|
||||
val smsAddress by lazy { getColumnIndex(Sms.ADDRESS) }
|
||||
val smsBody by lazy { getColumnIndex(Sms.BODY) }
|
||||
|
||||
@@ -47,6 +47,7 @@ open class Message : RealmObject() {
|
||||
var seen: Boolean = false
|
||||
var read: Boolean = false
|
||||
var locked: Boolean = false
|
||||
var subId: Int = -1
|
||||
|
||||
// SMS only
|
||||
var body: String = ""
|
||||
|
||||
@@ -11,7 +11,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.moez.QKSMS"
|
||||
minSdkVersion 21
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 27
|
||||
versionCode 170
|
||||
versionName "3.2.2"
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.bugsnag.android.Bugsnag
|
||||
import com.bugsnag.android.Configuration
|
||||
import com.moez.QKSMS.BuildConfig
|
||||
import com.moez.QKSMS.R
|
||||
import util.NightModeManager
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.DispatchingAndroidInjector
|
||||
import dagger.android.HasActivityInjector
|
||||
@@ -42,6 +41,7 @@ import io.realm.RealmConfiguration
|
||||
import manager.AnalyticsManager
|
||||
import migration.QkRealmMigration
|
||||
import timber.log.Timber
|
||||
import util.NightModeManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverInjector, HasServiceInjector {
|
||||
@@ -74,7 +74,7 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
||||
Realm.setDefaultConfiguration(RealmConfiguration.Builder()
|
||||
.compactOnLaunch()
|
||||
.migration(QkRealmMigration())
|
||||
.schemaVersion(1)
|
||||
.schemaVersion(QkRealmMigration.SCHEMA_VERSION)
|
||||
.build())
|
||||
|
||||
AppComponentManager.init(this)
|
||||
|
||||
Reference in New Issue
Block a user