Fix chat notification

This commit is contained in:
Margaux Clerc 2015-06-02 15:54:48 +02:00
parent f6c894b833
commit 70104529d4
2 changed files with 11 additions and 10 deletions

View file

@ -715,9 +715,11 @@ public class LinphoneManager implements LinphoneCoreListener {
} }
try { try {
Contact contact = ContactsManager.getInstance().findContactWithAddress(mServiceContext.getContentResolver(),from); Contact contact = ContactsManager.getInstance().findContactWithAddress(mServiceContext.getContentResolver(), from);
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat__message_notification)) { if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat__message_notification)) {
if(LinphoneActivity.isInstanciated() && LinphoneActivity.instance().displayChatMessageNotification(from.asStringUriOnly())) { if (LinphoneActivity.isInstanciated() && !LinphoneActivity.instance().displayChatMessageNotification(from.asStringUriOnly())) {
return;
} else {
if (contact != null) { if (contact != null) {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getName(), textMessage); LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getName(), textMessage);
} else { } else {

View file

@ -268,14 +268,15 @@ public class ApiFivePlus {
String sipUri = username + "@" + domain; String sipUri = username + "@" + domain;
Cursor cursor = getSIPContactCursor(cr, sipUri); Cursor cursor = getSIPContactCursor(cr, sipUri);
Contact contact = getContact(cr, cursor, 0); if(cursor != null) {
if (contact != null && contact.getNumbersOrAddresses().contains(sipUri)) { Contact contact = getContact(cr, cursor, 0);
address.setDisplayName(contact.getName()); if (contact != null && contact.getNumbersOrAddresses().contains(sipUri)) {
address.setDisplayName(contact.getName());
cursor.close();
return contact.getPhotoUri();
}
cursor.close(); cursor.close();
return contact.getPhotoUri();
} }
cursor.close();
return null; return null;
} }
@ -286,8 +287,6 @@ public class ApiFivePlus {
cursor.close(); cursor.close();
return contactDisplayName; return contactDisplayName;
} }
cursor.close();
return null; return null;
} }