diff --git a/Classes/Contact.m b/Classes/Contact.m index 8ee7bbf82..8fde471f9 100644 --- a/Classes/Contact.m +++ b/Classes/Contact.m @@ -468,12 +468,14 @@ - (BOOL)removeSipAddressAtIndex:(NSInteger)index { BOOL ret = FALSE; - if (_person) { + if (_person ) { NSMutableArray *> *tmpSipAddress = [_person.instantMessageAddresses mutableCopy]; - [tmpSipAddress removeObjectAtIndex:index]; - [_person setValue:tmpSipAddress - forKey:CNContactInstantMessageAddressesKey]; + if([tmpSipAddress count] > index){ + [tmpSipAddress removeObjectAtIndex:index]; + [_person setValue:tmpSipAddress + forKey:CNContactInstantMessageAddressesKey]; + } ret = TRUE; } else { LinphoneAddress *addr = linphone_core_interpret_url( @@ -498,8 +500,10 @@ if (_person && _person.phoneNumbers.count > 0) { NSMutableArray *> *tmpPhoneNumbers = [_person.phoneNumbers mutableCopy]; - [tmpPhoneNumbers removeObjectAtIndex:index]; - [_person setValue:tmpPhoneNumbers forKey:CNContactPhoneNumbersKey]; + if([tmpPhoneNumbers count] > index){ + [tmpPhoneNumbers removeObjectAtIndex:index]; + [_person setValue:tmpPhoneNumbers forKey:CNContactPhoneNumbersKey]; + } ret = TRUE; } else { const char *phone = ((NSString *)_phones[index]).UTF8String; @@ -517,12 +521,14 @@ - (BOOL)removeEmailAtIndex:(NSInteger)index { BOOL ret = FALSE; - if (_person) { + if (_person && _person.phoneNumbers.count > 0) { NSMutableArray *> *tmpEmailAddresses = [_person.emailAddresses mutableCopy]; + if([tmpEmailAddresses count] > index){ [tmpEmailAddresses removeObjectAtIndex:index]; [_person setValue:tmpEmailAddresses forKey:CNContactEmailAddressesKey]; + } ret = TRUE; } else { LOGW(@"%s: Cannot do it when using LinphoneFriend, skipping", diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index 16bccb61d..6d704500c 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -430,13 +430,10 @@ static UICompositeViewDescription *compositeDescription = nil; if (_tmpContact.emails != NULL) { while (_tmpContact.emails.count > nbEmail) { [_contact addEmail:_tmpContact.emails[nbEmail]]; - // [_contact - // addPhoneNumber:((CNLabeledValue*)_tmpContact.phoneNumbers[nbPhone]).value.stringValue]; nbEmail++; } } - [self saveData]; - //[self.tableController.tableView reloadData]; + // [self saveData]; } else { [LinphoneManager.instance.fastAddressBook deleteContact:_contact]; } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index c0375b55e..8cdddd532 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2361,10 +2361,12 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } const MSList *lists = linphone_core_get_friends_lists(LC); - while (lists) { - linphone_friend_list_enable_subscriptions( - lists->data, enabled && [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"]); - lists = lists->next; + if(lists != nil){ + while (lists) { + linphone_friend_list_enable_subscriptions( + lists->data, enabled && [LinphoneManager.instance lpConfigBoolForKey:@"use_rls_presence"]); + lists = lists->next; + } } } diff --git a/Classes/LinphoneUI/Base.lproj/UIChatBubblePhotoCell.strings b/Classes/LinphoneUI/Base.lproj/UIChatBubblePhotoCell.strings index bbc940d42..ba11c1c50 100644 Binary files a/Classes/LinphoneUI/Base.lproj/UIChatBubblePhotoCell.strings and b/Classes/LinphoneUI/Base.lproj/UIChatBubblePhotoCell.strings differ diff --git a/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.strings b/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.strings index 36cc75de9..473d68b03 100644 Binary files a/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.strings and b/Classes/LinphoneUI/Base.lproj/UIChatBubbleTextCell.strings differ diff --git a/Classes/Utils/FastAddressBook.m b/Classes/Utils/FastAddressBook.m index 29b101c92..d8fd9e41a 100644 --- a/Classes/Utils/FastAddressBook.m +++ b/Classes/Utils/FastAddressBook.m @@ -388,16 +388,20 @@ [[store unifiedContactWithIdentifier:contact.identifier keysToFetch:keysToFetch error:nil] mutableCopy]; - [mCNContact setGivenName:contact.firstName]; - [mCNContact setFamilyName:contact.lastName]; - [mCNContact setNickname:contact.displayName]; - [mCNContact setPhoneNumbers:contact.person.phoneNumbers]; - [mCNContact setEmailAddresses:contact.person.emailAddresses]; - [mCNContact - setInstantMessageAddresses:contact.person.instantMessageAddresses]; - [mCNContact setImageData:UIImageJPEGRepresentation(contact.avatar, 0.9f)]; + if(mCNContact == NULL){ + [saveRequest addContact:[cNContact mutableCopy] toContainerWithIdentifier:nil]; + }else{ + [mCNContact setGivenName:contact.firstName]; + [mCNContact setFamilyName:contact.lastName]; + [mCNContact setNickname:contact.displayName]; + [mCNContact setPhoneNumbers:contact.person.phoneNumbers]; + [mCNContact setEmailAddresses:contact.person.emailAddresses]; + [mCNContact + setInstantMessageAddresses:contact.person.instantMessageAddresses]; + [mCNContact setImageData:UIImageJPEGRepresentation(contact.avatar, 0.9f)]; - [saveRequest updateContact:mCNContact]; + [saveRequest updateContact:mCNContact]; + } NSError *saveError; @try { NSLog(@"Success %d", diff --git a/Resources/en.lproj/Localizable.strings b/Resources/en.lproj/Localizable.strings index 27ff2b32b..2154467a9 100644 Binary files a/Resources/en.lproj/Localizable.strings and b/Resources/en.lproj/Localizable.strings differ