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
|
//Remove linphone contact tag if the contact has no sip address
|
||||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_tag)) {
|
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);
|
removeLinphoneContactTag(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@ public class EditContactFragment extends Fragment {
|
||||||
try {
|
try {
|
||||||
getActivity().getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
|
getActivity().getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
|
||||||
addLinphoneFriendIfNeeded();
|
addLinphoneFriendIfNeeded();
|
||||||
|
removeLinphoneTagIfNeeded();
|
||||||
contactsManager.prepareContactsInBackground();
|
contactsManager.prepareContactsInBackground();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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 {
|
class NewOrUpdatedNumberOrAddress {
|
||||||
private String oldNumberOrAddress;
|
private String oldNumberOrAddress;
|
||||||
|
|
Loading…
Reference in a new issue