2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Simplified confirmed callback for ConfirmBox instances.

This commit is contained in:
23rd
2020-09-24 15:48:02 +03:00
committed by John Preston
parent 9f3af7234e
commit f81271d1fe
21 changed files with 89 additions and 144 deletions

View File

@@ -177,7 +177,6 @@ void Controller::showTermsDecline() {
}
void Controller::showTermsDelete() {
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto deleteByTerms = [=] {
if (const auto session = account().maybeSession()) {
session->termsDeleteNow();
@@ -185,13 +184,12 @@ void Controller::showTermsDelete() {
Ui::hideLayer();
}
};
*box = Ui::show(
Ui::show(
Box<ConfirmBox>(
tr::lng_terms_delete_warning(tr::now),
tr::lng_terms_delete_now(tr::now),
st::attentionBoxButton,
deleteByTerms,
[=] { if (*box) (*box)->closeBox(); }),
deleteByTerms),
Ui::LayerOption::KeepOther);
}