This commit is contained in:
Niels Andriesse 2019-06-05 10:19:19 +10:00
parent 48f19a80b3
commit 063e0967df

View File

@ -3,22 +3,22 @@ package org.thoughtcrime.securesms.loki
import android.content.Context
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.whispersystems.libsignal.state.PreKeyBundle
import org.whispersystems.signalservice.loki.messaging.LokiPreKeyBundleStore
import org.whispersystems.signalservice.loki.messaging.LokiPreKeyBundleStoreProtocol
class LokiPreKeyBundleStore(val context: Context) : LokiPreKeyBundleStoreProtocol {
companion object {
val FILE_LOCK = Object()
private val fileLock = Object()
}
override fun getPreKeyBundle(pubKey: String): PreKeyBundle? {
synchronized (FILE_LOCK) {
synchronized (fileLock) {
return DatabaseFactory.getLokiPreKeyBundleDatabase(context).getPreKeyBundle(pubKey)
}
}
override fun removePreKeyBundle(pubKey: String) {
synchronized (FILE_LOCK) {
synchronized (fileLock) {
DatabaseFactory.getLokiPreKeyBundleDatabase(context).removePreKeyBundle(pubKey)
}
}