2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Support colored emoji statuses.

This commit is contained in:
John Preston
2022-08-31 12:29:09 +04:00
parent 923e725e18
commit 2d07539892
17 changed files with 224 additions and 56 deletions

View File

@@ -23,6 +23,7 @@ InfoToggle {
InfoPeerBadge {
verified: icon;
premium: icon;
premiumFg: color;
position: point;
sizeTag: int;
}
@@ -316,6 +317,7 @@ infoPremiumStar: icon {{ "profile_premium", profileVerifiedCheckBg }};
infoPeerBadge: InfoPeerBadge {
verified: infoVerifiedCheck;
premium: infoPremiumStar;
premiumFg: profileVerifiedCheckBg;
position: infoVerifiedCheckPosition;
sizeTag: 1; // Large
}

View File

@@ -122,6 +122,7 @@ void BadgeView::setBadge(Badge badge, DocumentId emojiStatusId) {
_badge = badge;
_emojiStatusId = emojiStatusId;
_emojiStatus = nullptr;
_emojiStatusColored = nullptr;
_view.destroy();
if (_badge == Badge::None) {
_updated.fire({});
@@ -143,14 +144,19 @@ void BadgeView::setBadge(Badge badge, DocumentId emojiStatusId) {
_emojiStatusId,
[raw = _view.data()] { raw->update(); },
tag);
_emojiStatusColored = std::make_unique<
Ui::Text::CustomEmojiColored
>();
const auto emoji = Data::FrameSizeFromTag(tag)
/ style::DevicePixelRatio();
_view->resize(emoji, emoji);
_view->paintRequest(
) | rpl::start_with_next([=, check = _view.data()]{
Painter p(check);
_emojiStatusColored->color = _st.premiumFg->c;
_emojiStatus->paint(p, {
.preview = st::windowBgOver->c,
.colored = _emojiStatusColored.get(),
.now = crl::now(),
.paused = _animationPaused && _animationPaused(),
});

View File

@@ -33,6 +33,10 @@ template <typename Widget>
class SlideWrap;
} // namespace Ui
namespace Ui::Text {
struct CustomEmojiColored;
} // namespace Ui::Text
namespace Info {
class Controller;
class Section;
@@ -73,6 +77,7 @@ private:
const not_null<PeerData*> _peer;
DocumentId _emojiStatusId = 0;
std::unique_ptr<Ui::Text::CustomEmoji> _emojiStatus;
std::unique_ptr<Ui::Text::CustomEmojiColored> _emojiStatusColored;
base::flags<Badge> _allowed;
Badge _badge = Badge();
Fn<void()> _premiumClickCallback;