mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-05 11:24:21 +00:00
Added invalidation gift button background cache on palette changes.
This commit is contained in:
@@ -159,6 +159,10 @@ GiftButton::GiftButton(
|
||||
: AbstractButton(parent)
|
||||
, _delegate(delegate)
|
||||
, _lockedTimer([=] { refreshLocked(); }) {
|
||||
style::PaletteChanged() | rpl::on_next([=] {
|
||||
_delegate->invalidateCache();
|
||||
update();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
GiftButton::~GiftButton() {
|
||||
@@ -1130,6 +1134,11 @@ bool Delegate::amPremium() {
|
||||
return _session->premium();
|
||||
}
|
||||
|
||||
void Delegate::invalidateCache() {
|
||||
_bg = QImage();
|
||||
_badges.clear();
|
||||
}
|
||||
|
||||
DocumentData *LookupGiftSticker(
|
||||
not_null<Main::Session*> session,
|
||||
const GiftDescriptor &descriptor) {
|
||||
|
||||
@@ -167,6 +167,7 @@ public:
|
||||
[[nodiscard]] virtual not_null<StickerPremiumMark*> hiddenMark() = 0;
|
||||
[[nodiscard]] virtual QImage cachedBadge(const GiftBadge &badge) = 0;
|
||||
[[nodiscard]] virtual bool amPremium() = 0;
|
||||
virtual void invalidateCache() = 0;
|
||||
};
|
||||
|
||||
class GiftButton final : public Ui::AbstractButton {
|
||||
@@ -272,6 +273,7 @@ public:
|
||||
not_null<StickerPremiumMark*> hiddenMark() override;
|
||||
QImage cachedBadge(const GiftBadge &badge) override;
|
||||
bool amPremium() override;
|
||||
void invalidateCache() override;
|
||||
|
||||
private:
|
||||
const not_null<Main::Session*> _session;
|
||||
|
||||
Reference in New Issue
Block a user