diff options
author | Andreas Straub <andy@strb.org> | 2015-09-06 15:08:42 +0200 |
---|---|---|
committer | Andreas Straub <andy@strb.org> | 2015-09-06 15:15:57 +0200 |
commit | a95c451f1e6ee69fbf3b0072d672c3609a4b1e7d (patch) | |
tree | 860e3300c65c837e4e4770a473e9f15cf6525886 /src/main/java/eu/siacs/conversations/ui/XmppActivity.java | |
parent | 2bb033267b80f8ee030a20e5c447df6a22226f61 (diff) |
Only show that have sessions in fingerprint list
Doesn't access database directly anymore but goes through AxolotlService
now to obtain list of fingerprints associated with an Account/Contact.
This should prevent orphaned keys littering the UI which previously
couldn't be removed through the Clear Devices function.
Together with 1c79982da84964c1d81179a0927d9cd1eadf53de this fixes #1393
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/XmppActivity.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/XmppActivity.java | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index aa5812b6a..967efec92 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -59,8 +59,6 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import net.java.otr4j.session.SessionID; -import org.whispersystems.libaxolotl.IdentityKey; - import java.io.FileNotFoundException; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -613,11 +611,10 @@ public abstract class XmppActivity extends Activity { builder.create().show(); } - protected boolean addFingerprintRow(LinearLayout keys, final Account account, IdentityKey identityKey, boolean highlight) { - final String fingerprint = identityKey.getFingerprint().replaceAll("\\s", ""); + protected boolean addFingerprintRow(LinearLayout keys, final Account account, final String fingerprint, boolean highlight) { final XmppAxolotlSession.Trust trust = account.getAxolotlService() .getFingerprintTrust(fingerprint); - return addFingerprintRowWithListeners(keys, account, identityKey, highlight, trust, true, + return addFingerprintRowWithListeners(keys, account, fingerprint, highlight, trust, true, new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -639,7 +636,7 @@ public abstract class XmppActivity extends Activity { } protected boolean addFingerprintRowWithListeners(LinearLayout keys, final Account account, - final IdentityKey identityKey, + final String fingerprint, boolean highlight, XmppAxolotlSession.Trust trust, boolean showTag, @@ -659,7 +656,7 @@ public abstract class XmppActivity extends Activity { view.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { - showPurgeKeyDialog(account, identityKey); + showPurgeKeyDialog(account, fingerprint); return true; } }); @@ -707,24 +704,24 @@ public abstract class XmppActivity extends Activity { keyType.setText(getString(R.string.omemo_fingerprint)); } - key.setText(CryptoHelper.prettifyFingerprint(identityKey.getFingerprint())); + key.setText(CryptoHelper.prettifyFingerprint(fingerprint)); keys.addView(view); return true; } - public void showPurgeKeyDialog(final Account account, final IdentityKey identityKey) { + public void showPurgeKeyDialog(final Account account, final String fingerprint) { Builder builder = new Builder(this); builder.setTitle(getString(R.string.purge_key)); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setMessage(getString(R.string.purge_key_desc_part1) - + "\n\n" + CryptoHelper.prettifyFingerprint(identityKey.getFingerprint()) + + "\n\n" + CryptoHelper.prettifyFingerprint(fingerprint) + "\n\n" + getString(R.string.purge_key_desc_part2)); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.accept), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - account.getAxolotlService().purgeKey(identityKey); + account.getAxolotlService().purgeKey(fingerprint); refreshUi(); } }); |