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> { private static class AxolotlAddressMap<T> {
protected Map<String, Map<Integer, T>> map; protected Map<String, Map<Integer, T>> map;
protected final Object MAP_LOCK = new Object(); protected final Object MAP_LOCK = new Object();

View File

@ -162,7 +162,8 @@ public class TrustKeysActivity extends XmppActivity implements OnKeyStatusUpdate
} else { } else {
if (!hasForeignKeys && hasNoOtherTrustedKeys()) { if (!hasForeignKeys && hasNoOtherTrustedKeys()) {
keyErrorMessageCard.setVisibility(View.VISIBLE); 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); keyErrorMessage.setText(R.string.error_no_keys_to_trust_server_error);
} else { } else {
keyErrorMessage.setText(R.string.error_no_keys_to_trust); keyErrorMessage.setText(R.string.error_no_keys_to_trust);