mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Handle the outdated app error in passport.
This commit is contained in:
@@ -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(
|
||||
|
Reference in New Issue
Block a user