show inactive keys if all of them are

This commit is contained in:
Daniel Gultsch 2018-09-16 14:08:56 +02:00
parent b8474941c7
commit a6bcd9afe9

View file

@ -25,6 +25,7 @@ import android.widget.Toast;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -404,12 +405,20 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
final LayoutInflater inflater = getLayoutInflater(); final LayoutInflater inflater = getLayoutInflater();
final AxolotlService axolotlService = contact.getAccount().getAxolotlService(); final AxolotlService axolotlService = contact.getAccount().getAxolotlService();
if (Config.supportOmemo() && axolotlService != null) { if (Config.supportOmemo() && axolotlService != null) {
final Collection<XmppAxolotlSession> sessions = axolotlService.findSessionsForContact(contact);
boolean anyActive = false;
for(XmppAxolotlSession session : sessions) {
anyActive = session.getTrust().isActive();
if (anyActive) {
break;
}
}
boolean skippedInactive = false; boolean skippedInactive = false;
boolean showsInactive = false; boolean showsInactive = false;
for (final XmppAxolotlSession session : axolotlService.findSessionsForContact(contact)) { for (final XmppAxolotlSession session :sessions) {
final FingerprintStatus trust = session.getTrust(); final FingerprintStatus trust = session.getTrust();
hasKeys |= !trust.isCompromised(); hasKeys |= !trust.isCompromised();
if (!trust.isActive()) { if (!trust.isActive() && anyActive) {
if (showInactiveOmemo) { if (showInactiveOmemo) {
showsInactive = true; showsInactive = true;
} else { } else {