2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +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

@@ -1039,15 +1039,12 @@ QPointer<Ui::RpWidget> ShowSendNowMessagesBox(
});
return { nullptr };
}
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
auto done = [
=,
list = std::move(items),
callback = std::move(successCallback)
]() mutable {
if (*box) {
(*box)->closeBox();
}
](Fn<void()> &&close) mutable {
close();
auto ids = QVector<MTPint>();
for (const auto item : session->data().idsToItems(list)) {
if (item->allowsSendNow()) {
@@ -1067,10 +1064,9 @@ QPointer<Ui::RpWidget> ShowSendNowMessagesBox(
callback();
}
};
*box = Ui::show(
return Ui::show(
Box<ConfirmBox>(text, tr::lng_send_button(tr::now), std::move(done)),
Ui::LayerOption::KeepOther);
return box->data();
Ui::LayerOption::KeepOther).data();
}
void PeerMenuAddChannelMembers(