From 0144bf8ac1f0442c8ed58907c0a191e8f187f1a2 Mon Sep 17 00:00:00 2001 From: Benjamin Reis Date: Tue, 14 Feb 2017 17:34:39 +0100 Subject: [PATCH] clean empty contact --- Classes/ContactDetailsView.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 4374fd214..727a19190 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -260,6 +260,24 @@ self.tmpContact = NULL; [self saveData]; } + BOOL rm = TRUE; + for (NSString *sip in _contact.sipAddresses) { + if (![sip isEqualToString:@""]) { + rm = FALSE; + break; + } + } + if (rm) { + for (NSString *phone in _contact.phoneNumbers) { + if (![phone isEqualToString:@""]) { + rm = FALSE; + break; + } + } + } + if (rm) { + [LinphoneManager.instance.fastAddressBook removeContact:_contact]; + } } #pragma mark - UICompositeViewDelegate Functions