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

Show Kazakhstan flag in PhoneNumberTextField #689

Merged
merged 1 commit into from
Sep 7, 2023
Merged

Show Kazakhstan flag in PhoneNumberTextField #689

merged 1 commit into from
Sep 7, 2023

Conversation

vveidi
Copy link
Contributor

@vveidi vveidi commented Aug 29, 2023

Russia and Kazakhstan share the same country code +7. And if you input a valid Kazakhstan phone number in PhoneNumberTextField, it shows a Russian flag. It happens because during parsing it uses main territory for displaying country's flag.
Added a check that if phone's countryCode is 7, then we should use defaultRegion instead

Closes #688

@bguidolim bguidolim merged commit fcc1faa into marmelroy:master Sep 7, 2023
2 checks passed
@elitalon
Copy link

elitalon commented Sep 8, 2023

@bguidolim Are we sure this change actually does what it says? Or rather, are we sure it behaves as intended in all cases and not just when using PartialFormatter together with PhoneNumberTextField?

In an app I'm working on, where we've been using PhoneNumberKit facilities with our own UITextField instead of PhoneNumberTextField, currentRegion seems to keep returning RU whenever a +7 is present at the beginning of the phone number.

Maybe I lack understanding of how this works behind the scenes, but I don't see in the code where a change from RU to KZ would happen solely based on countryCode(for: self.defaultRegion). At the very least the area code should also be considered.

Could you please shed some light on this? Thanks!

@rastaman111
Copy link

Hello. As far as I know, Russian numbers start with +79**, and in Kazakhstan with +77**. Most likely the Kazakh flag will appear in this order

@bguidolim Are we sure this change actually does what it says? Or rather, are we sure it behaves as intended in all cases and not just when using PartialFormatter together with PhoneNumberTextField?

In an app I'm working on, where we've been using PhoneNumberKit facilities with our own UITextField instead of PhoneNumberTextField, currentRegion seems to keep returning RU whenever a +7 is present at the beginning of the phone number.

Maybe I lack understanding of how this works behind the scenes, but I don't see in the code where a change from RU to KZ would happen solely based on countryCode(for: self.defaultRegion). At the very least the area code should also be considered.

Could you please shed some light on this? Thanks!

@vveidi vveidi deleted the 688-fix-kz-flag branch September 8, 2023 22:07
cgrindel-self-hosted-renovate bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Sep 9, 2023
….8" (#572)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[marmelroy/PhoneNumberKit](https://togithub.com/marmelroy/PhoneNumberKit)
| patch | `from: "3.6.7"` -> `from: "3.6.8"` |

---

### Release Notes

<details>
<summary>marmelroy/PhoneNumberKit (marmelroy/PhoneNumberKit)</summary>

###
[`v3.6.8`](https://togithub.com/marmelroy/PhoneNumberKit/releases/tag/3.6.8)

[Compare
Source](https://togithub.com/marmelroy/PhoneNumberKit/compare/3.6.7...3.6.8)

#### What's Changed

- Updated metadata to version metadata/8.13.19 by
[@&#8203;github-actions](https://togithub.com/github-actions) in
[marmelroy/PhoneNumberKit#685
- Updated metadata to version metadata/8.13.20 by
[@&#8203;github-actions](https://togithub.com/github-actions) in
[marmelroy/PhoneNumberKit#692
- Show Kazakhstan flag in PhoneNumberTextField by
[@&#8203;veerlorden](https://togithub.com/veerlorden) in
[marmelroy/PhoneNumberKit#689

#### New Contributors

- [@&#8203;veerlorden](https://togithub.com/veerlorden) made their first
contribution in
[marmelroy/PhoneNumberKit#689

**Full Changelog**:
marmelroy/PhoneNumberKit@3.6.7...3.6.8

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44Ny4wIiwidXBkYXRlZEluVmVyIjoiMzYuODcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: Self-hosted Renovate Bot <361546+cgrindel-self-hosted-renovate[bot]@users.noreply.github.enterprise.com>
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

Successfully merging this pull request may close these issues.

Kazakhstan phone numbers in PhoneNumberTextField
4 participants