Fixed unpaused custom emoji in top bar of sponsored messages.

This commit is contained in:
23rd 2025-05-01 11:25:57 +03:00 committed by John Preston
parent 3e13186560
commit 835fa77964

View file

@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/effects/animation_value.h" #include "ui/effects/animation_value.h"
#include "ui/effects/ripple_animation.h" #include "ui/effects/ripple_animation.h"
#include "ui/image/image_prepare.h" #include "ui/image/image_prepare.h"
#include "ui/power_saving.h"
#include "ui/rect.h" #include "ui/rect.h"
#include "ui/widgets/buttons.h" #include "ui/widgets/buttons.h"
#include "ui/widgets/shadow.h" #include "ui/widgets/shadow.h"
@ -219,6 +220,13 @@ void FillSponsoredMessageBar(
} }
}; };
}; };
const auto paused = [=]() -> Fn<bool()> {
if (const auto c = FindSessionController(widget)) {
using Gif = Window::GifPauseReason;
return [=] { return c->isGifPausedAtLeastFor(Gif::Any); };
}
return [] { return false; };
};
const auto kLinesForPhoto = 3; const auto kLinesForPhoto = 3;
const auto rightPhotoSize = titleSt.font->ascent * kLinesForPhoto; const auto rightPhotoSize = titleSt.font->ascent * kLinesForPhoto;
const auto rightPhotoPlaceholder = titleSt.font->height * kLinesForPhoto; const auto rightPhotoPlaceholder = titleSt.font->height * kLinesForPhoto;
@ -357,6 +365,8 @@ void FillSponsoredMessageBar(
.geometry = Ui::Text::GeometryDescriptor{ .geometry = Ui::Text::GeometryDescriptor{
.layout = std::move(lineLayout), .layout = std::move(lineLayout),
}, },
.pausedEmoji = On(PowerSaving::kEmojiChat) || paused(),
.pausedSpoiler = On(PowerSaving::kChatSpoiler) || paused(),
}); });
state->lastPaintedContentTop = top; state->lastPaintedContentTop = top;
state->lastPaintedContentLineAmount = lastContentLineAmount; state->lastPaintedContentLineAmount = lastContentLineAmount;