Delete sip address fixed
This commit is contained in:
parent
14c8510398
commit
1586eed0e9
2 changed files with 17 additions and 1 deletions
|
@ -548,7 +548,7 @@ public class ContactsManager {
|
|||
|
||||
//Remove linphone contact tag if the contact has no sip address
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_tag)) {
|
||||
if (removeContactTagIsNeeded(contact) && isContactHasLinphoneTag(contact, contentResolver)) {
|
||||
if (removeContactTagIsNeeded(contact) && findRawLinphoneContactID(contact.getID()) != null) {
|
||||
removeLinphoneContactTag(contact);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ public class EditContactFragment extends Fragment {
|
|||
try {
|
||||
getActivity().getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
|
||||
addLinphoneFriendIfNeeded();
|
||||
removeLinphoneTagIfNeeded();
|
||||
contactsManager.prepareContactsInBackground();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -415,6 +416,21 @@ public class EditContactFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeLinphoneTagIfNeeded(){
|
||||
if(!isNewContact) {
|
||||
boolean areAllSipFielsEmpty = true;
|
||||
for (NewOrUpdatedNumberOrAddress nounoa : numbersAndAddresses) {
|
||||
if (!nounoa.isSipAddress && (nounoa.oldNumberOrAddress != null && !nounoa.oldNumberOrAddress.equals("") || nounoa.newNumberOrAddress != null && !nounoa.newNumberOrAddress.equals(""))) {
|
||||
areAllSipFielsEmpty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areAllSipFielsEmpty && contactsManager.findRawLinphoneContactID(contact.getID()) != null) {
|
||||
contactsManager.removeLinphoneContactTag(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class NewOrUpdatedNumberOrAddress {
|
||||
private String oldNumberOrAddress;
|
||||
|
|
Loading…
Reference in a new issue