From 5e360843b76f8b9dba7e34c2008b836725bba934 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 24 Nov 2017 22:22:49 +0100 Subject: 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 --- .../java/de/pixart/messenger/ui/ConversationFragment.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/main/java/de') 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) { -- cgit v1.2.3