mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Fix already logged in accounts check
This commit is contained in:
@@ -5,6 +5,20 @@ import TelegramCore
|
||||
|
||||
private let phoneNumberUtil = NBPhoneNumberUtil()
|
||||
|
||||
public func cleanPhoneNumber(_ text: String, removePlus: Bool = false) -> String {
|
||||
var result = ""
|
||||
for c in text {
|
||||
if c == "+" && !removePlus {
|
||||
if result.isEmpty {
|
||||
result += String(c)
|
||||
}
|
||||
} else if c >= "0" && c <= "9" {
|
||||
result += String(c)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public func formatPhoneNumber(_ string: String) -> String {
|
||||
do {
|
||||
let number = try phoneNumberUtil.parse("+" + string, defaultRegion: nil)
|
||||
|
||||
Reference in New Issue
Block a user