mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Update pinned icon in stories list.
This commit is contained in:
parent
9036e9e8e3
commit
645ad5e1bd
4 changed files with 32 additions and 3 deletions
|
@ -1358,6 +1358,11 @@ bool HistoryItem::markContentsRead(bool fromThisClient) {
|
|||
|
||||
void HistoryItem::setIsPinned(bool pinned) {
|
||||
const auto changed = (isPinned() != pinned);
|
||||
const auto guard = gsl::finally([&] {
|
||||
if (changed) {
|
||||
_history->owner().notifyItemDataChange(this);
|
||||
}
|
||||
});
|
||||
if (pinned) {
|
||||
_flags |= MessageFlag::Pinned;
|
||||
if (_flags & MessageFlag::StoryItem) {
|
||||
|
@ -1392,9 +1397,6 @@ void HistoryItem::setIsPinned(bool pinned) {
|
|||
Storage::SharedMediaType::Pinned,
|
||||
id));
|
||||
}
|
||||
if (changed) {
|
||||
_history->owner().notifyItemDataChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryItem::returnSavedMedia() {
|
||||
|
|
|
@ -233,6 +233,13 @@ void ListWidget::subscribeToSession(
|
|||
) | rpl::start_with_next([this](auto item) {
|
||||
repaintItem(item);
|
||||
}, lifetime);
|
||||
|
||||
session->data().itemDataChanges(
|
||||
) | rpl::start_with_next([=](not_null<HistoryItem*> item) {
|
||||
if (const auto found = findItemByItem(item)) {
|
||||
found->layout->itemDataChanged();
|
||||
}
|
||||
}, lifetime);
|
||||
}
|
||||
|
||||
void ListWidget::setupSelectRestriction() {
|
||||
|
|
|
@ -460,6 +460,14 @@ void Photo::clearSpoiler() {
|
|||
}
|
||||
}
|
||||
|
||||
void Photo::itemDataChanged() {
|
||||
const auto pinned = parent()->isPinned();
|
||||
if (_pinned != pinned) {
|
||||
_pinned = pinned;
|
||||
delegate()->repaintItem(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Photo::clearHeavyPart() {
|
||||
_dataMedia = nullptr;
|
||||
}
|
||||
|
@ -637,6 +645,14 @@ void Video::clearSpoiler() {
|
|||
}
|
||||
}
|
||||
|
||||
void Video::itemDataChanged() {
|
||||
const auto pinned = parent()->isPinned();
|
||||
if (_pinned != pinned) {
|
||||
_pinned = pinned;
|
||||
delegate()->repaintItem(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Video::clearHeavyPart() {
|
||||
_dataMedia = nullptr;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ public:
|
|||
|
||||
void invalidateCache();
|
||||
|
||||
virtual void itemDataChanged() {
|
||||
}
|
||||
virtual void clearHeavyPart() {
|
||||
}
|
||||
|
||||
|
@ -205,6 +207,7 @@ public:
|
|||
QPoint point,
|
||||
StateRequest request) const override;
|
||||
|
||||
void itemDataChanged() override;
|
||||
void clearHeavyPart() override;
|
||||
|
||||
private:
|
||||
|
@ -298,6 +301,7 @@ public:
|
|||
QPoint point,
|
||||
StateRequest request) const override;
|
||||
|
||||
void itemDataChanged() override;
|
||||
void clearHeavyPart() override;
|
||||
void clearSpoiler() override;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue