diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index ff8601fae5..9f6cbd776e 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -9343,3 +9343,5 @@ Sorry for the inconvenience."; "ChatList.PremiumRestoreDiscountTitle" = "Get Premium back with up to %@ off"; "ChatList.PremiumRestoreDiscountText" = "Your Telegram Premium has recently expired. Tap here to extend it."; + +"Login.ErrorAppOutdated" = "Please update Telegram to the latest version to log in."; diff --git a/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift b/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift index 6b4edc58d2..56a04d915d 100644 --- a/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift +++ b/submodules/AuthorizationUI/Sources/AuthorizationSequenceController.swift @@ -221,6 +221,13 @@ public final class AuthorizationSequenceController: NavigationController, MFMail case .phoneLimitExceeded: text = strongSelf.presentationData.strings.Login_PhoneFloodError actions.append(TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})) + case .appOutdated: + text = strongSelf.presentationData.strings.Login_ErrorAppOutdated + let updateUrl = strongSelf.presentationData.strings.InviteText_URL + let sharedContext = strongSelf.sharedContext + actions.append(TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: { + sharedContext.applicationBindings.openUrl(updateUrl) + })) case .phoneBanned: text = strongSelf.presentationData.strings.Login_PhoneBannedError actions.append(TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_OK, action: {})) @@ -581,6 +588,8 @@ public final class AuthorizationSequenceController: NavigationController, MFMail if let strongSelf = self, let controller = controller { controller.inProgress = false + var actions: [TextAlertAction] = [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})] + let text: String switch error { case .limitExceeded: @@ -589,6 +598,13 @@ public final class AuthorizationSequenceController: NavigationController, MFMail text = strongSelf.presentationData.strings.Login_InvalidPhoneError case .phoneLimitExceeded: text = strongSelf.presentationData.strings.Login_PhoneFloodError + case .appOutdated: + text = strongSelf.presentationData.strings.Login_ErrorAppOutdated + let updateUrl = strongSelf.presentationData.strings.InviteText_URL + let sharedContext = strongSelf.sharedContext + actions = [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: { + sharedContext.applicationBindings.openUrl(updateUrl) + })] case .phoneBanned: text = strongSelf.presentationData.strings.Login_PhoneBannedError case .generic: @@ -597,7 +613,7 @@ public final class AuthorizationSequenceController: NavigationController, MFMail text = strongSelf.presentationData.strings.Login_NetworkError } - controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root)) + controller.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: strongSelf.presentationData), title: nil, text: text, actions: actions), in: .window(.root)) } })) } diff --git a/submodules/TelegramCore/Sources/Authorization.swift b/submodules/TelegramCore/Sources/Authorization.swift index 9fda6280b6..8dc3891e26 100644 --- a/submodules/TelegramCore/Sources/Authorization.swift +++ b/submodules/TelegramCore/Sources/Authorization.swift @@ -12,6 +12,7 @@ public enum AuthorizationCodeRequestError { case phoneLimitExceeded case phoneBanned case timeout + case appOutdated } func switchToAuthorizedAccount(transaction: AccountManagerModifier, account: UnauthorizedAccount) { @@ -230,6 +231,8 @@ public func sendAuthorizationCode(accountManager: AccountManager mapError { error -> AuthorizationCodeRequestError in @@ -356,6 +359,8 @@ private func internalResendAuthorizationCode(accountManager: AccountManager