mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Overview filling fix when you scroll the history down till the bottom.
This commit is contained in:
parent
4cd7a7a695
commit
79eafbe71a
2 changed files with 30 additions and 18 deletions
|
@ -1345,7 +1345,30 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!wasLoadedAtBottom && loadedAtBottom()) { // add all loaded photos to overview
|
||||
if (!wasLoadedAtBottom) {
|
||||
checkAddAllToOverview();
|
||||
}
|
||||
|
||||
if (isChannel()) asChannelHistory()->checkJoinedMessage();
|
||||
checkLastMsg();
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1363,20 +1386,6 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
|
|||
for (int32 t = 0; t < OverviewCount; ++t) {
|
||||
if ((mask & (1 << t)) && App::wnd()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(t));
|
||||
}
|
||||
}
|
||||
|
||||
if (isChannel()) asChannelHistory()->checkJoinedMessage();
|
||||
checkLastMsg();
|
||||
}
|
||||
|
||||
void History::checkLastMsg() {
|
||||
if (lastMsg) {
|
||||
if (!newLoaded && !lastMsg->detached()) {
|
||||
newLoaded = true;
|
||||
}
|
||||
} else if (newLoaded) {
|
||||
setLastMessage(lastImportantMessage());
|
||||
}
|
||||
}
|
||||
|
||||
int History::countUnread(MsgId upTo) {
|
||||
|
|
|
@ -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…
Add table
Reference in a new issue