From 14428da10835f21d486b746308dfa198b1c87637 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 13 Jan 2016 12:19:56 +0100 Subject: show key fetch error in activity when there are no keys to be used --- src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java | 9 ++++++++- src/main/res/values/strings.xml | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index 2e6d3246..bc319108 100644 --- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -42,6 +42,8 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate private Button mSaveButton; private Button mCancelButton; + private AxolotlService.FetchStatus lastFetchReport = AxolotlService.FetchStatus.SUCCESS; + private final Map ownKeysToTrust = new HashMap<>(); private final Map foreignKeysToTrust = new HashMap<>(); @@ -160,7 +162,11 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate } else { if (!hasForeignKeys && hasNoOtherTrustedKeys()) { keyErrorMessageCard.setVisibility(View.VISIBLE); - keyErrorMessage.setText(R.string.error_no_keys_to_trust); + if (lastFetchReport == AxolotlService.FetchStatus.ERROR) { + keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error); + } else { + keyErrorMessage.setText(R.string.error_no_keys_to_trust); + } ownKeys.removeAllViews(); ownKeysCard.setVisibility(View.GONE); foreignKeys.removeAllViews(); foreignKeysCard.setVisibility(View.GONE); } @@ -216,6 +222,7 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate @Override public void onKeyStatusUpdated(final AxolotlService.FetchStatus report) { if (report != null) { + lastFetchReport = report; runOnUiThread(new Runnable() { @Override public void run() { diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 4f17c411..4949fba3 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -408,6 +408,7 @@ Purge key Are you sure you want to purge this key? It will irreversibly be considered compromised, and you can never build a session with it again. + There are no usable keys available for this contact.\nFetching new keys from the server has been unsuccessful. Maybe there is something wrong with your contacts server. There are no usable keys available for this contact. If you have purged any of their keys, they need to generate new ones. Error Fetching history from server -- cgit v1.2.3