mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Simplified confirmed callback for ConfirmBox instances.
This commit is contained in:
parent
9f3af7234e
commit
f81271d1fe
21 changed files with 89 additions and 144 deletions
|
@ -244,7 +244,6 @@ private:
|
|||
|
||||
Fn<void()> _revokeCallback;
|
||||
mtpRequestId _revokeRequestId = 0;
|
||||
QPointer<ConfirmBox> _weakRevokeConfirmBox;
|
||||
|
||||
};
|
||||
|
||||
|
@ -1417,21 +1416,21 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
|||
lt_group,
|
||||
pressed->name);
|
||||
auto confirmText = tr::lng_channels_too_much_public_revoke(tr::now);
|
||||
_weakRevokeConfirmBox = Ui::show(Box<ConfirmBox>(text, confirmText, crl::guard(this, [this, pressed]() {
|
||||
auto callback = crl::guard(this, [=](Fn<void()> &&close) {
|
||||
if (_revokeRequestId) return;
|
||||
_revokeRequestId = _api.request(MTPchannels_UpdateUsername(
|
||||
pressed->asChannel()->inputChannel,
|
||||
MTP_string()
|
||||
)).done([=](const MTPBool &result) {
|
||||
const auto callback = _revokeCallback;
|
||||
if (_weakRevokeConfirmBox) {
|
||||
_weakRevokeConfirmBox->closeBox();
|
||||
}
|
||||
if (callback) {
|
||||
)).done([=, close = std::move(close)](const MTPBool &result) {
|
||||
close();
|
||||
if (const auto callback = _revokeCallback) {
|
||||
callback();
|
||||
}
|
||||
}).send();
|
||||
})), Ui::LayerOption::KeepOther);
|
||||
});
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(text, confirmText, std::move(callback)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,12 +163,9 @@ void BackgroundBox::prepare() {
|
|||
}
|
||||
|
||||
void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto session = &_controller->session();
|
||||
const auto remove = [=, weak = Ui::MakeWeak(this)]{
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
const auto remove = [=, weak = Ui::MakeWeak(this)](Fn<void()> &&close) {
|
||||
close();
|
||||
if (weak) {
|
||||
weak->_inner->removePaper(paper);
|
||||
}
|
||||
|
@ -179,7 +176,7 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
|||
paper.mtpSettings()
|
||||
)).send();
|
||||
};
|
||||
*box = Ui::show(
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(
|
||||
tr::lng_background_sure_delete(tr::now),
|
||||
tr::lng_selected_delete(tr::now),
|
||||
|
|
|
@ -1085,7 +1085,6 @@ void ProxiesBoxController::ShowApplyConfirmation(
|
|||
proxy.password = fields.value(qsl("secret"));
|
||||
}
|
||||
if (proxy) {
|
||||
const auto box = std::make_shared<QPointer<ConfirmBox>>();
|
||||
const auto text = tr::lng_sure_enable_socks(
|
||||
tr::now,
|
||||
lt_server,
|
||||
|
@ -1095,7 +1094,7 @@ void ProxiesBoxController::ShowApplyConfirmation(
|
|||
+ (proxy.type == Type::Mtproto
|
||||
? "\n\n" + tr::lng_proxy_sponsor_warning(tr::now)
|
||||
: QString());
|
||||
*box = Ui::show(Box<ConfirmBox>(text, tr::lng_sure_enable(tr::now), [=] {
|
||||
auto callback = [=](Fn<void()> &&close) {
|
||||
auto &proxies = Global::RefProxiesList();
|
||||
if (!ranges::contains(proxies, proxy)) {
|
||||
proxies.push_back(proxy);
|
||||
|
@ -1104,10 +1103,14 @@ void ProxiesBoxController::ShowApplyConfirmation(
|
|||
proxy,
|
||||
ProxyData::Settings::Enabled);
|
||||
Local::writeSettings();
|
||||
if (const auto strong = box->data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
}), Ui::LayerOption::KeepOther);
|
||||
close();
|
||||
};
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(
|
||||
text,
|
||||
tr::lng_sure_enable(tr::now),
|
||||
std::move(callback)),
|
||||
Ui::LayerOption::KeepOther);
|
||||
} else {
|
||||
Ui::show(Box<InformBox>(
|
||||
(proxy.status() == ProxyData::Status::Unsupported
|
||||
|
|
|
@ -602,14 +602,11 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) {
|
|||
if (_cloudFields.turningOff && _cloudFields.notEmptyPassport) {
|
||||
Assert(!_cloudFields.customCheckCallback);
|
||||
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto confirmed = [=] {
|
||||
const auto confirmed = [=](Fn<void()> &&close) {
|
||||
send();
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
close();
|
||||
};
|
||||
*box = getDelegate()->show(Box<ConfirmBox>(
|
||||
getDelegate()->show(Box<ConfirmBox>(
|
||||
tr::lng_cloud_password_passport_losing(tr::now),
|
||||
tr::lng_continue(tr::now),
|
||||
confirmed));
|
||||
|
@ -809,20 +806,16 @@ void PasscodeBox::changeCloudPassword(
|
|||
}
|
||||
|
||||
void PasscodeBox::suggestSecretReset(const QString &newPassword) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto resetSecretAndSave = [=] {
|
||||
checkPasswordHash([=](const Core::CloudPasswordResult &check) {
|
||||
resetSecret(check, newPassword, [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
});
|
||||
auto resetSecretAndSave = [=](Fn<void()> &&close) {
|
||||
checkPasswordHash([=, close = std::move(close)](
|
||||
const Core::CloudPasswordResult &check) {
|
||||
resetSecret(check, newPassword, std::move(close));
|
||||
});
|
||||
};
|
||||
*box = getDelegate()->show(Box<ConfirmBox>(
|
||||
getDelegate()->show(Box<ConfirmBox>(
|
||||
Lang::Hard::PassportCorruptedChange(),
|
||||
Lang::Hard::PassportCorruptedReset(),
|
||||
[=] { resetSecretAndSave(); }));
|
||||
std::move(resetSecretAndSave)));
|
||||
}
|
||||
|
||||
void PasscodeBox::resetSecret(
|
||||
|
@ -1067,14 +1060,11 @@ void RecoverBox::submit() {
|
|||
}).handleFloodErrors().send();
|
||||
});
|
||||
if (_notEmptyPassport) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto confirmed = [=] {
|
||||
const auto confirmed = [=](Fn<void()> &&close) {
|
||||
send();
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
close();
|
||||
};
|
||||
*box = getDelegate()->show(Box<ConfirmBox>(
|
||||
getDelegate()->show(Box<ConfirmBox>(
|
||||
tr::lng_cloud_password_passport_losing(tr::now),
|
||||
tr::lng_continue(tr::now),
|
||||
confirmed));
|
||||
|
|
|
@ -146,15 +146,12 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
|||
Ui::Text::RichLangValue));
|
||||
}
|
||||
}
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto sure = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
const auto sure = [=](Fn<void()> &&close) {
|
||||
close();
|
||||
const auto onstack = _callback;
|
||||
onstack(chat);
|
||||
};
|
||||
*box = Ui::show(
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(
|
||||
text,
|
||||
tr::lng_manage_discussion_group_link(tr::now),
|
||||
|
@ -178,18 +175,15 @@ void Controller::choose(not_null<ChatData*> chat) {
|
|||
text.append(tr::lng_manage_discussion_group_warning(
|
||||
tr::now,
|
||||
Ui::Text::RichLangValue));
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto sure = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
const auto sure = [=](Fn<void()> &&close) {
|
||||
close();
|
||||
const auto done = [=](not_null<ChannelData*> chat) {
|
||||
const auto onstack = _callback;
|
||||
onstack(chat);
|
||||
};
|
||||
chat->session().api().migrateChat(chat, crl::guard(this, done));
|
||||
};
|
||||
*box = Ui::show(
|
||||
Ui::show(
|
||||
Box<ConfirmBox>(
|
||||
text,
|
||||
tr::lng_manage_discussion_group_link(tr::now),
|
||||
|
|
|
@ -546,17 +546,14 @@ void Controller::revokeInviteLink() {
|
|||
}
|
||||
|
||||
void Controller::exportInviteLink(const QString &confirmation) {
|
||||
const auto boxPointer = std::make_shared<QPointer<ConfirmBox>>();
|
||||
const auto callback = crl::guard(this, [=] {
|
||||
if (const auto strong = *boxPointer) {
|
||||
strong->closeBox();
|
||||
}
|
||||
const auto callback = crl::guard(this, [=](Fn<void()> &&close) {
|
||||
close();
|
||||
_peer->session().api().exportInviteLink(_peer->migrateToOrMe());
|
||||
});
|
||||
auto box = Box<ConfirmBox>(
|
||||
confirmation,
|
||||
std::move(callback));
|
||||
*boxPointer = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
bool Controller::canEditInviteLink() const {
|
||||
|
|
|
@ -380,12 +380,11 @@ bool HandleUnknown(
|
|||
result.ventities().value_or_empty())
|
||||
};
|
||||
if (result.is_update_app()) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto callback = [=] {
|
||||
const auto callback = [=](Fn<void()> &&close) {
|
||||
Core::UpdateApplication();
|
||||
if (*box) (*box)->closeBox();
|
||||
close();
|
||||
};
|
||||
*box = Ui::show(Box<ConfirmBox>(
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
text,
|
||||
tr::lng_menu_update(tr::now),
|
||||
callback));
|
||||
|
|
|
@ -336,8 +336,7 @@ void ContactStatus::setupBlockHandler(not_null<UserData*> user) {
|
|||
void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
||||
_bar.entity()->shareClicks(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto share = [=] {
|
||||
const auto share = [=](Fn<void()> &&close) {
|
||||
user->setSettings(0);
|
||||
user->session().api().request(MTPcontacts_AcceptContact(
|
||||
user->inputUser
|
||||
|
@ -349,11 +348,9 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
|||
lt_user,
|
||||
user->shortName()));
|
||||
}).send();
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
close();
|
||||
};
|
||||
*box = _controller->window().show(Box<ConfirmBox>(
|
||||
_controller->window().show(Box<ConfirmBox>(
|
||||
tr::lng_new_contact_share_sure(
|
||||
tr::now,
|
||||
lt_phone,
|
||||
|
@ -387,11 +384,8 @@ void ContactStatus::setupReportHandler(not_null<PeerData*> peer) {
|
|||
) | rpl::start_with_next([=] {
|
||||
Expects(!peer->isUser());
|
||||
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto callback = crl::guard(&_bar, [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
const auto callback = crl::guard(&_bar, [=](Fn<void()> &&close) {
|
||||
close();
|
||||
|
||||
peer->session().api().request(MTPmessages_ReportSpam(
|
||||
peer->input
|
||||
|
|
|
@ -344,12 +344,11 @@ void CodeWidget::gotPassword(const MTPaccount_Password &result) {
|
|||
_code->setFocus();
|
||||
return;
|
||||
} else if (!getData()->pwdRequest) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto callback = [=] {
|
||||
const auto callback = [=](Fn<void()> &&close) {
|
||||
Core::UpdateApplication();
|
||||
if (*box) (*box)->closeBox();
|
||||
close();
|
||||
};
|
||||
*box = Ui::show(Box<ConfirmBox>(
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
tr::lng_passport_app_out_of_date(tr::now),
|
||||
tr::lng_menu_update(tr::now),
|
||||
callback));
|
||||
|
|
|
@ -346,14 +346,11 @@ void PasswordCheckWidget::submit() {
|
|||
});
|
||||
|
||||
if (_notEmptyPassport) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto confirmed = [=] {
|
||||
const auto confirmed = [=](Fn<void()> &&close) {
|
||||
send();
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
close();
|
||||
};
|
||||
*box = Ui::show(Box<ConfirmBox>(
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
tr::lng_cloud_password_passport_losing(tr::now),
|
||||
tr::lng_continue(tr::now),
|
||||
confirmed));
|
||||
|
|
|
@ -394,12 +394,11 @@ void QrWidget::sendCheckPasswordRequest() {
|
|||
goReplace<QrWidget>(Animate::Forward);
|
||||
return;
|
||||
} else if (!getData()->pwdRequest) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto callback = [=] {
|
||||
const auto callback = [=](Fn<void()> &&close) {
|
||||
Core::UpdateApplication();
|
||||
if (*box) (*box)->closeBox();
|
||||
close();
|
||||
};
|
||||
*box = Ui::show(Box<ConfirmBox>(
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
tr::lng_passport_app_out_of_date(tr::now),
|
||||
tr::lng_menu_update(tr::now),
|
||||
callback));
|
||||
|
|
|
@ -713,11 +713,10 @@ void PanelController::setupPassword() {
|
|||
}
|
||||
|
||||
void PanelController::cancelPasswordSubmit() {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
*box = show(Box<ConfirmBox>(
|
||||
show(Box<ConfirmBox>(
|
||||
tr::lng_passport_stop_password_sure(tr::now),
|
||||
tr::lng_passport_stop(tr::now),
|
||||
[=] { if (*box) (*box)->closeBox(); _form->cancelPassword(); }));
|
||||
[=](Fn<void()> &&close) { close(); _form->cancelPassword(); }));
|
||||
}
|
||||
|
||||
void PanelController::validateRecoveryEmail() {
|
||||
|
|
|
@ -514,11 +514,11 @@ void LastSeenPrivacyController::confirmSave(
|
|||
FnMut<void()> saveCallback) {
|
||||
if (someAreDisallowed && !Core::App().settings().lastSeenWarningSeen()) {
|
||||
const auto session = _session;
|
||||
auto weakBox = std::make_shared<QPointer<ConfirmBox>>();
|
||||
auto callback = [=, saveCallback = std::move(saveCallback)]() mutable {
|
||||
if (auto box = *weakBox) {
|
||||
box->closeBox();
|
||||
}
|
||||
auto callback = [
|
||||
=,
|
||||
saveCallback = std::move(saveCallback)
|
||||
](Fn<void()> &&close) mutable {
|
||||
close();
|
||||
saveCallback();
|
||||
Core::App().settings().setLastSeenWarningSeen(true);
|
||||
Core::App().saveSettingsDelayed();
|
||||
|
@ -528,7 +528,7 @@ void LastSeenPrivacyController::confirmSave(
|
|||
tr::lng_continue(tr::now),
|
||||
tr::lng_cancel(tr::now),
|
||||
std::move(callback));
|
||||
*weakBox = Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||
} else {
|
||||
saveCallback();
|
||||
}
|
||||
|
|
|
@ -640,17 +640,14 @@ void RemoveCloudPassword(not_null<::Main::Session*> session) {
|
|||
}
|
||||
|
||||
object_ptr<Ui::BoxContent> CloudPasswordAppOutdatedBox() {
|
||||
auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto callback = [=] {
|
||||
const auto callback = [=](Fn<void()> &&close) {
|
||||
Core::UpdateApplication();
|
||||
if (*box) (*box)->closeBox();
|
||||
close();
|
||||
};
|
||||
auto result = Box<ConfirmBox>(
|
||||
return Box<ConfirmBox>(
|
||||
tr::lng_passport_app_out_of_date(tr::now),
|
||||
tr::lng_menu_update(tr::now),
|
||||
callback);
|
||||
*box = result.data();
|
||||
return result;
|
||||
}
|
||||
|
||||
void AddPrivacyButton(
|
||||
|
|
|
@ -1321,16 +1321,13 @@ void ToggleNightModeWithConfirmation(
|
|||
if (Background()->nightModeChangeAllowed()) {
|
||||
toggle();
|
||||
} else {
|
||||
const auto box = std::make_shared<QPointer<ConfirmBox>>();
|
||||
const auto disableAndToggle = [=] {
|
||||
const auto disableAndToggle = [=](Fn<void()> &&close) {
|
||||
Core::App().settings().setSystemDarkModeEnabled(false);
|
||||
Core::App().saveSettingsDelayed();
|
||||
toggle();
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
close();
|
||||
};
|
||||
*box = window->show(Box<ConfirmBox>(
|
||||
window->show(Box<ConfirmBox>(
|
||||
tr::lng_settings_auto_night_warning(tr::now),
|
||||
tr::lng_settings_auto_night_disable(tr::now),
|
||||
disableAndToggle));
|
||||
|
|
|
@ -892,15 +892,12 @@ void Editor::closeWithConfirmation() {
|
|||
closeEditor();
|
||||
return;
|
||||
}
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto close = crl::guard(this, [=] {
|
||||
const auto close = crl::guard(this, [=](Fn<void()> &&close) {
|
||||
Background()->clearEditingTheme(ClearEditing::RevertChanges);
|
||||
closeEditor();
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
close();
|
||||
});
|
||||
*box = _window->show(Box<ConfirmBox>(
|
||||
_window->show(Box<ConfirmBox>(
|
||||
tr::lng_theme_editor_sure_close(tr::now),
|
||||
tr::lng_close(tr::now),
|
||||
close));
|
||||
|
|
|
@ -599,11 +599,8 @@ void CloudList::showMenu(Element &element) {
|
|||
}
|
||||
const auto id = cloud.id;
|
||||
_contextMenu->addAction(tr::lng_theme_delete(tr::now), [=] {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
const auto remove = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
const auto remove = [=](Fn<void()> &&close) {
|
||||
close();
|
||||
if (Background()->themeObject().cloud.id == id
|
||||
|| id == kFakeCloudThemeId) {
|
||||
if (Background()->editingTheme().has_value()) {
|
||||
|
@ -618,7 +615,7 @@ void CloudList::showMenu(Element &element) {
|
|||
_window->session().data().cloudThemes().remove(id);
|
||||
}
|
||||
};
|
||||
*box = _window->window().show(Box<ConfirmBox>(
|
||||
_window->window().show(Box<ConfirmBox>(
|
||||
tr::lng_theme_delete_sure(tr::now),
|
||||
tr::lng_theme_delete(tr::now),
|
||||
remove));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -321,11 +321,10 @@ void FiltersMenu::showEditBox(FilterId id) {
|
|||
}
|
||||
|
||||
void FiltersMenu::showRemoveBox(FilterId id) {
|
||||
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
*box = _session->window().show(Box<ConfirmBox>(
|
||||
_session->window().show(Box<ConfirmBox>(
|
||||
tr::lng_filters_remove_sure(tr::now),
|
||||
tr::lng_filters_remove_yes(tr::now),
|
||||
[=] { (*box)->closeBox(); remove(id); }));
|
||||
[=](Fn<void()> &&close) { close(); remove(id); }));
|
||||
}
|
||||
|
||||
void FiltersMenu::remove(FilterId id) {
|
||||
|
|
|
@ -281,14 +281,11 @@ void MainMenu::AccountButton::contextMenuEvent(QContextMenuEvent *e) {
|
|||
}));
|
||||
_menu->addAction(tr::lng_settings_logout(tr::now), crl::guard(this, [=] {
|
||||
const auto session = _session;
|
||||
const auto box = std::make_shared<QPointer<ConfirmBox>>();
|
||||
const auto callback = [=] {
|
||||
if (*box) {
|
||||
(*box)->closeBox();
|
||||
}
|
||||
const auto callback = [=](Fn<void()> &&close) {
|
||||
close();
|
||||
Core::App().logout(&session->account());
|
||||
};
|
||||
*box = Ui::show(Box<ConfirmBox>(
|
||||
Ui::show(Box<ConfirmBox>(
|
||||
tr::lng_sure_logout(tr::now),
|
||||
tr::lng_settings_logout(tr::now),
|
||||
st::attentionBoxButton,
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue