aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parent0b446dd81c3f3e00e52bc41175ed1663e2fce568 (diff)
improved error messages on missing omemo keys
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java25
-rw-r--r--src/main/res/values/strings.xml1
2 files changed, 24 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()) {
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index c8e8c216a..047db6e0a 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -783,4 +783,5 @@
<string name="pref_validate_hostname_summary">Server certificates that contain the validated hostname are considered verified</string>
<string name="network_is_unreachable">Network is unreachable</string>
<string name="certificate_does_not_contain_jid">Certificate does not contain a Jabber ID</string>
+ <string name="error_no_keys_to_trust_presence">There are no usable keys available for this contact.\\nMake sure you have mutual presence subscription.</string>
</resources>