hide disable encryption button when omemo is in always mode

This commit is contained in:
Daniel Gultsch 2018-03-29 14:26:04 +02:00
parent 9646783d48
commit a1b3e2d57c

View file

@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.OmemoSetting;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
import eu.siacs.conversations.databinding.ActivityTrustKeysBinding;
@ -238,7 +239,12 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
Contact contact = mAccount.getRoster().getContact(contactJids.get(0));
binding.keyErrorGeneral.setText(getString(R.string.error_trustkey_general, contact.getDisplayName()));
binding.ownKeysDetails.removeAllViews();
if (OmemoSetting.isAlways()) {
binding.disableButton.setVisibility(View.GONE);
} else {
binding.disableButton.setVisibility(View.VISIBLE);
binding.disableButton.setOnClickListener(this::disableEncryptionDialog);
}
binding.ownKeysCard.setVisibility(View.GONE);
binding.foreignKeys.removeAllViews();
binding.foreignKeys.setVisibility(View.GONE);
@ -284,6 +290,9 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
private boolean reloadFingerprints() {
List<Jid> acceptedTargets = mConversation == null ? new ArrayList<>() : mConversation.getAcceptedCryptoTargets();
ownKeysToTrust.clear();
if (this.mAccount == null) {
return false;
}
AxolotlService service = this.mAccount.getAxolotlService();
Set<IdentityKey> ownKeysSet = service.getKeysWithTrust(FingerprintStatus.createActiveUndecided());
for (final IdentityKey identityKey : ownKeysSet) {