mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-29 15:01:03 +00:00
Mark history as having pending resized items.
This commit is contained in:
parent
d4f4698c69
commit
20889d7003
@ -1525,43 +1525,18 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto firstAdded = (HistoryItem*)nullptr;
|
||||
auto lastAdded = (HistoryItem*)nullptr;
|
||||
|
||||
auto logged = QStringList();
|
||||
logged.push_back(QString::number(minMsgId()));
|
||||
logged.push_back(QString::number(maxMsgId()));
|
||||
|
||||
if (const auto added = createItems(slice); !added.empty()) {
|
||||
auto minAdded = -1;
|
||||
auto maxAdded = -1;
|
||||
|
||||
startBuildingFrontBlock(added.size());
|
||||
for (const auto item : added) {
|
||||
addItemToBlock(item);
|
||||
if (minAdded < 0 || minAdded > item->id) {
|
||||
minAdded = item->id;
|
||||
}
|
||||
if (maxAdded < 0 || maxAdded < item->id) {
|
||||
maxAdded = item->id;
|
||||
}
|
||||
}
|
||||
auto block = finishBuildingFrontBlock();
|
||||
finishBuildingFrontBlock();
|
||||
|
||||
if (loadedAtBottom()) {
|
||||
// Add photos to overview and authors to lastAuthors.
|
||||
addItemsToLists(added);
|
||||
}
|
||||
|
||||
logged.push_back(QString::number(minAdded));
|
||||
logged.push_back(QString::number(maxAdded));
|
||||
CrashReports::SetAnnotation(
|
||||
"old_minmaxwas_minmaxadd",
|
||||
logged.join(";"));
|
||||
|
||||
addToSharedMedia(added);
|
||||
|
||||
CrashReports::ClearAnnotation("old_minmaxwas_minmaxadd");
|
||||
} else {
|
||||
// If no items were added it means we've loaded everything old.
|
||||
oldLoaded = true;
|
||||
@ -1588,32 +1563,11 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
|
||||
if (const auto added = createItems(slice); !added.empty()) {
|
||||
Assert(!isBuildingFrontBlock());
|
||||
|
||||
auto logged = QStringList();
|
||||
logged.push_back(QString::number(minMsgId()));
|
||||
logged.push_back(QString::number(maxMsgId()));
|
||||
|
||||
auto minAdded = -1;
|
||||
auto maxAdded = -1;
|
||||
|
||||
for (const auto item : added) {
|
||||
addItemToBlock(item);
|
||||
if (minAdded < 0 || minAdded > item->id) {
|
||||
minAdded = item->id;
|
||||
}
|
||||
if (maxAdded < 0 || maxAdded < item->id) {
|
||||
maxAdded = item->id;
|
||||
}
|
||||
}
|
||||
|
||||
logged.push_back(QString::number(minAdded));
|
||||
logged.push_back(QString::number(maxAdded));
|
||||
CrashReports::SetAnnotation(
|
||||
"new_minmaxwas_minmaxadd",
|
||||
logged.join(";"));
|
||||
|
||||
addToSharedMedia(added);
|
||||
|
||||
CrashReports::ClearAnnotation("new_minmaxwas_minmaxadd");
|
||||
} else {
|
||||
newLoaded = true;
|
||||
setLastMessage(lastAvailableMessage());
|
||||
@ -2153,12 +2107,11 @@ void History::startBuildingFrontBlock(int expectedItemsCount) {
|
||||
_buildingFrontBlock->expectedItemsCount = expectedItemsCount;
|
||||
}
|
||||
|
||||
HistoryBlock *History::finishBuildingFrontBlock() {
|
||||
Assert(isBuildingFrontBlock());
|
||||
void History::finishBuildingFrontBlock() {
|
||||
Expects(isBuildingFrontBlock());
|
||||
|
||||
// Some checks if there was some message history already
|
||||
auto block = _buildingFrontBlock->block;
|
||||
if (block) {
|
||||
if (const auto block = base::take(_buildingFrontBlock)->block) {
|
||||
if (blocks.size() > 1) {
|
||||
// ... item, item, item, last ], [ first, item, item ...
|
||||
const auto last = block->messages.back().get();
|
||||
@ -2171,9 +2124,6 @@ HistoryBlock *History::finishBuildingFrontBlock() {
|
||||
block->messages.back()->nextInBlocksRemoved();
|
||||
}
|
||||
}
|
||||
|
||||
_buildingFrontBlock = nullptr;
|
||||
return block;
|
||||
}
|
||||
|
||||
void History::clearNotifications() {
|
||||
|
@ -424,7 +424,7 @@ protected:
|
||||
// Only when we scroll up and add a new slice to the
|
||||
// front we want to create a new front block.
|
||||
void startBuildingFrontBlock(int expectedItemsCount = 1);
|
||||
HistoryBlock *finishBuildingFrontBlock(); // Returns the built block or nullptr if nothing was added.
|
||||
void finishBuildingFrontBlock();
|
||||
bool isBuildingFrontBlock() const {
|
||||
return _buildingFrontBlock != nullptr;
|
||||
}
|
||||
|
@ -253,12 +253,38 @@ void HistoryInner::enumerateItemsInHistory(History *history, int historytop, Met
|
||||
for (const auto &logBlock : history->blocks) {
|
||||
QStringList debugItems;
|
||||
for (const auto &logItem : logBlock->messages) {
|
||||
debugItems.push_back(QString("%1,%2").arg(logItem->y()).arg(logItem->height()));
|
||||
debugItems.push_back(QString("%1,%2"
|
||||
).arg(logItem->y()
|
||||
).arg(logItem->height()
|
||||
));
|
||||
}
|
||||
debug.push_back(QString("b(%1,%2:%3)").arg(logBlock->y()).arg(logBlock->height()).arg(debugItems.join(';')));
|
||||
debug.push_back(QString("b(%1,%2:%3)"
|
||||
).arg(logBlock->y()
|
||||
).arg(logBlock->height()
|
||||
).arg(debugItems.join(';')
|
||||
));
|
||||
}
|
||||
CrashReports::SetAnnotation("geometry", QString("height:%1 ").arg(history->height()) + debug.join(';'));
|
||||
CrashReports::SetAnnotation("info", QString("block:%1(%2,%3), item:%4(%5,%6), limits:%7,%8").arg(blockIndex).arg(block->y()).arg(block->height()).arg(itemIndex).arg(view->y()).arg(view->height()).arg(_visibleAreaTop).arg(_visibleAreaBottom));
|
||||
CrashReports::SetAnnotation(
|
||||
"geometry",
|
||||
QString("height:%1 "
|
||||
).arg(history->height()
|
||||
) + debug.join(';'));
|
||||
CrashReports::SetAnnotation(
|
||||
"info",
|
||||
QString("block:%1(%2,%3), "
|
||||
"item:%4(%5,%6), "
|
||||
"limits:%7,%8, "
|
||||
"has:%9"
|
||||
).arg(blockIndex
|
||||
).arg(block->y()
|
||||
).arg(block->height()
|
||||
).arg(itemIndex
|
||||
).arg(view->y()
|
||||
).arg(view->height()
|
||||
).arg(_visibleAreaTop
|
||||
).arg(_visibleAreaBottom
|
||||
).arg(Logs::b(history->hasPendingResizedItems())
|
||||
));
|
||||
Unexpected("itembottom > _visibleAreaTop");
|
||||
}
|
||||
Assert(itembottom > _visibleAreaTop);
|
||||
|
@ -137,6 +137,9 @@ Element::Element(
|
||||
, _context(delegate->elementContext()) {
|
||||
Auth().data().registerItemView(this);
|
||||
refreshMedia();
|
||||
if (_context == Context::History) {
|
||||
_data->_history->setHasPendingResizedItems();
|
||||
}
|
||||
}
|
||||
|
||||
not_null<ElementDelegate*> Element::delegate() const {
|
||||
|
Loading…
Reference in New Issue
Block a user