mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Return native verify icon to the right.
This commit is contained in:
@@ -22,9 +22,9 @@ InfoToggle {
|
||||
}
|
||||
|
||||
InfoPeerBadge {
|
||||
verified: icon;
|
||||
premium: icon;
|
||||
premiumFg: color;
|
||||
premiumInnerFg: color;
|
||||
position: point;
|
||||
sizeTag: int;
|
||||
}
|
||||
@@ -436,9 +436,9 @@ infoVerifiedCheck: icon {
|
||||
infoPremiumStar: icon {{ "profile_premium", profileVerifiedCheckBg }};
|
||||
|
||||
infoPeerBadge: InfoPeerBadge {
|
||||
verified: infoVerifiedCheck;
|
||||
premium: infoPremiumStar;
|
||||
premiumFg: profileVerifiedCheckBg;
|
||||
premiumInnerFg: profileVerifiedCheckFg;
|
||||
position: infoVerifiedCheckPosition;
|
||||
sizeTag: 1; // Large
|
||||
}
|
||||
|
@@ -1845,7 +1845,7 @@ void DetailsFiller::setupAboutVerification() {
|
||||
peer,
|
||||
Data::PeerUpdate::Flag::VerifyInfo
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto info = peer->verifyDetails();
|
||||
const auto info = peer->botVerifyDetails();
|
||||
while (inner->count()) {
|
||||
delete inner->widgetAt(0);
|
||||
}
|
||||
@@ -1853,9 +1853,6 @@ void DetailsFiller::setupAboutVerification() {
|
||||
Ui::AddDivider(inner);
|
||||
} else if (!info->description.empty()) {
|
||||
Ui::AddDividerText(inner, rpl::single(info->description));
|
||||
} else if (peer->verifiedByTelegram()) {
|
||||
const auto phrases = PeerVerifyPhrases(peer);
|
||||
Ui::AddDividerText(inner, phrases.telegram());
|
||||
}
|
||||
inner->resizeToWidth(inner->width());
|
||||
}, inner->lifetime());
|
||||
|
@@ -35,10 +35,7 @@ namespace {
|
||||
} else if (emojiStatusId && badge == BadgeType::None) {
|
||||
badge = BadgeType::Premium;
|
||||
}
|
||||
return Badge::Content{
|
||||
badge,
|
||||
emojiStatusId ? emojiStatusId : DocumentId(),
|
||||
};
|
||||
return Badge::Content{ badge, emojiStatusId };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,30 +114,16 @@ void Badge::setContent(Content content) {
|
||||
case BadgeType::Verified:
|
||||
case BadgeType::Premium: {
|
||||
const auto id = _content.emojiStatusId;
|
||||
const auto innerId = _content.emojiStatusInnerId;
|
||||
if (id || innerId) {
|
||||
_emojiStatus = id
|
||||
? _session->data().customEmojiManager().create(
|
||||
id,
|
||||
[raw = _view.data()] { raw->update(); },
|
||||
sizeTag())
|
||||
: nullptr;
|
||||
_statusInner = innerId
|
||||
? _session->data().customEmojiManager().create(
|
||||
innerId,
|
||||
[raw = _view.data()] { raw->update(); },
|
||||
sizeTag())
|
||||
: nullptr;
|
||||
if (_emojiStatus && _customStatusLoopsLimit > 0) {
|
||||
if (id) {
|
||||
_emojiStatus = _session->data().customEmojiManager().create(
|
||||
id,
|
||||
[raw = _view.data()] { raw->update(); },
|
||||
sizeTag());
|
||||
if (_customStatusLoopsLimit > 0) {
|
||||
_emojiStatus = std::make_unique<Ui::Text::LimitedLoopsEmoji>(
|
||||
std::move(_emojiStatus),
|
||||
_customStatusLoopsLimit);
|
||||
}
|
||||
if (_statusInner && _customStatusLoopsLimit > 0) {
|
||||
_statusInner = std::make_unique<Ui::Text::LimitedLoopsEmoji>(
|
||||
std::move(_statusInner),
|
||||
_customStatusLoopsLimit);
|
||||
}
|
||||
const auto emoji = Data::FrameSizeFromTag(sizeTag())
|
||||
/ style::DevicePixelRatio();
|
||||
_view->resize(emoji, emoji);
|
||||
@@ -155,17 +138,13 @@ void Badge::setContent(Content content) {
|
||||
if (!_emojiStatusPanel
|
||||
|| !_emojiStatusPanel->paintBadgeFrame(check)) {
|
||||
Painter p(check);
|
||||
if (_emojiStatus) {
|
||||
_emojiStatus->paint(p, args);
|
||||
}
|
||||
if (_statusInner) {
|
||||
args.textColor = _st.premiumInnerFg->c;
|
||||
_statusInner->paint(p, args);
|
||||
}
|
||||
_emojiStatus->paint(p, args);
|
||||
}
|
||||
}, _view->lifetime());
|
||||
} else {
|
||||
const auto icon = &_st.premium;
|
||||
const auto icon = (_content.badge == BadgeType::Verified)
|
||||
? &_st.verified
|
||||
: &_st.premium;
|
||||
_view->resize(icon->size());
|
||||
_view->paintRequest(
|
||||
) | rpl::start_with_next([=, check = _view.data()]{
|
||||
@@ -225,9 +204,9 @@ void Badge::move(int left, int top, int bottom) {
|
||||
return;
|
||||
}
|
||||
const auto star = !_emojiStatus
|
||||
&& (_content.badge == BadgeType::Premium);
|
||||
const auto fake = (!_emojiStatus && !star)
|
||||
|| (_content.badge == BadgeType::Verified);
|
||||
&& (_content.badge == BadgeType::Premium
|
||||
|| _content.badge == BadgeType::Verified);
|
||||
const auto fake = !_emojiStatus && !star;
|
||||
const auto skip = fake ? 0 : _st.position.x();
|
||||
const auto badgeLeft = left + skip;
|
||||
const auto badgeTop = top
|
||||
|
@@ -59,7 +59,6 @@ public:
|
||||
struct Content {
|
||||
BadgeType badge = BadgeType::None;
|
||||
DocumentId emojiStatusId = 0;
|
||||
DocumentId emojiStatusInnerId = 0;
|
||||
|
||||
friend inline constexpr bool operator==(Content, Content) = default;
|
||||
};
|
||||
@@ -93,7 +92,6 @@ private:
|
||||
EmojiStatusPanel *_emojiStatusPanel = nullptr;
|
||||
const int _customStatusLoopsLimit = 0;
|
||||
std::unique_ptr<Ui::Text::CustomEmoji> _emojiStatus;
|
||||
std::unique_ptr<Ui::Text::CustomEmoji> _statusInner;
|
||||
base::flags<BadgeType> _allowed;
|
||||
Content _content;
|
||||
Fn<void()> _premiumClickCallback;
|
||||
|
@@ -309,11 +309,10 @@ Cover::Cover(
|
||||
peer,
|
||||
Data::PeerUpdate::Flag::VerifyInfo
|
||||
) | rpl::map([=] {
|
||||
const auto details = peer->verifyDetails();
|
||||
const auto info = peer->botVerifyDetails();
|
||||
return Badge::Content{
|
||||
.badge = details ? BadgeType::Verified : BadgeType::None,
|
||||
.emojiStatusId = details ? details->iconBgId : DocumentId(),
|
||||
.emojiStatusInnerId = details ? details->iconFgId : DocumentId(),
|
||||
.badge = info ? BadgeType::Verified : BadgeType::None,
|
||||
.emojiStatusId = info ? info->iconId : DocumentId(),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@@ -659,6 +659,8 @@ rpl::producer<BadgeType> BadgeValueFromFlags(Peer peer) {
|
||||
? BadgeType::Scam
|
||||
: (value & Flag::Fake)
|
||||
? BadgeType::Fake
|
||||
: (value & Flag::Verified)
|
||||
? BadgeType::Verified
|
||||
: premium
|
||||
? BadgeType::Premium
|
||||
: BadgeType::None;
|
||||
|
Reference in New Issue
Block a user