show fetch errors in trust keys activity

This commit is contained in:
Daniel Gultsch 2016-01-23 11:39:02 +01:00
parent ba98fe4f86
commit 43521891f0
2 changed files with 15 additions and 1 deletions

View File

@ -79,6 +79,19 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
}
}
public boolean fetchMapHasErrors(Contact contact) {
Jid jid = contact.getJid().toBareJid();
if (deviceIds.get(jid) != null) {
for (Integer foreignId : this.deviceIds.get(jid)) {
AxolotlAddress address = new AxolotlAddress(jid.toString(), foreignId);
if (fetchStatusMap.getAll(address).containsValue(FetchStatus.ERROR)) {
return true;
}
}
}
return false;
}
private static class AxolotlAddressMap<T> {
protected Map<String, Map<Integer, T>> map;
protected final Object MAP_LOCK = new Object();

View File

@ -162,7 +162,8 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
} else {
if (!hasForeignKeys && hasNoOtherTrustedKeys()) {
keyErrorMessageCard.setVisibility(View.VISIBLE);
if (lastFetchReport == AxolotlService.FetchStatus.ERROR) {
if (lastFetchReport == AxolotlService.FetchStatus.ERROR
|| contact.getAccount().getAxolotlService().fetchMapHasErrors(contact)) {
keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error);
} else {
keyErrorMessage.setText(R.string.error_no_keys_to_trust);