diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-11-24 22:22:49 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-11-24 22:22:49 +0100 |
commit | 5e360843b76f8b9dba7e34c2008b836725bba934 (patch) | |
tree | af6c2c6370693e04a4089a2be34025c81cb93fd4 /src/main/java/de/pixart | |
parent | 046bd7af80d8a4bbfc601f404b4ecb5ebc17e1f4 (diff) |
show warning if chat is unecrypted
* if OMEMO is available, pressing the OK button switches to OMEMO encryption
* if OMEMO is not available, the message hides for this moment and will pop up as long as you choose an encryption mode
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 560db367a..a0376e727 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -311,6 +311,17 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa return true; } }; + + private OnClickListener mOK = new OnClickListener() { + @Override + public void onClick(View v) { + if (conversation.getAccount().getAxolotlService().isConversationAxolotlCapable(conversation)) { + conversation.setNextEncryption(Message.ENCRYPTION_AXOLOTL); + activity.refreshUi(); + } + hideSnackbar(); + } + }; private OnClickListener mAllowPresenceSubscription = new OnClickListener() { @Override public void onClick(View v) { @@ -1096,6 +1107,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener, this.mLongPressBlockListener); } else if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { showSnackbar(R.string.contact_asks_for_presence_subscription, R.string.allow, this.mAllowPresenceSubscription, this.mLongPressBlockListener); + } else if (conversation.getNextEncryption() == Message.ENCRYPTION_NONE + && (mode == Conversation.MODE_SINGLE || (mode == Conversation.MODE_MULTI && conversation.getMucOptions().membersOnly() && conversation.getMucOptions().nonanonymous()))) { + showSnackbar(R.string.conversation_unencrypted_hint, R.string.ok, mOK , null); } else if (mode == Conversation.MODE_MULTI && !conversation.getMucOptions().online() && account.getStatus() == Account.State.ONLINE) { |