fixed pgp encrypted text quick sharing. fixes #2237
This commit is contained in:
parent
ac2eee8e81
commit
1dcf804618
|
@ -310,16 +310,62 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||||
} else {
|
} else {
|
||||||
if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty() ) {
|
if (mReturnToPrevious && this.share.text != null && !this.share.text.isEmpty() ) {
|
||||||
final OnPresenceSelected callback = new OnPresenceSelected() {
|
final OnPresenceSelected callback = new OnPresenceSelected() {
|
||||||
@Override
|
|
||||||
public void onPresenceSelected() {
|
private void finishAndSend(Message message) {
|
||||||
Message message = new Message(conversation,share.text, conversation.getNextEncryption());
|
|
||||||
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
|
||||||
message.setCounterpart(conversation.getNextCounterpart());
|
|
||||||
}
|
|
||||||
xmppConnectionService.sendMessage(message);
|
xmppConnectionService.sendMessage(message);
|
||||||
replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
|
replaceToast(getString(R.string.shared_text_with_x, conversation.getName()));
|
||||||
finish();
|
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() {
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
finishAndSend(message);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
if (conversation.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
||||||
selectPresence(conversation, callback);
|
selectPresence(conversation, callback);
|
||||||
|
|
|
@ -724,4 +724,5 @@
|
||||||
<string name="hide_inactive_devices">Hide inactive devices</string>
|
<string name="hide_inactive_devices">Hide inactive devices</string>
|
||||||
<string name="distrust_omemo_key">Distrust device</string>
|
<string name="distrust_omemo_key">Distrust device</string>
|
||||||
<string name="distrust_omemo_key_text">Are you sure you want to remove the verification for this device?\nThis device and messages coming from that device will be marked as untrusted.</string>
|
<string name="distrust_omemo_key_text">Are you sure you want to remove the verification for this device?\nThis device and messages coming from that device will be marked as untrusted.</string>
|
||||||
|
<string name="encrypting_message">Encrypting message</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue