mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Fact check
This commit is contained in:
parent
cf15c15e0e
commit
abe1e40e2a
31 changed files with 1354 additions and 107 deletions
|
|
@ -5,6 +5,17 @@ import TelegramCore
|
|||
|
||||
private let phoneNumberUtil = NBPhoneNumberUtil()
|
||||
|
||||
public func enhancePhoneNumberWithCodeFromNumber(_ phoneNumber: String, otherPhoneNumber: String, configuration: CountriesConfiguration) -> String {
|
||||
guard let (_, code) = lookupCountryIdByNumber(otherPhoneNumber, configuration: configuration) else {
|
||||
return phoneNumber
|
||||
}
|
||||
var cleanNumber = cleanPhoneNumber(phoneNumber)
|
||||
while cleanNumber.hasPrefix("0") {
|
||||
cleanNumber.removeFirst()
|
||||
}
|
||||
return "+\(code)\(cleanNumber)"
|
||||
}
|
||||
|
||||
public func cleanPhoneNumber(_ text: String, removePlus: Bool = false) -> String {
|
||||
var result = ""
|
||||
for c in text {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue