diff --git a/res/values/colors.xml b/res/values/colors.xml
index 17f461878a..beb118a018 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -7,7 +7,7 @@
@color/loki_green
@color/loki_green
- #555bca5b
+ #5578be20
#882090ea
@color/signal_primary
diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java
index 70d5886185..23696c83f4 100644
--- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java
+++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java
@@ -243,10 +243,10 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
try {
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
SignalProtocolStore axolotlStore = new SignalProtocolStoreImpl(context);
- LokiThreadDatabaseProtocol lokiThreadDatabase = DatabaseFactory.getLokiThreadDatabase(context);
- LokiPreKeyRecordDatabase preKeyRecordDatabase = DatabaseFactory.getLokiPreKeyRecordDatabase(context);
+ LokiThreadDatabase lokiThreadDatabase = DatabaseFactory.getLokiThreadDatabase(context);
+ LokiPreKeyRecordDatabase lokiPreKeyRecordDatabase = DatabaseFactory.getLokiPreKeyRecordDatabase(context);
SignalServiceAddress localAddress = new SignalServiceAddress(TextSecurePreferences.getLocalNumber(context));
- LokiServiceCipher cipher = new LokiServiceCipher(localAddress, axolotlStore, lokiThreadDatabase, preKeyRecordDatabase, UnidentifiedAccessUtil.getCertificateValidator());
+ LokiServiceCipher cipher = new LokiServiceCipher(localAddress, axolotlStore, lokiThreadDatabase, lokiPreKeyRecordDatabase, UnidentifiedAccessUtil.getCertificateValidator());
/* Loki - Original code
SignalServiceCipher cipher = new SignalServiceCipher(localAddress, axolotlStore, UnidentifiedAccessUtil.getCertificateValidator());
*/
@@ -480,7 +480,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
lokiThreadDatabase.setSessionResetState(threadId, LokiThreadSessionResetState.REQUEST_RECEIVED);
// TODO: Send a background message here
- Log.d("LOKI", "Session reset received from " + content.getSender());
+ Log.d("Loki", "Received a session reset request from: " + content.getSender() + ".");
SecurityEvent.broadcastSecurityUpdateEvent(context);
MessageNotifier.updateNotification(context, threadId);
@@ -498,8 +498,10 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
if (!recipient.isGroupRecipient()) {
// TODO: Handle session reset on sync messages
-// SessionStore sessionStore = new TextSecureSessionStore(context);
-// sessionStore.deleteAllSessions(recipient.getAddress().toPhoneString());
+ /*
+ SessionStore sessionStore = new TextSecureSessionStore(context);
+ sessionStore.deleteAllSessions(recipient.getAddress().toPhoneString());
+ */
SecurityEvent.broadcastSecurityUpdateEvent(context);
diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java
index 812d7ba676..c1481e65b2 100644
--- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java
+++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java
@@ -164,8 +164,13 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
log(TAG, "Have access key to use: " + unidentifiedAccess.isPresent());
- // Loki - Include a pre key bundle if the message is a friend request
- PreKeyBundle preKeyBundle = (message.isFriendRequest() || message.isEndSession()) ? DatabaseFactory.getLokiPreKeyBundleDatabase(context).generatePreKeyBundle(address.getNumber()) : null;
+ // Loki - Include a pre key bundle if the message is a friend request or an end session message
+ PreKeyBundle preKeyBundle;
+ if (message.isFriendRequest() || message.isEndSession()) {
+ preKeyBundle = DatabaseFactory.getLokiPreKeyBundleDatabase(context).generatePreKeyBundle(address.getNumber());
+ } else {
+ preKeyBundle = null;
+ }
SignalServiceDataMessage textSecureMessage = SignalServiceDataMessage.newBuilder()
.withTimestamp(message.getDateSent())
diff --git a/src/org/thoughtcrime/securesms/loki/LokiThreadDatabase.kt b/src/org/thoughtcrime/securesms/loki/LokiThreadDatabase.kt
index 670e574434..3f8b16a702 100644
--- a/src/org/thoughtcrime/securesms/loki/LokiThreadDatabase.kt
+++ b/src/org/thoughtcrime/securesms/loki/LokiThreadDatabase.kt
@@ -15,13 +15,13 @@ class LokiThreadDatabase(context: Context, helper: SQLCipherOpenHelper) : Databa
var delegate: LokiThreadDatabaseDelegate? = null
companion object {
- private val sessionResetTableName = "loki_thread_session_reset_database"
private val friendRequestTableName = "loki_thread_friend_request_database"
+ private val sessionResetTableName = "loki_thread_session_reset_database"
private val threadID = "thread_id"
private val friendRequestStatus = "friend_request_status"
- private val sessionResetState = "session_reset_state"
+ private val sessionResetStatus = "session_reset_status"
@JvmStatic val createFriendRequestTableCommand = "CREATE TABLE $friendRequestTableName ($threadID INTEGER PRIMARY KEY, $friendRequestStatus INTEGER DEFAULT 0);"
- @JvmStatic val createSessionResetTableCommand = "CREATE TABLE $sessionResetTableName ($threadID INTEGER PRIMARY KEY, $sessionResetState INTEGER DEFAULT 0);"
+ @JvmStatic val createSessionResetTableCommand = "CREATE TABLE $sessionResetTableName ($threadID INTEGER PRIMARY KEY, $sessionResetStatus INTEGER DEFAULT 0);"
}
override fun getThreadID(hexEncodePubKey: String): Long {
@@ -66,7 +66,7 @@ class LokiThreadDatabase(context: Context, helper: SQLCipherOpenHelper) : Databa
override fun getSessionResetState(threadID: Long): LokiThreadSessionResetState {
val database = databaseHelper.readableDatabase
val result = database.get(sessionResetTableName, "${Companion.threadID} = ?", arrayOf( threadID.toString() )) { cursor ->
- cursor.getInt(sessionResetState)
+ cursor.getInt(sessionResetStatus)
}
return if (result != null) {
LokiThreadSessionResetState.values().first { it.rawValue == result }
@@ -75,11 +75,11 @@ class LokiThreadDatabase(context: Context, helper: SQLCipherOpenHelper) : Databa
}
}
- override fun setSessionResetState(threadID: Long, sessionResetState: LokiThreadSessionResetState) {
+ override fun setSessionResetState(threadID: Long, sessionResetStatus: LokiThreadSessionResetState) {
val database = databaseHelper.writableDatabase
val contentValues = ContentValues(2)
contentValues.put(Companion.threadID, threadID)
- contentValues.put(Companion.sessionResetState, sessionResetState.rawValue)
+ contentValues.put(Companion.sessionResetStatus, sessionResetStatus.rawValue)
database.insertOrUpdate(sessionResetTableName, contentValues, "${Companion.threadID} = ?", arrayOf( threadID.toString() ))
notifyConversationListListeners()
notifyConversationListeners(threadID)