Don't close schedule media box by outside click.

This commit is contained in:
John Preston 2023-11-06 12:47:37 +04:00
parent e98f56b0b7
commit 61a9d9c01d
5 changed files with 12 additions and 12 deletions

View File

@ -427,6 +427,7 @@ void SendFilesBox::prepare() {
preparePreview(); preparePreview();
initPreview(); initPreview();
SetupShadowsToScrollContent(this, _scroll, _inner->heightValue()); SetupShadowsToScrollContent(this, _scroll, _inner->heightValue());
setCloseByOutsideClick(false);
boxClosing() | rpl::start_with_next([=] { boxClosing() | rpl::start_with_next([=] {
if (!_confirmed && _cancelledCallback) { if (!_confirmed && _cancelledCallback) {
@ -1437,7 +1438,12 @@ void SendFilesBox::sendScheduled() {
? SendMenu::Type::ScheduledToUser ? SendMenu::Type::ScheduledToUser
: _sendMenuType; : _sendMenuType;
const auto callback = [=](Api::SendOptions options) { send(options); }; const auto callback = [=](Api::SendOptions options) { send(options); };
_show->showBox(HistoryView::PrepareScheduleBox(this, type, callback)); auto box = HistoryView::PrepareScheduleBox(this, type, callback);
const auto weak = Ui::MakeWeak(box.data());
_show->showBox(std::move(box));
if (const auto strong = weak.data()) {
strong->setCloseByOutsideClick(false);
}
} }
void SendFilesBox::sendWhenOnline() { void SendFilesBox::sendWhenOnline() {

View File

@ -5370,8 +5370,7 @@ bool HistoryWidget::confirmSendingFiles(
})); }));
Window::ActivateWindow(controller()); Window::ActivateWindow(controller());
const auto shown = controller()->show(std::move(box)); controller()->show(std::move(box));
shown->setCloseByOutsideClick(false);
return true; return true;
} }

View File

@ -972,8 +972,7 @@ bool RepliesWidget::confirmSendingFiles(
insertTextOnCancel)); insertTextOnCancel));
//ActivateWindow(controller()); //ActivateWindow(controller());
const auto shown = controller()->show(std::move(box)); controller()->show(std::move(box));
shown->setCloseByOutsideClick(false);
return true; return true;
} }

View File

@ -429,8 +429,7 @@ bool ScheduledWidget::confirmSendingFiles(
insertTextOnCancel)); insertTextOnCancel));
//ActivateWindow(controller()); //ActivateWindow(controller());
const auto shown = controller()->show(std::move(box)); controller()->show(std::move(box));
shown->setCloseByOutsideClick(false);
return true; return true;
} }

View File

@ -500,7 +500,7 @@ bool ReplyArea::confirmSendingFiles(
auto confirmed = [=](auto &&...args) { auto confirmed = [=](auto &&...args) {
sendingFilesConfirmed(std::forward<decltype(args)>(args)...); sendingFilesConfirmed(std::forward<decltype(args)>(args)...);
}; };
auto box = Box<SendFilesBox>(SendFilesBoxDescriptor{ show->show(Box<SendFilesBox>(SendFilesBoxDescriptor{
.show = show, .show = show,
.list = std::move(list), .list = std::move(list),
.caption = _controls->getTextWithAppliedMarkdown(), .caption = _controls->getTextWithAppliedMarkdown(),
@ -511,10 +511,7 @@ bool ReplyArea::confirmSendingFiles(
.stOverride = &st::storiesComposeControls, .stOverride = &st::storiesComposeControls,
.confirmed = crl::guard(this, confirmed), .confirmed = crl::guard(this, confirmed),
.cancelled = _controls->restoreTextCallback(insertTextOnCancel), .cancelled = _controls->restoreTextCallback(insertTextOnCancel),
}); }));
if (const auto shown = show->show(std::move(box))) {
shown->setCloseByOutsideClick(false);
}
return true; return true;
} }