mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-03 16:05:57 +00:00
Preload complex last message on demand.
This commit is contained in:
@@ -2506,7 +2506,7 @@ void InnerWidget::visibleTopBottomUpdated(
|
||||
int visibleBottom) {
|
||||
_visibleTop = visibleTop;
|
||||
_visibleBottom = visibleBottom;
|
||||
loadPeerPhotos();
|
||||
preloadRowsData();
|
||||
const auto loadTill = _visibleTop
|
||||
+ PreloadHeightsCount * (_visibleBottom - _visibleTop);
|
||||
if (_state == WidgetState::Filtered && loadTill >= peerSearchOffset()) {
|
||||
@@ -2726,7 +2726,7 @@ void InnerWidget::refresh(bool toTop) {
|
||||
if (toTop) {
|
||||
stopReorderPinned();
|
||||
_mustScrollTo.fire({ 0, 0 });
|
||||
loadPeerPhotos();
|
||||
preloadRowsData();
|
||||
}
|
||||
_controller->setDialogsListDisplayForced(
|
||||
_searchInChat || !_filter.isEmpty());
|
||||
@@ -3115,8 +3115,10 @@ void InnerWidget::scrollToDefaultSelected() {
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::loadPeerPhotos() {
|
||||
if (!parentWidget()) return;
|
||||
void InnerWidget::preloadRowsData() {
|
||||
if (!parentWidget()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto yFrom = _visibleTop;
|
||||
auto yTo = _visibleTop + (_visibleBottom - _visibleTop) * (PreloadHeightsCount + 1);
|
||||
@@ -3129,7 +3131,7 @@ void InnerWidget::loadPeerPhotos() {
|
||||
if (((*i)->index() * _st->height) >= yTo) {
|
||||
break;
|
||||
}
|
||||
(*i)->entry()->loadUserpic();
|
||||
(*i)->entry()->chatListPreloadData();
|
||||
}
|
||||
yFrom = 0;
|
||||
} else {
|
||||
@@ -3144,7 +3146,7 @@ void InnerWidget::loadPeerPhotos() {
|
||||
if (to > _filterResults.size()) to = _filterResults.size();
|
||||
|
||||
for (; from < to; ++from) {
|
||||
_filterResults[from].key().entry()->loadUserpic();
|
||||
_filterResults[from].key().entry()->chatListPreloadData();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user