mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Added auto-closing to some boxes which depend on certain message.
This commit is contained in:
parent
bc7975ece7
commit
bc8f8bc68c
4 changed files with 23 additions and 1 deletions
|
@ -363,6 +363,12 @@ EditCaptionBox::EditCaptionBox(
|
||||||
) | rpl::start_with_next([&](bool checked) {
|
) | rpl::start_with_next([&](bool checked) {
|
||||||
_asFile = checked;
|
_asFile = checked;
|
||||||
}, _wayWrap->lifetime());
|
}, _wayWrap->lifetime());
|
||||||
|
|
||||||
|
_controller->session().data().itemRemoved(
|
||||||
|
_msgId
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
closeBox();
|
||||||
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
EditCaptionBox::~EditCaptionBox() = default;
|
EditCaptionBox::~EditCaptionBox() = default;
|
||||||
|
|
|
@ -1428,6 +1428,14 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved() const {
|
||||||
return _itemRemoved.events();
|
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) {
|
void Session::notifyViewRemoved(not_null<const ViewElement*> view) {
|
||||||
_viewRemoved.fire_copy(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 History*>> historyUnloaded() const;
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<not_null<const HistoryItem*>> itemRemoved() 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);
|
void notifyViewRemoved(not_null<const ViewElement*> view);
|
||||||
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewRemoved() const;
|
[[nodiscard]] rpl::producer<not_null<const ViewElement*>> viewRemoved() const;
|
||||||
void notifyHistoryCleared(not_null<const History*> history);
|
void notifyHistoryCleared(not_null<const History*> history);
|
||||||
|
|
|
@ -453,13 +453,19 @@ bool AddRescheduleMessageAction(
|
||||||
? HistoryView::DefaultScheduleTime()
|
? HistoryView::DefaultScheduleTime()
|
||||||
: item->date() + 600;
|
: item->date() + 600;
|
||||||
|
|
||||||
Ui::show(
|
const auto box = Ui::show(
|
||||||
HistoryView::PrepareScheduleBox(
|
HistoryView::PrepareScheduleBox(
|
||||||
&request.navigation->session(),
|
&request.navigation->session(),
|
||||||
sendMenuType,
|
sendMenuType,
|
||||||
callback,
|
callback,
|
||||||
date),
|
date),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
|
|
||||||
|
owner->itemRemoved(
|
||||||
|
itemId
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
box->closeBox();
|
||||||
|
}, box->lifetime());
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue