forked from mirrors/linphone-iphone
[CNContact] CNContact fix multiple contact edition crashes
This commit is contained in:
parent
87020ea918
commit
28b403383d
7 changed files with 33 additions and 24 deletions
|
|
@ -468,12 +468,14 @@
|
|||
|
||||
- (BOOL)removeSipAddressAtIndex:(NSInteger)index {
|
||||
BOOL ret = FALSE;
|
||||
if (_person) {
|
||||
if (_person ) {
|
||||
NSMutableArray<CNLabeledValue<CNInstantMessageAddress *> *>
|
||||
*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<CNLabeledValue<CNPhoneNumber *> *> *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<CNLabeledValue<NSString *> *> *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",
|
||||
|
|
|
|||
|
|
@ -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<CNPhoneNumber*>*)_tmpContact.phoneNumbers[nbPhone]).value.stringValue];
|
||||
nbEmail++;
|
||||
}
|
||||
}
|
||||
[self saveData];
|
||||
//[self.tableController.tableView reloadData];
|
||||
// [self saveData];
|
||||
} else {
|
||||
[LinphoneManager.instance.fastAddressBook deleteContact:_contact];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -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",
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Reference in a new issue