show snackbar in conversations with stranger to block. fixes #2358

This commit is contained in:
Daniel Gultsch 2017-03-07 11:07:57 +01:00
parent 7306e0286f
commit 5fae9465d1
2 changed files with 10 additions and 0 deletions

View File

@ -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() { private OnClickListener mAddBackClickListener = new OnClickListener() {
@Override @Override
@ -1047,6 +1054,8 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
&& (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED)
&& (!conversation.isOtrFingerprintVerified())) { && (!conversation.isOtrFingerprintVerified())) {
showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify); 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 { } else {
hideSnackbar(); hideSnackbar();
} }

View File

@ -738,4 +738,5 @@
<string name="contact_blocked_past_tense">Contact blocked.</string> <string name="contact_blocked_past_tense">Contact blocked.</string>
<string name="pref_notifications_from_strangers">Notifications from strangers</string> <string name="pref_notifications_from_strangers">Notifications from strangers</string>
<string name="pref_notifications_from_strangers_summary">Notify for messages received from strangers.</string> <string name="pref_notifications_from_strangers_summary">Notify for messages received from strangers.</string>
<string name="received_message_from_stranger">Received message from stranger</string>
</resources> </resources>