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

Question: Possible to get the current user's contact? #39

Closed paintedbicycle closed 6 years ago

paintedbicycle commented 6 years ago

Is there a method for getting the contact of the device's current user?

Paul

joshuapinter commented 6 years ago

Interesting. Never tried it. I'm pretty sure iOS/macOS automatically creates a Contact Card for the Operating System user so it should be in there. Just not sure if there is an easy way to find it or if you have to search by name, etc. like all the others.

paintedbicycle commented 6 years ago

I think on Android there is something called the "Me" card. And on iOS I know the system has the word "me" beside your contact if you're looking in the system Contacts app. But I'd love to be able to return this card.

See Android: https://github.com/rt2zz/react-native-contacts/pull/55

joshuapinter commented 6 years ago

Oh nice. That would be good. I'll keep this as an enhancement. PRs are always welcome! :)

paintedbicycle commented 6 years ago

I'm interested in helping out, but currently your Android support is stuck in a branch and your iOS add/update methods don't include postal addresses so I had to go with another library. If I switch my project over to yours I'll start contributing here what I can, though I'm not a Swift nor Java dev. Mostly I was just interested if you'd heard of it. It seems Android is possible but I haven't seen any info for iOS.

paintedbicycle commented 6 years ago

@joshuapinter Sent you a PR for iOS postal address updates. If we can get this merged I'll move my project over to your library.

paintedbicycle commented 6 years ago

After some research, it does not appear to be possible on iOS.

I'll close this for now as it would violate feature parity between iOS and Android.

Feel free to re-open if:

  1. That is not a requirement for this feature
  2. You want to create a UI workaround where the user is asked for this contact (from the contact picker) and once selected, it's remembered. I'll likely be doing this in my app, but I'm not sure it's a goal of this library.
joshuapinter commented 6 years ago

@paintedbicycle I concur. Handling this yourself is probably the best way to go, because you generally want to do other stuff with it, like attach it to the user's profile, etc.

Thanks for investigating and bringing this up.