Load gift themes while scrolling.

This commit is contained in:
John Preston
2025-08-29 16:29:59 +04:00
parent e876a0f6bd
commit 1dc70d5a8d
2 changed files with 7 additions and 0 deletions
@@ -560,6 +560,10 @@ void ChooseThemeController::updateInnerLeft(int now) {
? (skip / 2)
: std::clamp(now, skip, 0);
_inner->move(clamped, 0);
const auto visibleTill = -clamped + _content->width();
if (_giftsFinishAt - visibleTill < _content->width()) {
_peer->owner().cloudThemes().myGiftThemesLoadMore();
}
}
void ChooseThemeController::close() {
@@ -734,6 +738,7 @@ void ChooseThemeController::fill(
x += single.width() + skip;
};
_giftsFinishAt = 0;
if (const auto now = cloudThemes->themeForToken(initial)) {
push(*now, initial);
}
@@ -741,6 +746,7 @@ void ChooseThemeController::fill(
if (const auto found = cloudThemes->themeForToken(token)) {
if (token != initial) {
push(*found, token);
_giftsFinishAt = x;
}
}
}
@@ -73,6 +73,7 @@ private:
std::optional<QPoint> _pressPosition;
std::optional<QPoint> _dragStartPosition;
int _dragStartInnerLeft = 0;
int _giftsFinishAt = 0;
bool _initialInnerLeftApplied = false;
rpl::variable<bool> _shouldBeShown = false;