joshuapinter / react-native-unified-contacts

Your best friend when working with the latest and greatest Contacts Framework in iOS 9+ in React Native.
MIT License
158 stars 56 forks source link

Update contact #6

Closed homanp closed 8 years ago

homanp commented 8 years ago

@joshuapinter Added functionality for updating contact. Also changed the keys for phoneNumbers and emailAddresses so that they match the Swift implementation. Easier to read and maintain.

joshuapinter commented 8 years ago

👍 Nice work man! I'll take a look at this when I get a second. Thanks!

joshuapinter commented 8 years ago

I don't know why Github didn't pick up that this was merged in but this is merged in with 4c791786400aafc6ac600d203efabc0af4a7337e.

I made a number of changes before merging so maybe that threw Github off.

One major change with your implementation is that updateContact now takes the Contact's identifier as the first parameter and the Contact's data is passed in the second parameter, instead of including the identifier in the Contact's data.

You can see that here:

https://github.com/joshuapinter/react-native-unified-contacts/blob/master/RNUnifiedContacts/RNUnifiedContacts.swift#L212

You can view all the changes but I also made updateContact a little less destructive if no phone numbers or email addresses are passed in. Basically, it'll only wipe out the phone numbers or email addresses if the Contact data that's passed in includes phone numbers or email addresses.

Thanks again for the work on this, @homanp!!

homanp commented 8 years ago

ok!