Fixed issue in history detail regarding LIME capacity for chat + fixed issue in history detail & contact detail if force encryption setting is set

This commit is contained in:
Sylvain Berfini 2019-06-28 15:50:12 +02:00
parent 61e75ff43c
commit e8ad6bd39f
3 changed files with 17 additions and 4 deletions

View file

@ -343,6 +343,9 @@ public class ContactDetailsFragment extends Fragment implements ContactsUpdatedL
v.findViewById(R.id.contact_chat_secured).setVisibility(View.GONE); v.findViewById(R.id.contact_chat_secured).setVisibility(View.GONE);
} }
if (getResources().getBoolean(R.bool.force_end_to_end_encryption_in_chat)) {
v.findViewById(R.id.contact_chat).setVisibility(View.GONE);
}
if (getResources().getBoolean(R.bool.disable_chat)) { if (getResources().getBoolean(R.bool.disable_chat)) {
v.findViewById(R.id.contact_chat).setVisibility(View.GONE); v.findViewById(R.id.contact_chat).setVisibility(View.GONE);
v.findViewById(R.id.contact_chat_secured).setVisibility(View.GONE); v.findViewById(R.id.contact_chat_secured).setVisibility(View.GONE);

View file

@ -425,9 +425,7 @@ public class LinphoneContact extends AndroidContact
} }
public String getContactFromPresenceModelForUriOrTel(String uri) { public String getContactFromPresenceModelForUriOrTel(String uri) {
if (mFriend != null && mFriend.getPresenceModelForUriOrTel(uri) != null) { if (mFriend != null && mFriend.getPresenceModelForUriOrTel(uri) != null) {
return mFriend.getPresenceModelForUriOrTel(uri).getContact(); return mFriend.getPresenceModelForUriOrTel(uri).getContact();
} }
return null; return null;
@ -441,8 +439,16 @@ public class LinphoneContact extends AndroidContact
} }
public boolean hasPresenceModelForUriOrTelCapability(String uri, FriendCapability capability) { public boolean hasPresenceModelForUriOrTelCapability(String uri, FriendCapability capability) {
if (mFriend != null && mFriend.getPresenceModelForUriOrTel(uri) != null) { if (mFriend == null) return false;
if (mFriend.getPresenceModelForUriOrTel(uri) != null) {
return mFriend.getPresenceModelForUriOrTel(uri).hasCapability(capability); return mFriend.getPresenceModelForUriOrTel(uri).hasCapability(capability);
} else {
for (LinphoneNumberOrAddress noa : getNumbersOrAddresses()) {
if (getContactFromPresenceModelForUriOrTel(noa.getValue()).equals(uri)) {
return mFriend.getPresenceModelForUriOrTel(noa.getValue())
.hasCapability(capability);
}
}
} }
return false; return false;
} }

View file

@ -110,6 +110,9 @@ public class HistoryDetailFragment extends Fragment {
} }
}); });
if (getResources().getBoolean(R.bool.force_end_to_end_encryption_in_chat)) {
chat.setVisibility(View.GONE);
}
if (getResources().getBoolean(R.bool.disable_chat)) { if (getResources().getBoolean(R.bool.disable_chat)) {
chat.setVisibility(View.GONE); chat.setVisibility(View.GONE);
mChatSecured.setVisibility(View.GONE); mChatSecured.setVisibility(View.GONE);
@ -182,6 +185,7 @@ public class HistoryDetailFragment extends Fragment {
Core core = LinphoneManager.getCore(); Core core = LinphoneManager.getCore();
if (address != null && core != null) { if (address != null && core != null) {
address.clean();
ProxyConfig proxyConfig = core.getDefaultProxyConfig(); ProxyConfig proxyConfig = core.getDefaultProxyConfig();
CallLog[] logs; CallLog[] logs;
if (proxyConfig != null) { if (proxyConfig != null) {
@ -205,7 +209,7 @@ public class HistoryDetailFragment extends Fragment {
if (!getResources().getBoolean(R.bool.disable_chat) if (!getResources().getBoolean(R.bool.disable_chat)
&& mContact.hasPresenceModelForUriOrTelCapability( && mContact.hasPresenceModelForUriOrTelCapability(
mSipUri, FriendCapability.LimeX3Dh)) { address.asStringUriOnly(), FriendCapability.LimeX3Dh)) {
mChatSecured.setVisibility(View.VISIBLE); mChatSecured.setVisibility(View.VISIBLE);
} }
} else { } else {