From c1c490de23e0ba6500379102475bcebe53614186 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 13 Apr 2018 22:57:59 +0200 Subject: hide disable encryption button when omemo is in always mode --- src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/de/pixart/messenger') diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java index c1938aef9..6f5135d9e 100644 --- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java +++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java @@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import de.pixart.messenger.Config; import de.pixart.messenger.R; +import de.pixart.messenger.crypto.OmemoSetting; import de.pixart.messenger.crypto.axolotl.AxolotlService; import de.pixart.messenger.crypto.axolotl.FingerprintStatus; import de.pixart.messenger.databinding.ActivityTrustKeysBinding; @@ -237,7 +238,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); @@ -283,6 +289,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) { -- cgit v1.2.3