From cbd45d3ee55eb75bd6d4bd40d1573f42518cfa3a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 24 Nov 2016 11:29:26 +0100 Subject: [PATCH] changed design language to match BTBV proposal * untrusted messages have red background * unverified message have normal background and red lock --- .../siacs/conversations/entities/Message.java | 4 ++-- .../ui/adapter/MessageAdapter.java | 17 +++++++++++------ src/main/res/values/strings.xml | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index e9f16949a..20e4c5a50 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -493,7 +493,7 @@ public class Message extends AbstractEntity { !this.getBody().startsWith(ME_COMMAND) && !this.bodyIsHeart() && !message.bodyIsHeart() && - this.isTrusted() == message.isTrusted() + ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) ); } @@ -813,7 +813,7 @@ public class Message extends AbstractEntity { public boolean isTrusted() { FingerprintStatus s = conversation.getAccount().getAxolotlService().getFingerprintTrust(axolotlFingerprint); - return s != null && s.isTrustedAndActive(); + return s != null && s.isTrusted(); } private int getPreviousEncryption() { diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index be8851426..45d328e23 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -128,7 +128,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } } - private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground) { + private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground, boolean inValidSession) { String filesize = null; String info = null; boolean error = false; @@ -208,8 +208,8 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie .getAccount().getAxolotlService().getFingerprintTrust( message.getFingerprint()); - if(status == null || (!status.isTrustedAndActive())) { - viewHolder.indicator.setColorFilter(activity.getWarningTextColor()); + if(status == null || (!status.isVerified() && inValidSession)) { + viewHolder.indicator.setColorFilter(0xffc64545); viewHolder.indicator.setAlpha(1.0f); } else { viewHolder.indicator.clearColorFilter(); @@ -465,7 +465,8 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie @Override public View getView(int position, View view, ViewGroup parent) { final Message message = getItem(position); - final boolean isInValidSession = message.isValidInSession(); + final boolean omemoEncryption = message.getEncryption() == Message.ENCRYPTION_AXOLOTL; + final boolean isInValidSession = message.isValidInSession() && (!omemoEncryption || message.isTrusted()); final Conversation conversation = message.getConversation(); final Account account = conversation.getAccount(); final int type = getItemViewType(position); @@ -671,11 +672,15 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } else { viewHolder.message_box.setBackgroundResource(R.drawable.message_bubble_received_warning); viewHolder.encryption.setVisibility(View.VISIBLE); - viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption())); + if (omemoEncryption && !message.isTrusted()) { + viewHolder.encryption.setText(R.string.not_trusted); + } else { + viewHolder.encryption.setText(CryptoHelper.encryptionTypeToText(message.getEncryption())); + } } } - displayStatus(viewHolder, message, type, darkBackground); + displayStatus(viewHolder, message, type, darkBackground, isInValidSession); return view; } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a62a42101..70ffb6a5e 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -713,4 +713,5 @@ Blind Trust Before Verification Automatically trust all new devices from contacts that haven’t been verified before. Blindly trusted OMEMO keys + Untrusted