mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-30 23:38:25 +00:00
Overview filling fix when you scroll the history down till the bottom.
This commit is contained in:
parent
4cd7a7a695
commit
79eafbe71a
@ -1345,24 +1345,8 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!wasLoadedAtBottom && loadedAtBottom()) { // add all loaded photos to overview
|
||||
int32 mask = 0;
|
||||
for (int32 i = 0; i < OverviewCount; ++i) {
|
||||
if (overviewCountData[i] == 0) continue; // all loaded
|
||||
if (!overview[i].isEmpty() || !overviewIds[i].isEmpty()) {
|
||||
overview[i].clear();
|
||||
overviewIds[i].clear();
|
||||
mask |= (1 << i);
|
||||
}
|
||||
}
|
||||
for_const (HistoryBlock *block, blocks) {
|
||||
for_const (HistoryItem *item, block->items) {
|
||||
mask |= item->addToOverview(AddToOverviewBack);
|
||||
}
|
||||
}
|
||||
for (int32 t = 0; t < OverviewCount; ++t) {
|
||||
if ((mask & (1 << t)) && App::wnd()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(t));
|
||||
}
|
||||
if (!wasLoadedAtBottom) {
|
||||
checkAddAllToOverview();
|
||||
}
|
||||
|
||||
if (isChannel()) asChannelHistory()->checkJoinedMessage();
|
||||
@ -1373,12 +1357,37 @@ void History::checkLastMsg() {
|
||||
if (lastMsg) {
|
||||
if (!newLoaded && !lastMsg->detached()) {
|
||||
newLoaded = true;
|
||||
checkAddAllToOverview();
|
||||
}
|
||||
} else if (newLoaded) {
|
||||
setLastMessage(lastImportantMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void History::checkAddAllToOverview() {
|
||||
if (!loadedAtBottom()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32 mask = 0;
|
||||
for (int32 i = 0; i < OverviewCount; ++i) {
|
||||
if (overviewCountData[i] == 0) continue; // all loaded
|
||||
if (!overview[i].isEmpty() || !overviewIds[i].isEmpty()) {
|
||||
overview[i].clear();
|
||||
overviewIds[i].clear();
|
||||
mask |= (1 << i);
|
||||
}
|
||||
}
|
||||
for_const (HistoryBlock *block, blocks) {
|
||||
for_const (HistoryItem *item, block->items) {
|
||||
mask |= item->addToOverview(AddToOverviewBack);
|
||||
}
|
||||
}
|
||||
for (int32 t = 0; t < OverviewCount; ++t) {
|
||||
if ((mask & (1 << t)) && App::wnd()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(t));
|
||||
}
|
||||
}
|
||||
|
||||
int History::countUnread(MsgId upTo) {
|
||||
int result = 0;
|
||||
for (auto i = blocks.cend(), e = blocks.cbegin(); i != e;) {
|
||||
|
@ -494,6 +494,9 @@ private:
|
||||
// After adding a new history slice check the lastMsg and newLoaded.
|
||||
void checkLastMsg();
|
||||
|
||||
// Add all items to the media overview if we were not loaded at bottom and now are.
|
||||
void checkAddAllToOverview();
|
||||
|
||||
enum class Flag {
|
||||
f_has_pending_resized_items = (1 << 0),
|
||||
f_pending_resize = (1 << 1),
|
||||
|
Loading…
Reference in New Issue
Block a user