From a1b3e2d57c92e1ae55b93cb7d94294ab68b5732e Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 29 Mar 2018 14:26:04 +0200 Subject: [PATCH] hide disable encryption button when omemo is in always mode --- .../eu/siacs/conversations/ui/TrustKeysActivity.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index 65b365893..d33b867f9 100644 --- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -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(); - binding.disableButton.setOnClickListener(this::disableEncryptionDialog); + 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 acceptedTargets = mConversation == null ? new ArrayList<>() : mConversation.getAcceptedCryptoTargets(); ownKeysToTrust.clear(); + if (this.mAccount == null) { + return false; + } AxolotlService service = this.mAccount.getAxolotlService(); Set ownKeysSet = service.getKeysWithTrust(FingerprintStatus.createActiveUndecided()); for (final IdentityKey identityKey : ownKeysSet) {