Stop using CTCarrier for country code detection due to it's deprecation

This commit is contained in:
Ilya Laktyushin
2024-02-19 19:17:51 -04:00
parent 939b29770a
commit 5d967279b9
5 changed files with 27 additions and 47 deletions

View File

@@ -3,7 +3,6 @@ import UIKit
import AsyncDisplayKit
import Display
import TelegramCore
import CoreTelephony
import TelegramPresentationData
import PhoneInputNode
import CountrySelectionUI
@@ -211,18 +210,9 @@ final class ChangePhoneNumberControllerNode: ASDisplayNode {
}
}
var countryId: String? = nil
let networkInfo = CTTelephonyNetworkInfo()
if let carrier = networkInfo.serviceSubscriberCellularProviders?.values.first {
countryId = carrier.isoCountryCode
}
if countryId == nil {
countryId = (Locale.current as NSLocale).object(forKey: .countryCode) as? String
}
let countryId = (Locale.current as NSLocale).object(forKey: .countryCode) as? String
var countryCodeAndId: (Int32, String) = (1, "US")
if let countryId = countryId {
let normalizedId = countryId.uppercased()
for (code, idAndName) in countryCodeToIdAndName {