aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-06-19 11:08:17 +0200
committerChristian Schneppe <christian@pix-art.de>2016-06-20 21:03:29 +0200
commit4cc006bf3a6d1d33f940a0a7b6038701cc4aaad7 (patch)
treec7c8d55d1c0a97df053fdffa644f7529a46871ab /src/main
parent85cd21c33ef62ecffaa43dc9e19803e7679888fd (diff)
display toast on pgp error
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/PgpEngine.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java14
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java8
3 files changed, 16 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
index fe3ac04b8..bddc86cab 100644
--- a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
+++ b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java
@@ -256,7 +256,7 @@ public class PgpEngine {
account);
return;
case OpenPgpApi.RESULT_CODE_ERROR:
- callback.error(R.string.openpgp_error, account);
+ callback.error(R.string.unable_to_connect_to_keychain, account);
}
}
});
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 6f173ba25..1d80c066f 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -452,7 +452,12 @@ public class XmppConnectionService extends Service {
getFileBackend().copyFileToPrivateStorage(message, uri);
getFileBackend().updateFileParams(message);
if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
- getPgpEngine().encrypt(message, callback);
+ final PgpEngine pgpEngine = getPgpEngine();
+ if (pgpEngine != null) {
+ pgpEngine.encrypt(message, callback);
+ } else if (callback != null){
+ callback.error(R.string.unable_to_connect_to_keychain, null);
+ }
} else {
callback.success(message);
}
@@ -492,7 +497,12 @@ public class XmppConnectionService extends Service {
try {
getFileBackend().copyImageToPrivateStorage(message, uri);
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP) {
- getPgpEngine().encrypt(message, callback);
+ final PgpEngine pgpEngine = getPgpEngine();
+ if (pgpEngine != null) {
+ pgpEngine.encrypt(message, callback);
+ } else if (callback != null){
+ callback.error(R.string.unable_to_connect_to_keychain, null);
+ }
} else {
callback.success(message);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index c09b96899..b34c22b71 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -713,7 +713,7 @@ public class ConversationActivity extends XmppActivity
@Override
public void error(int error, Contact contact) {
- displayErrorDialog(error);
+ replaceToast(getString(error));
}
});
} else if (mode == Conversation.MODE_MULTI && conversation.getMucOptions().pgpKeysInUse()) {
@@ -1673,8 +1673,7 @@ public class ConversationActivity extends XmppActivity
@Override
public void error(int errorCode, Message message) {
- hidePrepareFileToast(prepareFileToast);
- displayErrorDialog(errorCode);
+ replaceToast(getString(errorCode));
}
@Override
@@ -1706,8 +1705,7 @@ public class ConversationActivity extends XmppActivity
@Override
public void error(int error, Message message) {
- hidePrepareFileToast(prepareFileToast);
- displayErrorDialog(error);
+ replaceToast(getString(error));
}
});
}