rt2zz / react-native-addressbook

React Native AddressBook
82 stars 13 forks source link

When getting an image, scan through linked contacts for image #12

Closed sgwilym closed 8 years ago

sgwilym commented 8 years ago

This addresses issue #11, which is a crash caused by getABPersonThumbnailFilepath returning nil.

ABPersonHasImageData can return true even if the contact has no image. This is because Apple Contacts allows you to link one or more contacts together.

What this PR does is makes getABPersonThumbnailFilepath scan through a contact’s linked people with ABPersonCopyArrayOfAllLinkedPeople, and find the one that does have an icon, and use that.

And if that fails, it now returns @"" and doesn't crash.

rt2zz commented 8 years ago

This looks great. I will cut a new release shortly.

rt2zz commented 8 years ago

just published 1.3.0

sgwilym commented 8 years ago

@rt2zz Thanks for merging this, but for the life of me I can't find the new release. Doesn't seem to be listed under this repo’s releases.

morenoh149 commented 8 years ago

@sgwilym https://www.npmjs.com/package/react-native-addressbook