aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-18 21:18:32 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-18 21:18:32 +0100
commit92a17b1ac9d6777deb6a7c086d8bdb337c099f2d (patch)
treec6669752fc7200a121b7e7497af39ff834521b01 /src/main/java/de/pixart/messenger/ui
parentde4accb0ee412aabd12c74938e05008b7ca6956b (diff)
fixed pgp encrypted text quick sharing.
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShareWithActivity.java53
1 files changed, 48 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
index 5df34457b..870812cc4 100644
--- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
@@ -369,15 +369,58 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
} else {
if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty()) {
final OnPresenceSelected callback = new OnPresenceSelected() {
+ private void finishAndSend(Message message) {
+ xmppConnectionService.sendMessage(message);
+ replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
+ finish();
+ }
+
+ private UiCallback<Message> messageEncryptionCallback = new UiCallback<Message>() {
+ @Override
+ public void success(final Message message) {
+ message.setEncryption(Message.ENCRYPTION_DECRYPTED);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ finishAndSend(message);
+ }
+ });
+ }
+
+ @Override
+ public void error(final int errorCode, Message object) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ replaceToast(getString(errorCode));
+ finish();
+ }
+ });
+ }
+
+ @Override
+ public void userInputRequried(PendingIntent pi, Message object) {
+ finish();
+ }
+ };
@Override
public void onPresenceSelected() {
- Message message = new Message(conversation, share.text, conversation.getNextEncryption());
- if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
+ final int encryption = conversation.getNextEncryption();
+
+ Message message = new Message(conversation,share.text, encryption);
+
+ Log.d(Config.LOGTAG,"on presence selected encrpytion="+encryption);
+
+ if (encryption == Message.ENCRYPTION_PGP) {
+ replaceToast(getString(R.string.encrypting_message));
+ xmppConnectionService.getPgpEngine().encrypt(message,messageEncryptionCallback);
+ return;
+ }
+
+ if (encryption == Message.ENCRYPTION_OTR) {
message.setCounterpart(conversation.getNextCounterpart());
}
- xmppConnectionService.sendMessage(message);
- replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
- finish();
+ finishAndSend(message);
}
};
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {