Improve phone number entry

This commit is contained in:
Ilya Laktyushin
2020-08-25 17:36:15 +03:00
parent d584c0317d
commit b901cdfb0d
7 changed files with 179 additions and 42 deletions

View File

@@ -57,9 +57,7 @@ final class AuthorizationSequencePhoneEntryController: ViewController {
self.presentationData = presentationData
self.openUrl = openUrl
self.back = back
loadServerCountryCodes(accountManager: sharedContext.accountManager, network: account.network)
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: AuthorizationSequenceController.navigationBarTheme(presentationData.theme), strings: NavigationBarStrings(presentationStrings: presentationData.strings)))
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
@@ -140,6 +138,12 @@ final class AuthorizationSequencePhoneEntryController: ViewController {
self.controllerNode.checkPhone = { [weak self] in
self?.nextPressed()
}
loadServerCountryCodes(accountManager: sharedContext.accountManager, network: account.network, completion: { [weak self] in
if let strongSelf = self {
strongSelf.controllerNode.updateCountryCode()
}
})
}
override func viewWillAppear(_ animated: Bool) {
@@ -185,7 +189,7 @@ final class AuthorizationSequencePhoneEntryController: ViewController {
self.loginWithNumber?(self.controllerNode.currentNumber, self.controllerNode.syncContacts)
}
} else {
hapticFeedback.error()
self.hapticFeedback.error()
self.controllerNode.animateError()
}
}