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 | |
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
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 14 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 1 |
2 files changed, 15 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) { diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 25c5df7cf..0d0695cf8 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -741,4 +741,5 @@ <string name="contacts_and_n_more_have_read_up_to_this_point">%1$s +%2$d% more have read up to this point</string> <string name="pref_return_to_previous">Quick Sharing</string> <string name="pref_return_to_previous_summary">Immediately return to previous activity instead of opening the conversation after sharing something</string> + <string name="conversation_unencrypted_hint">This chat is unencrypted, for security reasons you should activate message encryption by using the lock icon. The preferable encryption is OMEMO.</string> </resources> |