Fixed color update of badges in chat filters strip on palette change.

This commit is contained in:
23rd 2025-02-06 22:19:29 +03:00 committed by John Preston
parent 5e2bc337bc
commit b61befa210
2 changed files with 14 additions and 2 deletions

View file

@ -42,6 +42,13 @@ ChatsFiltersTabs::ChatsFiltersTabs(
};
_cachedBadgeHeight = one.height();
}
style::PaletteChanged(
) | rpl::start_with_next([=] {
for (auto &[index, unread] : _unreadCounts) {
unread.cache = cacheUnreadCount(unread.count, unread.muted);
}
update();
}, lifetime());
Ui::DiscreteSlider::setSelectOnPress(false);
}
@ -88,7 +95,11 @@ void ChatsFiltersTabs::setUnreadCount(int index, int unreadCount, bool mute) {
if (unreadCount) {
_unreadCounts.emplace(index, Unread{
.cache = cacheUnreadCount(unreadCount, mute),
.count = unreadCount,
.count = ushort(std::clamp(
unreadCount,
0,
int(std::numeric_limits<ushort>::max()))),
.muted = mute,
});
}
} else {

View file

@ -72,7 +72,8 @@ private:
using Index = int;
struct Unread final {
QImage cache;
int count = 0;
ushort count = 0;
bool muted = false;
};
base::flat_map<Index, Unread> _unreadCounts;
const style::SettingsSlider &_st;