Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Phone Number Labels #12

Closed
stevecarlton opened this issue Sep 22, 2020 · 5 comments
Closed

Add Phone Number Labels #12

stevecarlton opened this issue Sep 22, 2020 · 5 comments

Comments

@stevecarlton
Copy link

stevecarlton commented Sep 22, 2020

Is your feature request related to a problem? Please describe.
I have used the Cordova Contacts plugin for many years and original underestimated how important the labels are for phone numbers. Without them, very little context is offered.

Describe the solution you'd like
I am very novice in swift but managed to add labels to the phoneNumbers array returned from getContacts in iOS with

for number in contact.phoneNumbers {
     let numberToAppend = number.value.stringValue
     let labelToAppend = number.label?.replacingOccurrences(of: "[!$_<>]", with: "", options: .regularExpression, range: nil)
     phoneNumbers[labelToAppend] = numberToAppend                      
 }

That might be horrible practice in Swift but it's working for me.

Describe alternatives you've considered
Without adding the label to each phone number it will be very difficult to know which number needs to be selected in an app using this plugin.

@tnoetzel
Copy link

@stevecarlton - Curious if you got this running for Android as well, and if you'd be willing to share your forked plugin code. I'm definitely interested in this functionality, and I'm guessing others are, too.

@vhinic
Copy link
Contributor

vhinic commented Dec 11, 2020

I'm just about to create pull request for adding labels for phone numbers as well as emails - in case anyone is interested.

vhinic added a commit to studio-terra/contacts that referenced this issue Dec 11, 2020
@vhinic
Copy link
Contributor

vhinic commented Dec 11, 2020

There is now PR for sample code to: byrdsandbytes/capContactsDemo#4

@Idrimi
Copy link
Member

Idrimi commented Jan 25, 2021

tested and works. 👍 thx @vhinic. closing this.

@Idrimi Idrimi closed this as completed Jan 25, 2021
@stevecarlton
Copy link
Author

@vhinic thanks for making this happen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants