mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Fix for old-skool SMS key exchange UI behavior.
Also fixes SMS "end session" messages failing to end session. // FREEBIE
This commit is contained in:
parent
4d8004ab21
commit
bec5e45605
@ -70,10 +70,10 @@ public class SmsDecryptJob extends MasterSecretJob {
|
||||
long messageId = record.getId();
|
||||
long threadId = record.getThreadId();
|
||||
|
||||
if (message.isSecureMessage()) handleSecureMessage(masterSecret, messageId, message);
|
||||
if (message.isSecureMessage()) handleSecureMessage(masterSecret, messageId, threadId, message);
|
||||
else if (message.isPreKeyBundle()) handlePreKeyWhisperMessage(masterSecret, messageId, threadId, (IncomingPreKeyBundleMessage) message);
|
||||
else if (message.isKeyExchange()) handleKeyExchangeMessage(masterSecret, messageId, threadId, (IncomingKeyExchangeMessage) message);
|
||||
else if (message.isEndSession()) handleSecureMessage(masterSecret, messageId, message);
|
||||
else if (message.isEndSession()) handleSecureMessage(masterSecret, messageId, threadId, message);
|
||||
else database.updateMessageBody(masterSecret, messageId, message.getMessageBody());
|
||||
|
||||
MessageNotifier.updateNotification(context, masterSecret);
|
||||
@ -102,7 +102,8 @@ public class SmsDecryptJob extends MasterSecretJob {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private void handleSecureMessage(MasterSecret masterSecret, long messageId, IncomingTextMessage message)
|
||||
private void handleSecureMessage(MasterSecret masterSecret, long messageId, long threadId,
|
||||
IncomingTextMessage message)
|
||||
throws NoSessionException, DuplicateMessageException,
|
||||
InvalidMessageException, LegacyMessageException
|
||||
{
|
||||
@ -111,6 +112,8 @@ public class SmsDecryptJob extends MasterSecretJob {
|
||||
IncomingTextMessage plaintext = cipher.decrypt(context, message);
|
||||
|
||||
database.updateMessageBody(masterSecret, messageId, plaintext.getMessageBody());
|
||||
|
||||
if (message.isEndSession()) SecurityEvent.broadcastSecurityUpdateEvent(context, threadId);
|
||||
}
|
||||
|
||||
private void handlePreKeyWhisperMessage(MasterSecret masterSecret, long messageId, long threadId,
|
||||
@ -147,6 +150,7 @@ public class SmsDecryptJob extends MasterSecretJob {
|
||||
|
||||
database.markAsProcessedKeyExchange(messageId);
|
||||
|
||||
SecurityEvent.broadcastSecurityUpdateEvent(context, threadId);
|
||||
|
||||
if (response != null) {
|
||||
MessageSender.send(context, masterSecret, response, threadId, true);
|
||||
|
@ -73,7 +73,7 @@ public class SmsReceiveJob extends ContextJob {
|
||||
messageAndThreadId = database.insertMessageInbox(masterSecret, message);
|
||||
}
|
||||
|
||||
if (masterSecret == null || message.isSecureMessage() || message.isKeyExchange()) {
|
||||
if (masterSecret == null || message.isSecureMessage() || message.isKeyExchange() || message.isEndSession()) {
|
||||
ApplicationContext.getInstance(context)
|
||||
.getJobManager()
|
||||
.add(new SmsDecryptJob(context, messageAndThreadId.first));
|
||||
|
Loading…
x
Reference in New Issue
Block a user