From a6bcd9afe9231b8a39b818193645821e573d780e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 16 Sep 2018 14:08:56 +0200 Subject: [PATCH] show inactive keys if all of them are --- .../conversations/ui/ContactDetailsActivity.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index edfed9f05..45165d391 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -25,6 +25,7 @@ import android.widget.Toast; import org.openintents.openpgp.util.OpenPgpUtils; +import java.util.Collection; import java.util.Collections; import java.util.List; @@ -404,12 +405,20 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp final LayoutInflater inflater = getLayoutInflater(); final AxolotlService axolotlService = contact.getAccount().getAxolotlService(); if (Config.supportOmemo() && axolotlService != null) { + final Collection sessions = axolotlService.findSessionsForContact(contact); + boolean anyActive = false; + for(XmppAxolotlSession session : sessions) { + anyActive = session.getTrust().isActive(); + if (anyActive) { + break; + } + } boolean skippedInactive = false; boolean showsInactive = false; - for (final XmppAxolotlSession session : axolotlService.findSessionsForContact(contact)) { + for (final XmppAxolotlSession session :sessions) { final FingerprintStatus trust = session.getTrust(); hasKeys |= !trust.isCompromised(); - if (!trust.isActive()) { + if (!trust.isActive() && anyActive) { if (showInactiveOmemo) { showsInactive = true; } else {