mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix toast hiding on jump to Saved Messages.
This commit is contained in:
parent
c8ec183c88
commit
4bdac53be2
3 changed files with 24 additions and 0 deletions
|
@ -3977,6 +3977,7 @@ void HistoryWidget::showAnimated(
|
|||
}
|
||||
_topShadow->setVisible(params.withTopBarShadow ? false : true);
|
||||
_preserveScrollTop = false;
|
||||
_stickerToast = nullptr;
|
||||
|
||||
_cacheOver = controller()->content()->grabForShowAnimation(params);
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@ StickerToast::StickerToast(
|
|||
|
||||
StickerToast::~StickerToast() {
|
||||
cancelRequest();
|
||||
_hiding.push_back(_weak);
|
||||
for (const auto &weak : base::take(_hiding)) {
|
||||
if (const auto strong = weak.get()) {
|
||||
delete strong->widget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StickerToast::showFor(not_null<DocumentData*> document) {
|
||||
|
@ -143,6 +149,12 @@ void StickerToast::showWithTitle(const QString &title) {
|
|||
_st.padding.setLeft(skip + size + skip);
|
||||
_st.padding.setRight(st::historyPremiumViewSet.font->width(view)
|
||||
- st::historyPremiumViewSet.width);
|
||||
|
||||
clearHiddenHiding();
|
||||
if (_weak.get()) {
|
||||
_hiding.push_back(_weak);
|
||||
}
|
||||
|
||||
_weak = Ui::Toast::Show(_parent, Ui::Toast::Config{
|
||||
.text = text,
|
||||
.st = &_st,
|
||||
|
@ -226,6 +238,15 @@ void StickerToast::showWithTitle(const QString &title) {
|
|||
});
|
||||
}
|
||||
|
||||
void StickerToast::clearHiddenHiding() {
|
||||
_hiding.erase(
|
||||
ranges::remove(
|
||||
_hiding,
|
||||
nullptr,
|
||||
&base::weak_ptr<Ui::Toast::Instance>::get),
|
||||
end(_hiding));
|
||||
}
|
||||
|
||||
void StickerToast::setupEmojiPreview(
|
||||
not_null<Ui::RpWidget*> widget,
|
||||
int size) {
|
||||
|
|
|
@ -42,11 +42,13 @@ private:
|
|||
|
||||
void setupEmojiPreview(not_null<Ui::RpWidget*> widget, int size);
|
||||
void setupLottiePreview(not_null<Ui::RpWidget*> widget, int size);
|
||||
void clearHiddenHiding();
|
||||
|
||||
const not_null<Window::SessionController*> _controller;
|
||||
const not_null<QWidget*> _parent;
|
||||
style::Toast _st;
|
||||
base::weak_ptr<Ui::Toast::Instance> _weak;
|
||||
std::vector<base::weak_ptr<Ui::Toast::Instance>> _hiding;
|
||||
DocumentData *_for = nullptr;
|
||||
Fn<void()> _destroy;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue