Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

(feat): add baseCountryCode option for normalizing phonenumbers #21

Merged
merged 3 commits into from
Feb 17, 2022

Conversation

spoxies
Copy link
Contributor

@spoxies spoxies commented Feb 8, 2022

Adds baseCountryCode option, when it is defined the (E.164) normalized phonenumbers are resolved.

Usage

window.ContactsX.find(function(success) {
  console.log(success);
}, function (error) {
  console.error(error);
}, {
  fields: {
    phoneNumbers: true
  },
  baseCountryCode : 'DE' // ISO 3166-1 alpha-2 
});
[
    {
        "id": "1",
        "rawId": "1",
        "displayName": "Test",
        "phoneNumbers": [
            {
                "id": "1",
                "value": "+31 6 1234567",
                "normalized": "+3161234567",
                "type": "mobile"
            },
            {
                "id": "2",
                "value": "0 151 12345",
                "normalized": "+4915112345",
                "type": "home"
            }
        ],
        "emails": [],
        "firstName": "Test "
    }
]

Implements/uses:

Reason

Having native code implement/run complicated libraries seemed (more) efficient. The reason for implementing this here is because Android used to return the NORMALIZED_NUMBER. But it does not anymore and taking it further with E.164 has advantages.

Other

I do not have a strong opinion if this functionality belongs here perse, it might be nice to have. But there are certainly arguments against it. Feel free to ignore/close this PR/proposal.

Daan added 2 commits February 8, 2022 14:34
[FEAT] baseCountryCode opt for normalized E.164
[DOC] Add correct sources/index
Copy link
Owner

@EinfachHans EinfachHans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work 🥳 Thank you! Some small comments added

@EinfachHans EinfachHans changed the title [FEAT] baseCountryCode opt for normalized E.164 (corrected) (feat): baseCountryCode opt for normalized E.164 (corrected) Feb 16, 2022
@EinfachHans EinfachHans changed the title (feat): baseCountryCode opt for normalized E.164 (corrected) (feat): add baseCountryCode option for normalizing phonenumbers Feb 16, 2022
@spoxies spoxies force-pushed the feat-normalized-phonenumbers branch from 8befa4a to 07e9ba9 Compare February 16, 2022 12:54
[STYLE] Match lowercase typedef 'string'
[DOC] Remove duplicate 'Android'
@spoxies spoxies force-pushed the feat-normalized-phonenumbers branch from 07e9ba9 to 7fcd712 Compare February 16, 2022 13:05
@spoxies spoxies requested a review from EinfachHans February 16, 2022 14:15
@EinfachHans EinfachHans merged commit b17432f into EinfachHans:master Feb 17, 2022
EinfachHans pushed a commit that referenced this pull request Feb 17, 2022
* [FEAT] baseCountryCode opt for normalized E.164

[FEAT] baseCountryCode opt for normalized E.164
[DOC] Add correct sources/index

* [CHORE Tidy <podspec>/ build.gradle

* [STYLE/DOC] Remove \r\n; Readme matching type def.

[STYLE] Match lowercase typedef 'string'
[DOC] Remove duplicate 'Android'

Co-authored-by: Daan <daan@spoxies.com>
@EinfachHans
Copy link
Owner

Thanks 😊 Released in V2.1.0

@spoxies spoxies deleted the feat-normalized-phonenumbers branch February 17, 2022 14:53
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants