aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-09-04 20:41:27 +0200
committerChristian Schneppe <christian@pix-art.de>2017-09-04 20:41:27 +0200
commitcaa0eba953b1f62595de5b9625a6ed90297e401f (patch)
treeccbff9e33fbce4df43f750e6a1fdb3a3b374304d /src/main/java/de
parent0b446dd81c3f3e00e52bc41175ed1663e2fce568 (diff)
improved error messages on missing omemo keys
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java
index 061bb7b28..8a92a2b35 100644
--- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java
@@ -230,7 +230,15 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
if (fingerprints.size() == 0) {
informNoKeys.setVisibility(View.VISIBLE);
- informNoKeys.setText(getString(R.string.no_keys_just_confirm, mAccount.getRoster().getContact(jid).getDisplayName()));
+ if (hasNoOtherTrustedKeys(jid)) {
+ if (!mAccount.getRoster().getContact(jid).mutualPresenceSubscription()) {
+ informNoKeys.setText(R.string.error_no_keys_to_trust_presence);
+ } else {
+ informNoKeys.setText(R.string.error_no_keys_to_trust_server_error);
+ }
+ } else {
+ informNoKeys.setText(getString(R.string.no_keys_just_confirm, mAccount.getRoster().getContact(jid).getDisplayName()));
+ }
} else {
informNoKeys.setVisibility(View.GONE);
}
@@ -253,7 +261,11 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
keyErrorMessageCard.setVisibility(View.VISIBLE);
if (lastFetchReport == AxolotlService.FetchStatus.ERROR
|| mAccount.getAxolotlService().fetchMapHasErrors(contactJids)) {
- keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error);
+ if (anyWithoutMutualPresenceSubscription(contactJids)) {
+ keyErrorMessage.setText(R.string.error_no_keys_to_trust_presence);
+ } else {
+ keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error);
+ }
} else {
keyErrorMessage.setText(R.string.error_no_keys_to_trust);
}
@@ -267,6 +279,15 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
}
+ private boolean anyWithoutMutualPresenceSubscription(List<Jid> contactJids) {
+ for (Jid jid : contactJids) {
+ if (!mAccount.getRoster().getContact(jid).mutualPresenceSubscription()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private boolean foreignActuallyHasKeys() {
synchronized (this.foreignKeysToTrust) {
for (Map.Entry<Jid, Map<String, Boolean>> entry : foreignKeysToTrust.entrySet()) {