diff --git a/ios/RCTContacts/RCTContacts.m b/ios/RCTContacts/RCTContacts.m index 680432a5..2347f8d6 100644 --- a/ios/RCTContacts/RCTContacts.m +++ b/ios/RCTContacts/RCTContacts.m @@ -88,6 +88,8 @@ -(NSDictionary*) dictionaryRepresentationForABPerson:(ABRecordRef) person NSString *givenName = (__bridge_transfer NSString *)(ABRecordCopyValue(person, kABPersonFirstNameProperty)); NSString *familyName = (__bridge_transfer NSString *)(ABRecordCopyValue(person, kABPersonLastNameProperty)); NSString *middleName = (__bridge_transfer NSString *)(ABRecordCopyValue(person, kABPersonMiddleNameProperty)); + NSString *company = (__bridge_transfer NSString *)(ABRecordCopyValue(person, kABPersonOrganizationProperty)); + NSString *jobTitle = (__bridge_transfer NSString *)(ABRecordCopyValue(person, kABPersonJobTitleProperty)); [contact setObject: recordID forKey: @"recordID"]; @@ -106,6 +108,14 @@ -(NSDictionary*) dictionaryRepresentationForABPerson:(ABRecordRef) person [contact setObject: (middleName) ? middleName : @"" forKey:@"middleName"]; } + if(company){ + [contact setObject: (company) ? company : @"" forKey:@"company"]; + } + + if(jobTitle){ + [contact setObject: (jobTitle) ? jobTitle : @"" forKey:@"jobTitle"]; + } + if(!hasName){ //nameless contact, do not include in results return nil; @@ -221,9 +231,13 @@ -(void) updateRecord:(ABRecordRef)record onAddressBook:(ABAddressBookRef)address NSString *givenName = [contactData valueForKey:@"givenName"]; NSString *familyName = [contactData valueForKey:@"familyName"]; NSString *middleName = [contactData valueForKey:@"middleName"]; + NSString *company = [contactData valueForKey:@"company"]; + NSString *jobTitle = [contactData valueForKey:@"jobTitle"]; ABRecordSetValue(record, kABPersonFirstNameProperty, (__bridge CFStringRef) givenName, &error); ABRecordSetValue(record, kABPersonLastNameProperty, (__bridge CFStringRef) familyName, &error); ABRecordSetValue(record, kABPersonMiddleNameProperty, (__bridge CFStringRef) middleName, &error); + ABRecordSetValue(record, kABPersonOrganizationProperty, (__bridge CFStringRef) company, &error); + ABRecordSetValue(record, kABPersonJobTitleProperty, (__bridge CFStringRef) jobTitle, &error); ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType); NSArray* phoneNumbers = [contactData valueForKey:@"phoneNumbers"];