Close PiP if message with video gets deleted.

This commit is contained in:
John Preston 2022-12-30 14:26:43 +04:00
parent 0ce01410a1
commit cabed9587b
1 changed files with 11 additions and 0 deletions

View File

@ -254,6 +254,7 @@ struct OverlayWidget::PipWrap {
PipDelegate delegate;
Pip wrapped;
rpl::lifetime lifetime;
};
OverlayWidget::Streamed::Streamed(
@ -3352,6 +3353,16 @@ void OverlayWidget::switchToPip() {
_streamed->instance.shared(),
closeAndContinue,
[=] { _pip = nullptr; });
if (const auto raw = _message) {
raw->history()->owner().itemRemoved(
) | rpl::filter([=](not_null<const HistoryItem*> item) {
return (raw == item);
}) | rpl::start_with_next([=] {
_pip = nullptr;
}, _pip->lifetime);
}
if (isHidden()) {
clearBeforeHide();
clearAfterHide();