Skip to content

Commit

Permalink
Show KZ flag in PhoneNumberTextField (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
vveidi authored Sep 7, 2023
1 parent c60a9b9 commit fcc1faa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions PhoneNumberKit/PartialFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ public final class PartialFormatter {
public var currentRegion: String {
if ignoreIntlNumbers, currentMetadata?.codeID == "001" {
return defaultRegion
} else if self.phoneNumberKit.countryCode(for: self.defaultRegion) != 1 {
return currentMetadata?.codeID ?? "US"
} else {
return self.currentMetadata?.countryCode == 1
let countryCode = self.phoneNumberKit.countryCode(for: self.defaultRegion)
if countryCode != 1, countryCode != 7 {
return currentMetadata?.codeID ?? "US"
} else {
return self.currentMetadata?.countryCode == 1 || self.currentMetadata?.countryCode == 7
? self.defaultRegion
: self.currentMetadata?.codeID ?? self.defaultRegion
}
}
}

Expand Down

0 comments on commit fcc1faa

Please sign in to comment.