mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
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()) {
|
if (!item->groupId()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ HistoryItemsList::const_iterator Groups::findPositionForItem(
|
||||||
return last;
|
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();
|
const auto groupId = item->groupId();
|
||||||
if (!groupId) {
|
if (!groupId) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -22,14 +22,14 @@ class Groups {
|
||||||
public:
|
public:
|
||||||
Groups(not_null<Session*> data);
|
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 registerMessage(not_null<HistoryItem*> item);
|
||||||
void unregisterMessage(not_null<const HistoryItem*> item);
|
void unregisterMessage(not_null<const HistoryItem*> item);
|
||||||
void refreshMessage(
|
void refreshMessage(
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
bool justRefreshViews = false);
|
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;
|
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) {
|
void Session::requestItemRepaint(not_null<const HistoryItem*> item) {
|
||||||
_itemRepaintRequest.fire_copy(item);
|
_itemRepaintRequest.fire_copy(item);
|
||||||
enumerateItemViews(item, [&](not_null<const ViewElement*> view) {
|
auto repaintGroupLeader = false;
|
||||||
requestViewRepaint(view);
|
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 {
|
rpl::producer<not_null<const HistoryItem*>> Session::itemRepaintRequest() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue