From 208ac71bfe65a6bb78b07835b7e8173d7def4387 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 15 Jul 2019 13:19:58 +1000 Subject: [PATCH] Update for core changes --- src/org/thoughtcrime/securesms/loki/LokiAPIDatabase.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/loki/LokiAPIDatabase.kt b/src/org/thoughtcrime/securesms/loki/LokiAPIDatabase.kt index bcb389eb5c..f58e0d849c 100644 --- a/src/org/thoughtcrime/securesms/loki/LokiAPIDatabase.kt +++ b/src/org/thoughtcrime/securesms/loki/LokiAPIDatabase.kt @@ -30,7 +30,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database( @JvmStatic val createReceivedMessageHashValuesTableCommand = "CREATE TABLE $receivedMessageHashValuesCache ($userID TEXT PRIMARY KEY, $receivedMessageHashValues TEXT);" } - override fun getSwarmCache(hexEncodedPublicKey: String): List? { + override fun getSwarmCache(hexEncodedPublicKey: String): Set? { val database = databaseHelper.readableDatabase return database.get(swarmCache, "${Companion.hexEncodedPublicKey} = ?", wrap(hexEncodedPublicKey)) { cursor -> val swarmAsString = cursor.getString(cursor.getColumnIndexOrThrow(swarm)) @@ -38,10 +38,10 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database( val components = targetAsString.split("?port=") LokiAPITarget(components[0], components[1].toInt()) } - } + }?.toSet() } - override fun setSwarmCache(hexEncodedPublicKey: String, newValue: List) { + override fun setSwarmCache(hexEncodedPublicKey: String, newValue: Set) { val database = databaseHelper.writableDatabase val swarmAsString = newValue.joinToString(", ") { target -> "${target.address}?port=${target.port}"