mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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);
|
_topShadow->setVisible(params.withTopBarShadow ? false : true);
|
||||||
_preserveScrollTop = false;
|
_preserveScrollTop = false;
|
||||||
|
_stickerToast = nullptr;
|
||||||
|
|
||||||
_cacheOver = controller()->content()->grabForShowAnimation(params);
|
_cacheOver = controller()->content()->grabForShowAnimation(params);
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,12 @@ StickerToast::StickerToast(
|
||||||
|
|
||||||
StickerToast::~StickerToast() {
|
StickerToast::~StickerToast() {
|
||||||
cancelRequest();
|
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) {
|
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.setLeft(skip + size + skip);
|
||||||
_st.padding.setRight(st::historyPremiumViewSet.font->width(view)
|
_st.padding.setRight(st::historyPremiumViewSet.font->width(view)
|
||||||
- st::historyPremiumViewSet.width);
|
- st::historyPremiumViewSet.width);
|
||||||
|
|
||||||
|
clearHiddenHiding();
|
||||||
|
if (_weak.get()) {
|
||||||
|
_hiding.push_back(_weak);
|
||||||
|
}
|
||||||
|
|
||||||
_weak = Ui::Toast::Show(_parent, Ui::Toast::Config{
|
_weak = Ui::Toast::Show(_parent, Ui::Toast::Config{
|
||||||
.text = text,
|
.text = text,
|
||||||
.st = &_st,
|
.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(
|
void StickerToast::setupEmojiPreview(
|
||||||
not_null<Ui::RpWidget*> widget,
|
not_null<Ui::RpWidget*> widget,
|
||||||
int size) {
|
int size) {
|
||||||
|
|
|
@ -42,11 +42,13 @@ private:
|
||||||
|
|
||||||
void setupEmojiPreview(not_null<Ui::RpWidget*> widget, int size);
|
void setupEmojiPreview(not_null<Ui::RpWidget*> widget, int size);
|
||||||
void setupLottiePreview(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<Window::SessionController*> _controller;
|
||||||
const not_null<QWidget*> _parent;
|
const not_null<QWidget*> _parent;
|
||||||
style::Toast _st;
|
style::Toast _st;
|
||||||
base::weak_ptr<Ui::Toast::Instance> _weak;
|
base::weak_ptr<Ui::Toast::Instance> _weak;
|
||||||
|
std::vector<base::weak_ptr<Ui::Toast::Instance>> _hiding;
|
||||||
DocumentData *_for = nullptr;
|
DocumentData *_for = nullptr;
|
||||||
Fn<void()> _destroy;
|
Fn<void()> _destroy;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue