forked from upstream-mirrors/quik
Merge pull request #518 from Inhishonor/fix-draft
Fix draft being sorted at the bottom
This commit is contained in:
@@ -36,7 +36,7 @@ class QkRealmMigration @Inject constructor(
|
||||
) : RealmMigration {
|
||||
|
||||
companion object {
|
||||
const val SchemaVersion: Long = 12
|
||||
const val SchemaVersion: Long = 13
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
@@ -249,6 +249,12 @@ class QkRealmMigration @Inject constructor(
|
||||
version++
|
||||
}
|
||||
|
||||
if (version == 12L) {
|
||||
realm.schema.get("Conversation")
|
||||
?.addField("draftDate", Long::class.java, FieldAttribute.REQUIRED)
|
||||
version++
|
||||
}
|
||||
|
||||
check(version >= newVersion) { "Migration missing from v$oldVersion to v$newVersion" }
|
||||
}
|
||||
|
||||
|
||||
@@ -353,6 +353,7 @@ class ConversationRepositoryImpl @Inject constructor(
|
||||
|
||||
realm.executeTransaction {
|
||||
conversation?.takeIf { it.isValid }?.draft = draft
|
||||
conversation?.takeIf { it.isValid }?.draftDate = System.currentTimeMillis()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user