mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 10:35:19 +00:00
Add missing index
This commit is contained in:
parent
bccde8baba
commit
59889d0013
@ -91,7 +91,6 @@ public class PreKeyUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// region - Loki
|
// region - Loki
|
||||||
|
|
||||||
public synchronized static List<PreKeyRecord> generatePreKeys(Context context, int amount) {
|
public synchronized static List<PreKeyRecord> generatePreKeys(Context context, int amount) {
|
||||||
PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);
|
PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);
|
||||||
List<PreKeyRecord> records = new LinkedList<>();
|
List<PreKeyRecord> records = new LinkedList<>();
|
||||||
@ -122,7 +121,5 @@ public class PreKeyUtil {
|
|||||||
PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);
|
PreKeyStore preKeyStore = new TextSecurePreKeyStore(context);
|
||||||
return preKeyStore.loadPreKey(preKeyId);
|
return preKeyStore.loadPreKey(preKeyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package org.thoughtcrime.securesms.loki
|
|||||||
|
|
||||||
import android.content.ContentValues
|
import android.content.ContentValues
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.database.Cursor
|
|
||||||
import org.thoughtcrime.securesms.database.Database
|
import org.thoughtcrime.securesms.database.Database
|
||||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
||||||
import org.whispersystems.signalservice.loki.api.LokiAPIDatabaseProtocol
|
import org.whispersystems.signalservice.loki.api.LokiAPIDatabaseProtocol
|
||||||
@ -15,17 +14,17 @@ class LokiAPIDatabase(private val userPublicKey: String, context: Context, helpe
|
|||||||
private val swarmCache = "loki_api_swarm_cache"
|
private val swarmCache = "loki_api_swarm_cache"
|
||||||
private val hexEncodedPublicKey = "hex_encoded_public_key"
|
private val hexEncodedPublicKey = "hex_encoded_public_key"
|
||||||
private val swarm = "swarm"
|
private val swarm = "swarm"
|
||||||
@JvmStatic val createSwarmCacheTableCommand = "CREATE TABLE $swarmCache ($hexEncodedPublicKey TEXT, $swarm TEXT);"
|
@JvmStatic val createSwarmCacheTableCommand = "CREATE TABLE $swarmCache ($hexEncodedPublicKey TEXT PRIMARY KEY, $swarm TEXT);"
|
||||||
// Last message hash value cache
|
// Last message hash value cache
|
||||||
private val lastMessageHashValueCache = "loki_api_last_message_hash_value_cache"
|
private val lastMessageHashValueCache = "loki_api_last_message_hash_value_cache"
|
||||||
private val target = "target"
|
private val target = "target"
|
||||||
private val lastMessageHashValue = "last_message_hash_value"
|
private val lastMessageHashValue = "last_message_hash_value"
|
||||||
@JvmStatic val createLastMessageHashValueTableCommand = "CREATE TABLE $lastMessageHashValueCache ($target TEXT, $lastMessageHashValue TEXT);"
|
@JvmStatic val createLastMessageHashValueTableCommand = "CREATE TABLE $lastMessageHashValueCache ($target TEXT PRIMARY KEY, $lastMessageHashValue TEXT);"
|
||||||
// Received message hash values cache
|
// Received message hash values cache
|
||||||
private val receivedMessageHashValuesCache = "loki_api_received_message_hash_values_cache"
|
private val receivedMessageHashValuesCache = "loki_api_received_message_hash_values_cache"
|
||||||
private val userID = "user_id"
|
private val userID = "user_id"
|
||||||
private val receivedMessageHashValues = "received_message_hash_values"
|
private val receivedMessageHashValues = "received_message_hash_values"
|
||||||
@JvmStatic val createReceivedMessageHashValuesTableCommand = "CREATE TABLE $receivedMessageHashValuesCache ($userID TEXT, $receivedMessageHashValues TEXT);"
|
@JvmStatic val createReceivedMessageHashValuesTableCommand = "CREATE TABLE $receivedMessageHashValuesCache ($userID TEXT PRIMARY KEY, $receivedMessageHashValues TEXT);"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getSwarmCache(hexEncodedPublicKey: String): List<LokiAPITarget>? {
|
override fun getSwarmCache(hexEncodedPublicKey: String): List<LokiAPITarget>? {
|
||||||
@ -75,7 +74,6 @@ class LokiAPIDatabase(private val userPublicKey: String, context: Context, helpe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// region Convenience
|
// region Convenience
|
||||||
|
|
||||||
private inline fun <reified T> wrap(x: T): Array<T> {
|
private inline fun <reified T> wrap(x: T): Array<T> {
|
||||||
return Array(1) { x }
|
return Array(1) { x }
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,14 @@ import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
|||||||
import org.whispersystems.libsignal.state.PreKeyRecord
|
import org.whispersystems.libsignal.state.PreKeyRecord
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A database for associating a `PreKeyRecord` id to a contact public key.
|
* A database for associating pre key records to contact public keys.
|
||||||
*/
|
*/
|
||||||
class LokiContactPreKeyDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) {
|
class LokiContactPreKeyDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val tableName = "loki_contact_pre_key_database"
|
private val tableName = "loki_contact_pre_key_database"
|
||||||
private val pubKey = "pub_key"
|
|
||||||
private val preKeyId = "pre_key_id"
|
private val preKeyId = "pre_key_id"
|
||||||
|
private val pubKey = "pub_key"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val createTableCommand = "CREATE TABLE $tableName ($preKeyId INTEGER PRIMARY KEY, $pubKey TEXT);"
|
val createTableCommand = "CREATE TABLE $tableName ($preKeyId INTEGER PRIMARY KEY, $pubKey TEXT);"
|
||||||
|
Loading…
Reference in New Issue
Block a user