mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-27 11:12:16 -05:00
Merge pull request #2564 from yushijinhun/fix-decryption-blocked
Give up PGP decryption when intent is cancelled
This commit is contained in:
commit
d6e51288c3
@ -69,6 +69,27 @@ public class PgpDecryptionService {
|
||||
this.pendingNotifications.remove(message);
|
||||
}
|
||||
|
||||
public void giveUpCurrentDecryption(){
|
||||
Message message;
|
||||
synchronized (this) {
|
||||
if(currentMessage != null) {
|
||||
return;
|
||||
}
|
||||
message = messages.peekFirst();
|
||||
if (message == null) {
|
||||
return;
|
||||
}
|
||||
discard(message);
|
||||
}
|
||||
synchronized (message){
|
||||
if (message.getEncryption() == Message.ENCRYPTION_PGP) {
|
||||
message.setEncryption(Message.ENCRYPTION_DECRYPTION_FAILED);
|
||||
}
|
||||
}
|
||||
mXmppConnectionService.updateMessage(message);
|
||||
continueDecryption(true);
|
||||
}
|
||||
|
||||
protected synchronized void decryptNext() {
|
||||
if (pendingIntent == null
|
||||
&& getOpenPgpApi() != null
|
||||
|
@ -1658,6 +1658,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||
int choice = data.getIntExtra("choice", ConversationActivity.ATTACHMENT_CHOICE_INVALID);
|
||||
activity.selectPresenceToAttachFile(choice, conversation.getNextEncryption());
|
||||
}
|
||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||
if (requestCode == ConversationActivity.REQUEST_DECRYPT_PGP) {
|
||||
// discard the message to prevent decryption being blocked
|
||||
conversation.getAccount().getPgpDecryptionService().giveUpCurrentDecryption();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user