mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Parse and render emoji reactions
Fixes part of #152 To keep this PR simple, I've left out: - when long-pressing on the emoji in a group MMS, a popup should come up listing which contact sent each emoji - notifications (untested) - sending emoji reactions
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")
|
||||
@@ -253,6 +253,28 @@ class QkRealmMigration @Inject constructor(
|
||||
version++
|
||||
}
|
||||
|
||||
if (version == 12L) {
|
||||
realm.schema.create("EmojiReaction")
|
||||
.addField("id", Long::class.java, FieldAttribute.PRIMARY_KEY, FieldAttribute.REQUIRED)
|
||||
.addField("targetMessageId", Long::class.java, FieldAttribute.INDEXED, FieldAttribute.REQUIRED)
|
||||
.addField("reactionMessageId", Long::class.java, FieldAttribute.INDEXED, FieldAttribute.REQUIRED)
|
||||
.addField("senderAddress", String::class.java, FieldAttribute.REQUIRED)
|
||||
.addField("emoji", String::class.java, FieldAttribute.REQUIRED)
|
||||
.addField("originalMessageText", String::class.java, FieldAttribute.REQUIRED)
|
||||
.addField("threadId", Long::class.java, FieldAttribute.INDEXED, FieldAttribute.REQUIRED)
|
||||
.addField("patternType", String::class.java, FieldAttribute.REQUIRED)
|
||||
|
||||
realm.schema.get("Message")
|
||||
?.addField("isEmojiReaction", Boolean::class.java, FieldAttribute.REQUIRED)
|
||||
?.transform { msg ->
|
||||
msg.setBoolean("isEmojiReaction", false)
|
||||
}
|
||||
|
||||
// TODO: scan for past emoji reaction messages
|
||||
|
||||
version++
|
||||
}
|
||||
|
||||
check(version >= newVersion) { "Migration missing from v$oldVersion to v$newVersion" }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user