mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-19 06:26:55 +00:00
Handle the outdated app error in passport.
This commit is contained in:
parent
7be9e0fb94
commit
39b0d9e46f
@ -1665,6 +1665,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passport_error_cant_read" = "Can't read this file. Please choose an image.";
|
||||
"lng_passport_bad_name" = "Please use latin characters only.";
|
||||
"lng_passport_wait_upload" = "Please wait while upload is finished.";
|
||||
"lng_passport_app_out_of_date" = "Sorry, your Telegram app is out of date and can't handle this request. Please update Telegram.";
|
||||
|
||||
"lng_export_title" = "Export Personal Data";
|
||||
"lng_export_progress_title" = "Exporting personal data";
|
||||
|
@ -2108,6 +2108,7 @@ void UpdateApplication() {
|
||||
if (weak) {
|
||||
weak->scrollToUpdateRow();
|
||||
}
|
||||
window->showFromTray();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2060,8 +2060,12 @@ void FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
|
||||
void FormController::formFail(const QString &error) {
|
||||
_savedPasswordValue = QByteArray();
|
||||
_serviceErrorText = error;
|
||||
_view->showCriticalError(
|
||||
lang(lng_passport_form_error) + "\n" + error);
|
||||
if (error == "APP_VERSION_OUTDATED") {
|
||||
_view->showUpdateAppBox();
|
||||
} else {
|
||||
_view->showCriticalError(
|
||||
lang(lng_passport_form_error) + "\n" + error);
|
||||
}
|
||||
}
|
||||
|
||||
void FormController::requestPassword() {
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
virtual void showAskPassword() = 0;
|
||||
virtual void showNoPassword() = 0;
|
||||
virtual void showCriticalError(const QString &error) = 0;
|
||||
virtual void showUpdateAppBox() = 0;
|
||||
virtual void editScope(int index) = 0;
|
||||
|
||||
virtual void showBox(
|
||||
|
@ -98,6 +98,7 @@ void Panel::showBox(
|
||||
LayerOptions options,
|
||||
anim::type animated) {
|
||||
_widget->showBox(std::move(box), options, animated);
|
||||
_widget->showAndActivate();
|
||||
}
|
||||
|
||||
void Panel::showToast(const QString &text) {
|
||||
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/countryinput.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "layout.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
@ -812,6 +813,24 @@ void PanelController::showCriticalError(const QString &error) {
|
||||
_panel->showCriticalError(error);
|
||||
}
|
||||
|
||||
void PanelController::showUpdateAppBox() {
|
||||
ensurePanelCreated();
|
||||
|
||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||
const auto callback = [=] {
|
||||
_form->cancelSure();
|
||||
Core::UpdateApplication();
|
||||
};
|
||||
*box = show(
|
||||
Box<ConfirmBox>(
|
||||
lang(lng_passport_app_out_of_date),
|
||||
lang(lng_menu_update),
|
||||
callback,
|
||||
[=] { _form->cancelSure(); }),
|
||||
LayerOption::KeepOther,
|
||||
anim::type::instant);
|
||||
}
|
||||
|
||||
void PanelController::ensurePanelCreated() {
|
||||
if (!_panel) {
|
||||
_panel = std::make_unique<Panel>(this);
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
void showAskPassword() override;
|
||||
void showNoPassword() override;
|
||||
void showCriticalError(const QString &error) override;
|
||||
void showUpdateAppBox() override;
|
||||
|
||||
void fillRows(
|
||||
Fn<void(
|
||||
|
@ -223,7 +223,9 @@ void SeparatePanel::finishAnimating() {
|
||||
_animationCache = QPixmap();
|
||||
if (_visible) {
|
||||
showControls();
|
||||
_inner->setFocus();
|
||||
if (_inner) {
|
||||
_inner->setFocus();
|
||||
}
|
||||
} else {
|
||||
finishClose();
|
||||
}
|
||||
@ -317,7 +319,7 @@ void SeparatePanel::focusInEvent(QFocusEvent *e) {
|
||||
crl::on_main(this, [=] {
|
||||
if (_layer) {
|
||||
_layer->setInnerFocus();
|
||||
} else if (!_inner->isHidden()) {
|
||||
} else if (_inner && !_inner->isHidden()) {
|
||||
_inner->setFocus();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user