aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-11-20 14:30:16 +0100
committerChristian Schneppe <christian@pix-art.de>2016-11-20 14:30:16 +0100
commit47a46c20ab506988c6c52196b6e15727fb0b4b1f (patch)
tree42ca9328326a5f7ba0ab6ae42245f6a799e5a1bd /src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
parent9d6c146f5c9e0988827cd6184318a1d0d3adf965 (diff)
show 'clear devices' button underneath own devices
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 58453ba75..617e0e6d5 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -44,6 +44,7 @@ import de.pixart.messenger.Config;
import de.pixart.messenger.OmemoActivity;
import de.pixart.messenger.R;
import de.pixart.messenger.crypto.axolotl.AxolotlService;
+import de.pixart.messenger.crypto.axolotl.XmppAxolotlSession;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.services.XmppConnectionService.OnAccountUpdate;
@@ -258,6 +259,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
private TableRow mPushRow;
private String mSavedInstanceAccount;
private boolean mSavedInstanceInit = false;
+ private Button mClearDevicesButton;
public void refreshUiReal() {
invalidateOptionsMenu();
@@ -509,6 +511,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mNamePort = (LinearLayout) findViewById(R.id.name_port);
this.mHostname = (EditText) findViewById(R.id.hostname);
this.mHostname.addTextChangedListener(mTextWatcher);
+ this.mClearDevicesButton = (Button) findViewById(R.id.clear_devices);
+ this.mClearDevicesButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ showWipePepDialog();
+ }
+ });
this.mPort = (EditText) findViewById(R.id.port);
this.mPort.setText("5222");
this.mPort.addTextChangedListener(mTextWatcher);
@@ -547,7 +556,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
final MenuItem showMoreInfo = menu.findItem(R.id.action_server_info_show_more);
final MenuItem changePassword = menu.findItem(R.id.action_change_password_on_server);
final MenuItem showPassword = menu.findItem(R.id.action_show_password);
- final MenuItem clearDevices = menu.findItem(R.id.action_clear_devices);
final MenuItem renewCertificate = menu.findItem(R.id.action_renew_certificate);
final MenuItem mamPrefs = menu.findItem(R.id.action_mam_prefs);
final MenuItem changePresence = menu.findItem(R.id.action_change_presence);
@@ -561,17 +569,12 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
changePassword.setVisible(false);
}
mamPrefs.setVisible(mAccount.getXmppConnection().getFeatures().mam());
- Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds();
- if (otherDevices == null || otherDevices.isEmpty() || !Config.supportOmemo()) {
- clearDevices.setVisible(false);
- }
changePresence.setVisible(manuallyChangePresence());
} else {
showQrCode.setVisible(false);
showBlocklist.setVisible(false);
showMoreInfo.setVisible(false);
changePassword.setVisible(false);
- clearDevices.setVisible(false);
mamPrefs.setVisible(false);
changePresence.setVisible(false);
}
@@ -722,9 +725,6 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
case R.id.action_mam_prefs:
editMamPrefs();
break;
- case R.id.action_clear_devices:
- showWipePepDialog();
- break;
case R.id.action_renew_certificate:
renewCertificate();
break;
@@ -921,15 +921,21 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
boolean hasKeys = false;
keys.removeAllViews();
- for (final String fingerprint : mAccount.getAxolotlService().getFingerprintsForOwnSessions()) {
- if (ownAxolotlFingerprint.equals(fingerprint)) {
- continue;
+ for(XmppAxolotlSession session : mAccount.getAxolotlService().findOwnSessions()) {
+ if (!session.getTrust().isCompromised()) {
+ boolean highlight = session.getFingerprint().equals(messageFingerprint);
+ addFingerprintRow(keys,session,highlight);
+ hasKeys = true;
}
- boolean highlight = fingerprint.equals(messageFingerprint);
- hasKeys |= addFingerprintRow(keys, mAccount, fingerprint, highlight);
}
if (hasKeys && Config.supportOmemo()) {
keysCard.setVisibility(View.VISIBLE);
+ Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds();
+ if (otherDevices == null || otherDevices.isEmpty()) {
+ mClearDevicesButton.setVisibility(View.GONE);
+ } else {
+ mClearDevicesButton.setVisibility(View.VISIBLE);
+ }
} else {
keysCard.setVisibility(View.GONE);
}