Add app outdated error

This commit is contained in:
Ali
2023-04-25 21:25:48 +04:00
parent 123059842a
commit 1037b25bc5
3 changed files with 26 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ public enum AuthorizationCodeRequestError {
case phoneLimitExceeded
case phoneBanned
case timeout
case appOutdated
}
func switchToAuthorizedAccount(transaction: AccountManagerModifier<TelegramAccountManagerTypes>, account: UnauthorizedAccount) {
@@ -230,6 +231,8 @@ public func sendAuthorizationCode(accountManager: AccountManager<TelegramAccount
return .fail(.phoneLimitExceeded)
} else if error.errorDescription == "PHONE_NUMBER_BANNED" {
return .fail(.phoneBanned)
} else if error.errorDescription == "UPDATE_APP_TO_LOGIN" {
return .fail(.appOutdated)
} else if error.errorDescription == "SESSION_PASSWORD_NEEDED" {
return account.network.request(Api.functions.account.getPassword(), automaticFloodWait: false)
|> mapError { error -> AuthorizationCodeRequestError in
@@ -356,6 +359,8 @@ private func internalResendAuthorizationCode(accountManager: AccountManager<Tele
return .phoneLimitExceeded
} else if error.errorDescription == "PHONE_NUMBER_BANNED" {
return .phoneBanned
} else if error.errorDescription == "UPDATE_APP_TO_LOGIN" {
return .appOutdated
} else {
return .generic(info: (Int(error.errorCode), error.errorDescription))
}
@@ -442,6 +447,8 @@ public func resendAuthorizationCode(accountManager: AccountManager<TelegramAccou
return .phoneLimitExceeded
} else if error.errorDescription == "PHONE_NUMBER_BANNED" {
return .phoneBanned
} else if error.errorDescription == "UPDATE_APP_TO_LOGIN" {
return .appOutdated
} else {
return .generic(info: (Int(error.errorCode), error.errorDescription))
}