aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-09-06 15:08:42 +0200
committerAndreas Straub <andy@strb.org>2015-09-06 15:15:57 +0200
commita95c451f1e6ee69fbf3b0072d672c3609a4b1e7d (patch)
tree860e3300c65c837e4e4770a473e9f15cf6525886 /src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
parent2bb033267b80f8ee030a20e5c447df6a22226f61 (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/TrustKeysActivity.java')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
index 0e685c3e..ab313074 100644
--- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java
@@ -43,8 +43,8 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
private Button mSaveButton;
private Button mCancelButton;
- private final Map<IdentityKey, Boolean> ownKeysToTrust = new HashMap<>();
- private final Map<IdentityKey, Boolean> foreignKeysToTrust = new HashMap<>();
+ private final Map<String, Boolean> ownKeysToTrust = new HashMap<>();
+ private final Map<String, Boolean> foreignKeysToTrust = new HashMap<>();
private final OnClickListener mSaveButtonListener = new OnClickListener() {
@Override
@@ -120,28 +120,28 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
foreignKeys.removeAllViews();
boolean hasOwnKeys = false;
boolean hasForeignKeys = false;
- for(final IdentityKey identityKey : ownKeysToTrust.keySet()) {
+ for(final String fingerprint : ownKeysToTrust.keySet()) {
hasOwnKeys = true;
- addFingerprintRowWithListeners(ownKeys, contact.getAccount(), identityKey, false,
- XmppAxolotlSession.Trust.fromBoolean(ownKeysToTrust.get(identityKey)), false,
+ addFingerprintRowWithListeners(ownKeys, contact.getAccount(), fingerprint, false,
+ XmppAxolotlSession.Trust.fromBoolean(ownKeysToTrust.get(fingerprint)), false,
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- ownKeysToTrust.put(identityKey, isChecked);
+ ownKeysToTrust.put(fingerprint, isChecked);
// own fingerprints have no impact on locked status.
}
},
null
);
}
- for(final IdentityKey identityKey : foreignKeysToTrust.keySet()) {
+ for(final String fingerprint : foreignKeysToTrust.keySet()) {
hasForeignKeys = true;
- addFingerprintRowWithListeners(foreignKeys, contact.getAccount(), identityKey, false,
- XmppAxolotlSession.Trust.fromBoolean(foreignKeysToTrust.get(identityKey)), false,
+ addFingerprintRowWithListeners(foreignKeys, contact.getAccount(), fingerprint, false,
+ XmppAxolotlSession.Trust.fromBoolean(foreignKeysToTrust.get(fingerprint)), false,
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- foreignKeysToTrust.put(identityKey, isChecked);
+ foreignKeysToTrust.put(fingerprint, isChecked);
lockOrUnlockAsNeeded();
}
},
@@ -181,12 +181,12 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
}
for(final IdentityKey identityKey : ownKeysSet) {
if(!ownKeysToTrust.containsKey(identityKey)) {
- ownKeysToTrust.put(identityKey, false);
+ ownKeysToTrust.put(identityKey.getFingerprint().replaceAll("\\s", ""), false);
}
}
for(final IdentityKey identityKey : foreignKeysSet) {
if(!foreignKeysToTrust.containsKey(identityKey)) {
- foreignKeysToTrust.put(identityKey, false);
+ foreignKeysToTrust.put(identityKey.getFingerprint().replaceAll("\\s", ""), false);
}
}
}
@@ -225,15 +225,15 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
}
private void commitTrusts() {
- for(IdentityKey identityKey:ownKeysToTrust.keySet()) {
+ for(final String fingerprint :ownKeysToTrust.keySet()) {
contact.getAccount().getAxolotlService().setFingerprintTrust(
- identityKey.getFingerprint().replaceAll("\\s", ""),
- XmppAxolotlSession.Trust.fromBoolean(ownKeysToTrust.get(identityKey)));
+ fingerprint,
+ XmppAxolotlSession.Trust.fromBoolean(ownKeysToTrust.get(fingerprint)));
}
- for(IdentityKey identityKey:foreignKeysToTrust.keySet()) {
+ for(final String fingerprint:foreignKeysToTrust.keySet()) {
contact.getAccount().getAxolotlService().setFingerprintTrust(
- identityKey.getFingerprint().replaceAll("\\s", ""),
- XmppAxolotlSession.Trust.fromBoolean(foreignKeysToTrust.get(identityKey)));
+ fingerprint,
+ XmppAxolotlSession.Trust.fromBoolean(foreignKeysToTrust.get(fingerprint)));
}
}