mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 13:48:52 +01:00
Sync subId when syncing message
This commit is contained in:
@@ -23,7 +23,7 @@ android {
|
|||||||
compileSdkVersion 25
|
compileSdkVersion 25
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 22
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ android {
|
|||||||
compileSdkVersion 27
|
compileSdkVersion 27
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class CursorToMessageImpl @Inject constructor(
|
|||||||
Mms.READ,
|
Mms.READ,
|
||||||
Mms.THREAD_ID,
|
Mms.THREAD_ID,
|
||||||
Mms.LOCKED,
|
Mms.LOCKED,
|
||||||
|
Mms.SUBSCRIPTION_ID,
|
||||||
|
|
||||||
Sms.ADDRESS,
|
Sms.ADDRESS,
|
||||||
Sms.BODY,
|
Sms.BODY,
|
||||||
@@ -84,6 +85,7 @@ class CursorToMessageImpl @Inject constructor(
|
|||||||
dateSent = cursor.getLong(columnsMap.dateSent)
|
dateSent = cursor.getLong(columnsMap.dateSent)
|
||||||
read = cursor.getInt(columnsMap.read) != 0
|
read = cursor.getInt(columnsMap.read) != 0
|
||||||
locked = cursor.getInt(columnsMap.locked) != 0
|
locked = cursor.getInt(columnsMap.locked) != 0
|
||||||
|
subId = cursor.getInt(columnsMap.subId)
|
||||||
|
|
||||||
when (type) {
|
when (type) {
|
||||||
"sms" -> {
|
"sms" -> {
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ import io.realm.RealmMigration
|
|||||||
|
|
||||||
class QkRealmMigration : RealmMigration {
|
class QkRealmMigration : RealmMigration {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val SCHEMA_VERSION: Long = 2
|
||||||
|
}
|
||||||
|
|
||||||
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
override fun migrate(realm: DynamicRealm, oldVersion: Long, newVersion: Long) {
|
||||||
var version = oldVersion
|
var version = oldVersion
|
||||||
|
|
||||||
@@ -34,6 +38,13 @@ class QkRealmMigration : RealmMigration {
|
|||||||
version++
|
version++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version == 1L) {
|
||||||
|
realm.schema.get("Message")
|
||||||
|
?.addField("subId", Int::class.java)
|
||||||
|
|
||||||
|
version++
|
||||||
|
}
|
||||||
|
|
||||||
if (version < newVersion) {
|
if (version < newVersion) {
|
||||||
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
|
throw IllegalStateException("Migration missing from v$oldVersion to v$newVersion")
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ android {
|
|||||||
compileSdkVersion 27
|
compileSdkVersion 27
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ interface CursorToMessage : Mapper<Pair<Cursor, CursorToMessage.MessageColumns>,
|
|||||||
val read by lazy { getColumnIndex(Mms.READ) }
|
val read by lazy { getColumnIndex(Mms.READ) }
|
||||||
val threadId by lazy { getColumnIndex(Mms.THREAD_ID) }
|
val threadId by lazy { getColumnIndex(Mms.THREAD_ID) }
|
||||||
val locked by lazy { getColumnIndex(Mms.LOCKED) }
|
val locked by lazy { getColumnIndex(Mms.LOCKED) }
|
||||||
|
val subId by lazy { getColumnIndex(Mms.SUBSCRIPTION_ID) }
|
||||||
|
|
||||||
val smsAddress by lazy { getColumnIndex(Sms.ADDRESS) }
|
val smsAddress by lazy { getColumnIndex(Sms.ADDRESS) }
|
||||||
val smsBody by lazy { getColumnIndex(Sms.BODY) }
|
val smsBody by lazy { getColumnIndex(Sms.BODY) }
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ open class Message : RealmObject() {
|
|||||||
var seen: Boolean = false
|
var seen: Boolean = false
|
||||||
var read: Boolean = false
|
var read: Boolean = false
|
||||||
var locked: Boolean = false
|
var locked: Boolean = false
|
||||||
|
var subId: Int = -1
|
||||||
|
|
||||||
// SMS only
|
// SMS only
|
||||||
var body: String = ""
|
var body: String = ""
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.moez.QKSMS"
|
applicationId "com.moez.QKSMS"
|
||||||
minSdkVersion 21
|
minSdkVersion 22
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 170
|
versionCode 170
|
||||||
versionName "3.2.2"
|
versionName "3.2.2"
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.bugsnag.android.Bugsnag
|
|||||||
import com.bugsnag.android.Configuration
|
import com.bugsnag.android.Configuration
|
||||||
import com.moez.QKSMS.BuildConfig
|
import com.moez.QKSMS.BuildConfig
|
||||||
import com.moez.QKSMS.R
|
import com.moez.QKSMS.R
|
||||||
import util.NightModeManager
|
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.DispatchingAndroidInjector
|
import dagger.android.DispatchingAndroidInjector
|
||||||
import dagger.android.HasActivityInjector
|
import dagger.android.HasActivityInjector
|
||||||
@@ -42,6 +41,7 @@ import io.realm.RealmConfiguration
|
|||||||
import manager.AnalyticsManager
|
import manager.AnalyticsManager
|
||||||
import migration.QkRealmMigration
|
import migration.QkRealmMigration
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import util.NightModeManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverInjector, HasServiceInjector {
|
class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverInjector, HasServiceInjector {
|
||||||
@@ -74,7 +74,7 @@ class QKApplication : Application(), HasActivityInjector, HasBroadcastReceiverIn
|
|||||||
Realm.setDefaultConfiguration(RealmConfiguration.Builder()
|
Realm.setDefaultConfiguration(RealmConfiguration.Builder()
|
||||||
.compactOnLaunch()
|
.compactOnLaunch()
|
||||||
.migration(QkRealmMigration())
|
.migration(QkRealmMigration())
|
||||||
.schemaVersion(1)
|
.schemaVersion(QkRealmMigration.SCHEMA_VERSION)
|
||||||
.build())
|
.build())
|
||||||
|
|
||||||
AppComponentManager.init(this)
|
AppComponentManager.init(this)
|
||||||
|
|||||||
Reference in New Issue
Block a user