mirror of https://github.com/procxx/kepka.git
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_error_cant_read" = "Can't read this file. Please choose an image.";
|
||||||
"lng_passport_bad_name" = "Please use latin characters only.";
|
"lng_passport_bad_name" = "Please use latin characters only.";
|
||||||
"lng_passport_wait_upload" = "Please wait while upload is finished.";
|
"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_title" = "Export Personal Data";
|
||||||
"lng_export_progress_title" = "Exporting personal data";
|
"lng_export_progress_title" = "Exporting personal data";
|
||||||
|
|
|
@ -2108,6 +2108,7 @@ void UpdateApplication() {
|
||||||
if (weak) {
|
if (weak) {
|
||||||
weak->scrollToUpdateRow();
|
weak->scrollToUpdateRow();
|
||||||
}
|
}
|
||||||
|
window->showFromTray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2060,8 +2060,12 @@ void FormController::parseForm(const MTPaccount_AuthorizationForm &result) {
|
||||||
void FormController::formFail(const QString &error) {
|
void FormController::formFail(const QString &error) {
|
||||||
_savedPasswordValue = QByteArray();
|
_savedPasswordValue = QByteArray();
|
||||||
_serviceErrorText = error;
|
_serviceErrorText = error;
|
||||||
_view->showCriticalError(
|
if (error == "APP_VERSION_OUTDATED") {
|
||||||
lang(lng_passport_form_error) + "\n" + error);
|
_view->showUpdateAppBox();
|
||||||
|
} else {
|
||||||
|
_view->showCriticalError(
|
||||||
|
lang(lng_passport_form_error) + "\n" + error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormController::requestPassword() {
|
void FormController::requestPassword() {
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
virtual void showAskPassword() = 0;
|
virtual void showAskPassword() = 0;
|
||||||
virtual void showNoPassword() = 0;
|
virtual void showNoPassword() = 0;
|
||||||
virtual void showCriticalError(const QString &error) = 0;
|
virtual void showCriticalError(const QString &error) = 0;
|
||||||
|
virtual void showUpdateAppBox() = 0;
|
||||||
virtual void editScope(int index) = 0;
|
virtual void editScope(int index) = 0;
|
||||||
|
|
||||||
virtual void showBox(
|
virtual void showBox(
|
||||||
|
|
|
@ -98,6 +98,7 @@ void Panel::showBox(
|
||||||
LayerOptions options,
|
LayerOptions options,
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
_widget->showBox(std::move(box), options, animated);
|
_widget->showBox(std::move(box), options, animated);
|
||||||
|
_widget->showAndActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::showToast(const QString &text) {
|
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/toast/toast.h"
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "ui/countryinput.h"
|
#include "ui/countryinput.h"
|
||||||
|
#include "core/update_checker.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
|
@ -812,6 +813,24 @@ void PanelController::showCriticalError(const QString &error) {
|
||||||
_panel->showCriticalError(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() {
|
void PanelController::ensurePanelCreated() {
|
||||||
if (!_panel) {
|
if (!_panel) {
|
||||||
_panel = std::make_unique<Panel>(this);
|
_panel = std::make_unique<Panel>(this);
|
||||||
|
|
|
@ -97,6 +97,7 @@ public:
|
||||||
void showAskPassword() override;
|
void showAskPassword() override;
|
||||||
void showNoPassword() override;
|
void showNoPassword() override;
|
||||||
void showCriticalError(const QString &error) override;
|
void showCriticalError(const QString &error) override;
|
||||||
|
void showUpdateAppBox() override;
|
||||||
|
|
||||||
void fillRows(
|
void fillRows(
|
||||||
Fn<void(
|
Fn<void(
|
||||||
|
|
|
@ -223,7 +223,9 @@ void SeparatePanel::finishAnimating() {
|
||||||
_animationCache = QPixmap();
|
_animationCache = QPixmap();
|
||||||
if (_visible) {
|
if (_visible) {
|
||||||
showControls();
|
showControls();
|
||||||
_inner->setFocus();
|
if (_inner) {
|
||||||
|
_inner->setFocus();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
finishClose();
|
finishClose();
|
||||||
}
|
}
|
||||||
|
@ -317,7 +319,7 @@ void SeparatePanel::focusInEvent(QFocusEvent *e) {
|
||||||
crl::on_main(this, [=] {
|
crl::on_main(this, [=] {
|
||||||
if (_layer) {
|
if (_layer) {
|
||||||
_layer->setInnerFocus();
|
_layer->setInnerFocus();
|
||||||
} else if (!_inner->isHidden()) {
|
} else if (_inner && !_inner->isHidden()) {
|
||||||
_inner->setFocus();
|
_inner->setFocus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue