Show trust status of messages' originating session

Shade lock icon red if message was received in a session that has not
been marked trusted by the user or fingerprint is unknown
This commit is contained in:
Andreas Straub 2015-07-10 03:00:40 +02:00
parent 3d33946088
commit 9e8d9a6401
2 changed files with 17 additions and 0 deletions

View file

@ -675,4 +675,8 @@ public class Message extends AbstractEntity {
public void setAxolotlFingerprint(String fingerprint) { public void setAxolotlFingerprint(String fingerprint) {
this.axolotlFingerprint = fingerprint; this.axolotlFingerprint = fingerprint;
} }
public String getAxolotlFingerprint() {
return axolotlFingerprint;
}
} }

View file

@ -3,6 +3,7 @@ package eu.siacs.conversations.ui.adapter;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.graphics.Color;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.text.Spannable; import android.text.Spannable;
@ -26,6 +27,7 @@ import android.widget.Toast;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
@ -154,6 +156,17 @@ public class MessageAdapter extends ArrayAdapter<Message> {
viewHolder.indicator.setVisibility(View.GONE); viewHolder.indicator.setVisibility(View.GONE);
} else { } else {
viewHolder.indicator.setVisibility(View.VISIBLE); viewHolder.indicator.setVisibility(View.VISIBLE);
if (message.getMergedStatus() == Message.STATUS_RECEIVED
&& message.getEncryption() == Message.ENCRYPTION_AXOLOTL) {
AxolotlService.SQLiteAxolotlStore.Trust trust = message.getConversation()
.getAccount().getAxolotlService().getFingerprintTrust(
message.getContact().getJid().toBareJid().toString(),
message.getAxolotlFingerprint());
if (trust == null || trust != AxolotlService.SQLiteAxolotlStore.Trust.TRUSTED) {
viewHolder.indicator.setColorFilter(Color.RED);
}
}
} }
String formatedTime = UIHelper.readableTimeDifferenceFull(getContext(), String formatedTime = UIHelper.readableTimeDifferenceFull(getContext(),