mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Fix repainting of non-first file album item.
This commit is contained in:
parent
fcdc39c5f9
commit
fc4ed2ff91
3 changed files with 21 additions and 7 deletions
|
@ -21,7 +21,7 @@ constexpr auto kMaxItemsInGroup = 10;
|
|||
Groups::Groups(not_null<Session*> data) : _data(data) {
|
||||
}
|
||||
|
||||
bool Groups::isGrouped(not_null<HistoryItem*> item) const {
|
||||
bool Groups::isGrouped(not_null<const HistoryItem*> item) const {
|
||||
if (!item->groupId()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ HistoryItemsList::const_iterator Groups::findPositionForItem(
|
|||
return last;
|
||||
}
|
||||
|
||||
const Group *Groups::find(not_null<HistoryItem*> item) const {
|
||||
const Group *Groups::find(not_null<const HistoryItem*> item) const {
|
||||
const auto groupId = item->groupId();
|
||||
if (!groupId) {
|
||||
return nullptr;
|
||||
|
|
|
@ -22,14 +22,14 @@ class Groups {
|
|||
public:
|
||||
Groups(not_null<Session*> data);
|
||||
|
||||
bool isGrouped(not_null<HistoryItem*> item) const;
|
||||
[[nodiscard]] bool isGrouped(not_null<const HistoryItem*> item) const;
|
||||
void registerMessage(not_null<HistoryItem*> item);
|
||||
void unregisterMessage(not_null<const HistoryItem*> item);
|
||||
void refreshMessage(
|
||||
not_null<HistoryItem*> item,
|
||||
bool justRefreshViews = false);
|
||||
|
||||
const Group *find(not_null<HistoryItem*> item) const;
|
||||
[[nodiscard]] const Group *find(not_null<const HistoryItem*> item) const;
|
||||
|
||||
not_null<HistoryItem*> findItemToEdit(not_null<HistoryItem*> item) const;
|
||||
|
||||
|
|
|
@ -1417,9 +1417,23 @@ rpl::producer<Session::IdChange> Session::itemIdChanged() const {
|
|||
|
||||
void Session::requestItemRepaint(not_null<const HistoryItem*> item) {
|
||||
_itemRepaintRequest.fire_copy(item);
|
||||
enumerateItemViews(item, [&](not_null<const ViewElement*> view) {
|
||||
requestViewRepaint(view);
|
||||
});
|
||||
auto repaintGroupLeader = false;
|
||||
auto repaintView = [&](not_null<const ViewElement*> view) {
|
||||
if (view->isHiddenByGroup()) {
|
||||
repaintGroupLeader = true;
|
||||
} else {
|
||||
requestViewRepaint(view);
|
||||
}
|
||||
};
|
||||
enumerateItemViews(item, repaintView);
|
||||
if (repaintGroupLeader) {
|
||||
if (const auto group = groups().find(item)) {
|
||||
const auto leader = group->items.front();
|
||||
if (leader != item) {
|
||||
enumerateItemViews(leader, repaintView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rpl::producer<not_null<const HistoryItem*>> Session::itemRepaintRequest() const {
|
||||
|
|
Loading…
Add table
Reference in a new issue