From 5fae9465d182c37cf53dd12c79637963f32fd13a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 7 Mar 2017 11:07:57 +0100 Subject: [PATCH] show snackbar in conversations with stranger to block. fixes #2358 --- .../eu/siacs/conversations/ui/ConversationFragment.java | 9 +++++++++ src/main/res/values/strings.xml | 1 + 2 files changed, 10 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index f11bbc006..19da7c2d7 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -954,6 +954,13 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } }; + private OnClickListener mBlockClickListener = new OnClickListener() { + @Override + public void onClick(final View v) { + BlockContactDialog.show(activity, conversation); + } + }; + private OnClickListener mAddBackClickListener = new OnClickListener() { @Override @@ -1047,6 +1054,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (!conversation.isOtrFingerprintVerified())) { showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify); + } else if (conversation.isWithStranger() && !conversation.isBlocked()) { + showSnackbar(R.string.received_message_from_stranger,R.string.block, mBlockClickListener); } else { hideSnackbar(); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 826d02e03..cbf9a3658 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -738,4 +738,5 @@ Contact blocked. Notifications from strangers Notify for messages received from strangers. + Received message from stranger