aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-11-23 19:43:47 +0100
committerChristian Schneppe <christian@pix-art.de>2017-11-23 19:43:47 +0100
commit46462e1b9f0a10023bbb9170800b59132bb1df30 (patch)
tree124e85d6642bdf2890bd046b5a634d3699976647 /src/main/java/de
parenta4018852afe4bd4ca332d450e0c7200413e3e334 (diff)
PgpService: feed result intent back into decryption
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java
index ff039e907..f96e45082 100644
--- a/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java
+++ b/src/main/java/de/pixart/messenger/crypto/PgpDecryptionService.java
@@ -25,13 +25,13 @@ import de.pixart.messenger.services.XmppConnectionService;
public class PgpDecryptionService {
- private final XmppConnectionService mXmppConnectionService;
- private OpenPgpApi openPgpApi = null;
-
protected final ArrayDeque<Message> messages = new ArrayDeque();
protected final HashSet<Message> pendingNotifications = new HashSet<>();
- Message currentMessage;
+ private final XmppConnectionService mXmppConnectionService;
+ private OpenPgpApi openPgpApi = null;
+ private Message currentMessage;
private PendingIntent pendingIntent;
+ private Intent userInteractionResult;
public PgpDecryptionService(XmppConnectionService service) {
@@ -111,6 +111,12 @@ public class PgpDecryptionService {
continueDecryption();
}
+ public synchronized void continueDecryption(Intent userInteractionResult) {
+ this.pendingIntent = null;
+ this.userInteractionResult = userInteractionResult;
+ continueDecryption();
+ }
+
public synchronized void continueDecryption() {
if (currentMessage == null) {
decryptNext();
@@ -126,7 +132,7 @@ public class PgpDecryptionService {
private void executeApi(Message message) {
synchronized (message) {
- Intent params = new Intent();
+ Intent params = userInteractionResult != null ? userInteractionResult : new Intent();
params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
if (message.getType() == Message.TYPE_TEXT) {
InputStream is = new ByteArrayInputStream(message.getBody().getBytes());
@@ -237,4 +243,4 @@ public class PgpDecryptionService {
public boolean isConnected() {
return getOpenPgpApi() != null;
}
-}
+} \ No newline at end of file