mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-18 13:59:46 +00:00
Simplified management of PasscodeBox within customCheckCallback.
This commit is contained in:
@@ -236,14 +236,14 @@ void SendBotCallbackDataWithPassword(
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
const auto box = std::make_shared<QPointer<PasscodeBox>>();
|
||||
auto fields = PasscodeBox::CloudFields::From(state);
|
||||
fields.customTitle = tr::lng_bots_password_confirm_title();
|
||||
fields.customDescription
|
||||
= tr::lng_bots_password_confirm_description(tr::now);
|
||||
fields.customSubmitButton = tr::lng_passcode_submit();
|
||||
fields.customCheckCallback = [=](
|
||||
const Core::CloudPasswordResult &result) {
|
||||
const Core::CloudPasswordResult &result,
|
||||
QPointer<PasscodeBox> box) {
|
||||
if (const auto button = getButton()) {
|
||||
if (button->requestId) {
|
||||
return;
|
||||
@@ -257,18 +257,17 @@ void SendBotCallbackDataWithPassword(
|
||||
return;
|
||||
}
|
||||
SendBotCallbackData(strongController, item, row, column, result, [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
if (box) {
|
||||
box->closeBox();
|
||||
}
|
||||
}, [=](const QString &error) {
|
||||
if (*box) {
|
||||
(*box)->handleCustomCheckError(error);
|
||||
if (box) {
|
||||
box->handleCustomCheckError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
auto object = Box<PasscodeBox>(session, fields);
|
||||
*box = Ui::MakeWeak(object.data());
|
||||
show->showBox(std::move(object), Ui::LayerOption::CloseOther);
|
||||
}, *lifetime);
|
||||
}
|
||||
|
Reference in New Issue
Block a user