From 9b5698b51c746c9184762b3dee453ccf288b4de4 Mon Sep 17 00:00:00 2001 From: Ross Bender Date: Thu, 5 Mar 2020 15:54:51 -0600 Subject: [PATCH] return email addresses on iOS (cherry picked from commit 92002206b5f4419b9861ef5bac1b43e806409884) --- src/ios/CDVContact.swift | 7 +++++++ src/ios/CDVContacts.swift | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVContact.swift b/src/ios/CDVContact.swift index 2d042e61..79e22ce6 100644 --- a/src/ios/CDVContact.swift +++ b/src/ios/CDVContact.swift @@ -999,6 +999,13 @@ let kW3ContactUrls = "urls" if value != nil { nc[kW3ContactPhoneNumbers] = value } + + // emails array + // NSLog(@"getting emails"); + value = extractMultiValue(kW3ContactEmails) + if value != nil { + nc[kW3ContactEmails] = value + } return nc } else { // if no returnFields specified, W3C says to return empty contact (but Cordova will at least return id) diff --git a/src/ios/CDVContacts.swift b/src/ios/CDVContacts.swift index 25e5eda2..79ea0569 100644 --- a/src/ios/CDVContacts.swift +++ b/src/ios/CDVContacts.swift @@ -50,7 +50,8 @@ class CDVNewContactsController: CNContactViewController { CNContactNamePrefixKey as CNKeyDescriptor, CNContactNameSuffixKey as CNKeyDescriptor, CNContactPhoneNumbersKey as CNKeyDescriptor, - CNContactTypeKey as CNKeyDescriptor] + CNContactTypeKey as CNKeyDescriptor, + CNContactEmailAddressesKey as CNKeyDescriptor] // overridden to clean up Contact statics override func onAppTerminate() {