mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Fix pattern caching on themed chat open.
This commit is contained in:
@@ -911,6 +911,7 @@ std::optional<Data::StarGift> FromTL(
|
||||
.starsForResale = FindStarsForResale(data.vresell_amount()),
|
||||
.number = data.vnum().v,
|
||||
.onlyAcceptTon = data.is_resale_ton_only(),
|
||||
.canBeTheme = data.is_theme_available(),
|
||||
.model = *model,
|
||||
.pattern = *pattern,
|
||||
.value = (data.vvalue_amount()
|
||||
|
||||
@@ -67,6 +67,7 @@ struct UniqueGift {
|
||||
int starsForTransfer = -1;
|
||||
int number = 0;
|
||||
bool onlyAcceptTon = false;
|
||||
bool canBeTheme = false;
|
||||
TimeId exportAt = 0;
|
||||
TimeId canTransferAt = 0;
|
||||
TimeId canResellAt = 0;
|
||||
|
||||
@@ -535,7 +535,8 @@ bool ChatTheme::readyForBackgroundRotation() const {
|
||||
}
|
||||
|
||||
void ChatTheme::generateNextBackgroundRotation() {
|
||||
if (_backgroundCachingRequest
|
||||
if (_nextCachingRequest
|
||||
|| _backgroundCachingRequest
|
||||
|| !_backgroundNext.image.isNull()
|
||||
|| !readyForBackgroundRotation()
|
||||
|| background().colors.size() < 3) {
|
||||
@@ -548,8 +549,9 @@ void ChatTheme::generateNextBackgroundRotation() {
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
_nextCachingRequest = request;
|
||||
cacheBackgroundAsync(request, [=](CacheBackgroundResult &&result) {
|
||||
const auto forRequest = base::take(_backgroundCachingRequest);
|
||||
const auto forRequest = base::take(_nextCachingRequest);
|
||||
if (!readyForBackgroundRotation()) {
|
||||
return;
|
||||
}
|
||||
@@ -601,7 +603,9 @@ void ChatTheme::cacheBackgroundNow() {
|
||||
void ChatTheme::cacheBackgroundAsync(
|
||||
const CacheBackgroundRequest &request,
|
||||
Fn<void(CacheBackgroundResult&&)> done) {
|
||||
_backgroundCachingRequest = request;
|
||||
if (!done) {
|
||||
_backgroundCachingRequest = request;
|
||||
}
|
||||
const auto weak = base::make_weak(this);
|
||||
crl::async([=] {
|
||||
if (!weak) {
|
||||
|
||||
@@ -202,7 +202,9 @@ private:
|
||||
BackgroundState _backgroundState;
|
||||
Animations::Simple _backgroundFade;
|
||||
CacheBackgroundRequest _backgroundCachingRequest;
|
||||
CacheBackgroundRequest _nextCachingRequest;
|
||||
CacheBackgroundResult _backgroundNext;
|
||||
int _backgroundVersion = 0;
|
||||
QSize _cacheBackgroundArea;
|
||||
crl::time _lastBackgroundAreaChangeTime = 0;
|
||||
std::optional<base::Timer> _cacheBackgroundTimer;
|
||||
|
||||
Reference in New Issue
Block a user