mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Fix received message hash values storage
This commit is contained in:
parent
a4c6b39ffa
commit
af1f45a6e4
@ -215,9 +215,9 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
|
|
||||||
override fun getReceivedMessageHashValues(publicKey: String): Set<String>? {
|
override fun getReceivedMessageHashValues(publicKey: String): Set<String>? {
|
||||||
val database = databaseHelper.readableDatabase
|
val database = databaseHelper.readableDatabase
|
||||||
val query = "$Companion.publicKey = ?"
|
val query = "${Companion.publicKey} = ?"
|
||||||
return database.get(receivedMessageHashValuesTable2, query, arrayOf( publicKey )) { cursor ->
|
return database.get(receivedMessageHashValuesTable2, query, arrayOf( publicKey )) { cursor ->
|
||||||
val receivedMessageHashValuesAsString = cursor.getString(cursor.getColumnIndexOrThrow(receivedMessageHashValues))
|
val receivedMessageHashValuesAsString = cursor.getString(cursor.getColumnIndexOrThrow(Companion.receivedMessageHashValues))
|
||||||
receivedMessageHashValuesAsString.split("-").toSet()
|
receivedMessageHashValuesAsString.split("-").toSet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,8 +225,8 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
override fun setReceivedMessageHashValues(publicKey: String, newValue: Set<String>) {
|
override fun setReceivedMessageHashValues(publicKey: String, newValue: Set<String>) {
|
||||||
val database = databaseHelper.writableDatabase
|
val database = databaseHelper.writableDatabase
|
||||||
val receivedMessageHashValuesAsString = newValue.joinToString("-")
|
val receivedMessageHashValuesAsString = newValue.joinToString("-")
|
||||||
val row = wrap(mapOf( Companion.publicKey to publicKey, receivedMessageHashValues to receivedMessageHashValuesAsString ))
|
val row = wrap(mapOf( Companion.publicKey to publicKey, Companion.receivedMessageHashValues to receivedMessageHashValuesAsString ))
|
||||||
val query = "$Companion.publicKey = ?"
|
val query = "${Companion.publicKey} = ?"
|
||||||
database.insertOrUpdate(receivedMessageHashValuesTable2, row, query, arrayOf( publicKey ))
|
database.insertOrUpdate(receivedMessageHashValuesTable2, row, query, arrayOf( publicKey ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user