Added auto-closing to some boxes which depend on certain message.
This commit is contained in:
parent
bc7975ece7
commit
bc8f8bc68c
|
@ -363,6 +363,12 @@ EditCaptionBox::EditCaptionBox(
|
|||
) | rpl::start_with_next([&](bool checked) {
|
||||
_asFile = checked;
|
||||
}, _wayWrap->lifetime());
|
||||
|
||||
_controller->session().data().itemRemoved(
|
||||
_msgId
|
||||
) | rpl::start_with_next([=] {
|
||||
closeBox();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
EditCaptionBox::~EditCaptionBox() = default;
|
||||
|
|
|
@ -1428,6 +1428,14 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved() const {
|
|||
return _itemRemoved.events();
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved(
|
||||
FullMsgId itemId) const {
|
||||
return itemRemoved(
|
||||
) | rpl::filter([=](not_null<const HistoryItem*> item) {
|
||||
return (itemId == item->fullId());
|
||||
});
|
||||
}
|
||||
|
||||
void Session::notifyViewRemoved(not_null<const ViewElement*> view) {
|
||||
_viewRemoved.fire_copy(view);
|
||||
}
|
||||
|
|
|
@ -231,6 +231,8 @@ public:
|
|||
[[nodiscard]] rpl::producer<not_null<const History*>> historyUnloaded() const;
|
||||
|
||||
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRemoved() const;
|
||||
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRemoved(
|
||||
FullMsgId itemId) const;
|
||||
void notifyViewRemoved(not_null<const ViewElement*> view);
|
||||
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewRemoved() const;
|
||||
void notifyHistoryCleared(not_null<const History*> history);
|
||||
|
|
|
@ -453,13 +453,19 @@ bool AddRescheduleMessageAction(
|
|||
? HistoryView::DefaultScheduleTime()
|
||||
: item->date() + 600;
|
||||
|
||||
Ui::show(
|
||||
const auto box = Ui::show(
|
||||
HistoryView::PrepareScheduleBox(
|
||||
&request.navigation->session(),
|
||||
sendMenuType,
|
||||
callback,
|
||||
date),
|
||||
Ui::LayerOption::KeepOther);
|
||||
|
||||
owner->itemRemoved(
|
||||
itemId
|
||||
) | rpl::start_with_next([=] {
|
||||
box->closeBox();
|
||||
}, box->lifetime());
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue