mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Fixed CallKit API
Fixed auth code entry layout Added passcode lock confirmation Fixed auth code url handling Fixed instagram video gallery thumbnails
This commit is contained in:
@@ -74,27 +74,7 @@ public final class AuthorizationSequenceController: NavigationController {
|
||||
let masterDatacenterId = strongSelf.account.masterDatacenterId
|
||||
let isTestingEnvironment = strongSelf.account.testingEnvironment
|
||||
|
||||
var countryId: String? = nil
|
||||
let networkInfo = CTTelephonyNetworkInfo()
|
||||
if let carrier = networkInfo.subscriberCellularProvider {
|
||||
countryId = carrier.isoCountryCode
|
||||
}
|
||||
|
||||
if countryId == nil {
|
||||
countryId = (Locale.current as NSLocale).object(forKey: .countryCode) as? String
|
||||
}
|
||||
|
||||
var countryCode: Int32 = 1
|
||||
|
||||
if let countryId = countryId {
|
||||
let normalizedId = countryId.uppercased()
|
||||
for (code, idAndName) in countryCodeToIdAndName {
|
||||
if idAndName.0 == normalizedId {
|
||||
countryCode = Int32(code)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
let countryCode = defaultCountryCode()
|
||||
|
||||
let _ = (strongSelf.account.postbox.transaction { transaction -> Void in
|
||||
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: isTestingEnvironment, masterDatacenterId: masterDatacenterId, contents: .phoneEntry(countryCode: countryCode, number: "")))
|
||||
@@ -637,7 +617,7 @@ public final class AuthorizationSequenceController: NavigationController {
|
||||
case let .phoneEntry(countryCode, number):
|
||||
self.setViewControllers([self.splashController(), self.phoneEntryController(countryCode: countryCode, number: number)], animated: !self.viewControllers.isEmpty)
|
||||
case let .confirmationCodeEntry(number, type, _, timeout, nextType, termsOfService):
|
||||
self.setViewControllers([self.splashController(), self.codeEntryController(number: number, type: type, nextType: nextType, timeout: timeout, termsOfService: termsOfService)], animated: !self.viewControllers.isEmpty)
|
||||
self.setViewControllers([self.splashController(), self.phoneEntryController(countryCode: defaultCountryCode(), number: ""), self.codeEntryController(number: number, type: type, nextType: nextType, timeout: timeout, termsOfService: termsOfService)], animated: !self.viewControllers.isEmpty)
|
||||
case let .passwordEntry(hint, _, _):
|
||||
self.setViewControllers([self.splashController(), self.passwordEntryController(hint: hint)], animated: !self.viewControllers.isEmpty)
|
||||
case let .passwordRecovery(_, _, _, emailPattern):
|
||||
@@ -665,3 +645,29 @@ public final class AuthorizationSequenceController: NavigationController {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func defaultCountryCode() -> Int32 {
|
||||
var countryId: String? = nil
|
||||
let networkInfo = CTTelephonyNetworkInfo()
|
||||
if let carrier = networkInfo.subscriberCellularProvider {
|
||||
countryId = carrier.isoCountryCode
|
||||
}
|
||||
|
||||
if countryId == nil {
|
||||
countryId = (Locale.current as NSLocale).object(forKey: .countryCode) as? String
|
||||
}
|
||||
|
||||
var countryCode: Int32 = 1
|
||||
|
||||
if let countryId = countryId {
|
||||
let normalizedId = countryId.uppercased()
|
||||
for (code, idAndName) in countryCodeToIdAndName {
|
||||
if idAndName.0 == normalizedId {
|
||||
countryCode = Int32(code)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return countryCode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user