Return native verify icon to the right.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 329 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1,001 B |
|
@ -1641,28 +1641,24 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_bot_verify_bot_submit" = "Verify Bot";
|
||||
"lng_bot_verify_bot_sent" = "{name} has been notified and will receive your verification mark and description upon accepting.";
|
||||
"lng_bot_verify_bot_remove" = "This bot is already verified by you. Do you want to remove verification?";
|
||||
"lng_bot_verify_bot_telegram" = "This bot is verified as official by the representatives of Telegram.";
|
||||
"lng_bot_verify_user_title" = "Verify User";
|
||||
"lng_bot_verify_user_text" = "Do you want to verify {name} with your verification mark and description?";
|
||||
"lng_bot_verify_user_about" = "You can customize your description for each account.";
|
||||
"lng_bot_verify_user_submit" = "Verify User";
|
||||
"lng_bot_verify_user_sent" = "{name} has been notified and will receive your verification mark and description upon accepting.";
|
||||
"lng_bot_verify_user_remove" = "This account is already verified by you. Do you want to remove verification?";
|
||||
"lng_bot_verify_user_telegram" = "This account is verified as official by the representatives of Telegram.";
|
||||
"lng_bot_verify_channel_title" = "Verify Channel";
|
||||
"lng_bot_verify_channel_text" = "Do you want to verify {name} with your verification mark and description?";
|
||||
"lng_bot_verify_channel_about" = "You can customize your description for each channel.";
|
||||
"lng_bot_verify_channel_submit" = "Verify Channel";
|
||||
"lng_bot_verify_channel_sent" = "{name} has been notified and will receive your verification mark and description upon accepting.";
|
||||
"lng_bot_verify_channel_remove" = "This channel is already verified by you. Do you want to remove verification?";
|
||||
"lng_bot_verify_channel_telegram" = "This channel is verified as official by the representatives of Telegram.";
|
||||
"lng_bot_verify_group_title" = "Verify Group";
|
||||
"lng_bot_verify_group_text" = "Do you want to verify {name} with your verification mark and description?";
|
||||
"lng_bot_verify_group_about" = "You can customize your description for each group.";
|
||||
"lng_bot_verify_group_submit" = "Verify Group";
|
||||
"lng_bot_verify_group_sent" = "{name} has been notified and will receive your verification mark and description upon accepting.";
|
||||
"lng_bot_verify_group_remove" = "This group is already verified by you. Do you want to remove verification?";
|
||||
"lng_bot_verify_group_telegram" = "This community is verified as official by the representatives of Telegram.";
|
||||
"lng_bot_verify_description_label" = "Description";
|
||||
"lng_bot_verify_remove_title" = "Remove verification";
|
||||
"lng_bot_verify_remove_submit" = "Remove";
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
<file alias="topic_icons/general.svg">../../art/topic_icons/general.svg</file>
|
||||
<file alias="links_subscription.svg">../../icons/info/edit/links_subscription.svg</file>
|
||||
<file alias="plane_white.svg">../../icons/plane_white.svg</file>
|
||||
<file alias="art/verified_bg.webp">../../art/verified_bg.webp</file>
|
||||
<file alias="art/verified_fg.webp">../../art/verified_fg.webp</file>
|
||||
</qresource>
|
||||
<qresource prefix="/icons">
|
||||
<file alias="calls/hands.lottie">../../icons/calls/hands.lottie</file>
|
||||
|
|
|
@ -570,7 +570,9 @@ ConfirmInviteBox::ChatInvite ConfirmInviteBox::Parse(
|
|||
[[nodiscard]] Info::Profile::BadgeType ConfirmInviteBox::BadgeForInvite(
|
||||
const ChatInvite &invite) {
|
||||
using Type = Info::Profile::BadgeType;
|
||||
return invite.isScam
|
||||
return invite.isVerified
|
||||
? Type::Verified
|
||||
: invite.isScam
|
||||
? Type::Scam
|
||||
: invite.isFake
|
||||
? Type::Fake
|
||||
|
|
|
@ -799,6 +799,9 @@ int PeerListRow::paintNameIconGetWidth(
|
|||
outerWidth,
|
||||
{
|
||||
.peer = peer(),
|
||||
.verified = &(selected
|
||||
? st::dialogsVerifiedIconOver
|
||||
: st::dialogsVerifiedIcon),
|
||||
.premium = &(selected
|
||||
? st::dialogsPremiumIcon.over
|
||||
: st::dialogsPremiumIcon.icon),
|
||||
|
|
|
@ -90,7 +90,7 @@ Main::Session &Controller::session() const {
|
|||
|
||||
void Controller::rowClicked(gsl::not_null<PeerListRow*> row) {
|
||||
const auto peer = row->peer();
|
||||
const auto details = peer->verifyDetails();
|
||||
const auto details = peer->botVerifyDetails();
|
||||
const auto already = details && (details->botId == peerToUser(_bot->id));
|
||||
if (already) {
|
||||
confirmRemove(peer);
|
||||
|
@ -141,7 +141,7 @@ void Controller::confirmAdd(not_null<PeerData*> peer) {
|
|||
Ui::Text::Bold(peer->shortName()),
|
||||
Ui::Text::WithEntities),
|
||||
.duration = kSetupVerificationToastDuration,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
state->sent = false;
|
||||
show->showToast(error);
|
||||
|
@ -253,7 +253,7 @@ object_ptr<Ui::BoxContent> MakeVerifyPeersBox(
|
|||
return Box<PeerListBox>(std::move(controller), std::move(init));
|
||||
}
|
||||
|
||||
VerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer) {
|
||||
BotVerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer) {
|
||||
if (const auto user = peer->asUser()) {
|
||||
if (user->isBot()) {
|
||||
return {
|
||||
|
@ -263,7 +263,6 @@ VerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer) {
|
|||
.submit = tr::lng_bot_verify_bot_submit,
|
||||
.sent = tr::lng_bot_verify_bot_sent,
|
||||
.remove = tr::lng_bot_verify_bot_remove,
|
||||
.telegram = tr::lng_bot_verify_bot_telegram,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
|
@ -273,7 +272,6 @@ VerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer) {
|
|||
.submit = tr::lng_bot_verify_user_submit,
|
||||
.sent = tr::lng_bot_verify_user_sent,
|
||||
.remove = tr::lng_bot_verify_user_remove,
|
||||
.telegram = tr::lng_bot_verify_user_telegram,
|
||||
};
|
||||
}
|
||||
} else if (peer->isBroadcast()) {
|
||||
|
@ -284,7 +282,6 @@ VerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer) {
|
|||
.submit = tr::lng_bot_verify_channel_submit,
|
||||
.sent = tr::lng_bot_verify_channel_sent,
|
||||
.remove = tr::lng_bot_verify_channel_remove,
|
||||
.telegram = tr::lng_bot_verify_channel_telegram,
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
@ -294,6 +291,5 @@ VerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer) {
|
|||
.submit = tr::lng_bot_verify_group_submit,
|
||||
.sent = tr::lng_bot_verify_group_sent,
|
||||
.remove = tr::lng_bot_verify_group_remove,
|
||||
.telegram = tr::lng_bot_verify_group_telegram,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -25,13 +25,12 @@ class SessionController;
|
|||
not_null<Window::SessionController*> window,
|
||||
not_null<UserData*> bot);
|
||||
|
||||
struct VerifyPhrases {
|
||||
struct BotVerifyPhrases {
|
||||
tr::phrase<> title;
|
||||
tr::phrase<lngtag_name> text;
|
||||
tr::phrase<> about;
|
||||
tr::phrase<> submit;
|
||||
tr::phrase<lngtag_name> sent;
|
||||
tr::phrase<> remove;
|
||||
tr::phrase<> telegram;
|
||||
};
|
||||
[[nodiscard]] VerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer);
|
||||
[[nodiscard]] BotVerifyPhrases PeerVerifyPhrases(not_null<PeerData*> peer);
|
||||
|
|
|
@ -714,28 +714,30 @@ bool ChannelData::canRestrictParticipant(
|
|||
return adminRights() & AdminRight::BanUsers;
|
||||
}
|
||||
|
||||
void ChannelData::setVerifyDetails(Ui::VerifyDetails details) {
|
||||
void ChannelData::setBotVerifyDetails(Ui::BotVerifyDetails details) {
|
||||
if (!details) {
|
||||
if (_verifyDetails) {
|
||||
_verifyDetails = nullptr;
|
||||
if (_botVerifyDetails) {
|
||||
_botVerifyDetails = nullptr;
|
||||
session().changes().peerUpdated(this, UpdateFlag::VerifyInfo);
|
||||
}
|
||||
} else if (!_verifyDetails) {
|
||||
_verifyDetails = std::make_unique<Ui::VerifyDetails>(details);
|
||||
} else if (!_botVerifyDetails) {
|
||||
_botVerifyDetails = std::make_unique<Ui::BotVerifyDetails>(details);
|
||||
session().changes().peerUpdated(this, UpdateFlag::VerifyInfo);
|
||||
} else if (*_verifyDetails != details) {
|
||||
*_verifyDetails = details;
|
||||
} else if (*_botVerifyDetails != details) {
|
||||
*_botVerifyDetails = details;
|
||||
session().changes().peerUpdated(this, UpdateFlag::VerifyInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelData::setVerifyDetailsIcon(DocumentId iconId) {
|
||||
void ChannelData::setBotVerifyDetailsIcon(DocumentId iconId) {
|
||||
if (!iconId) {
|
||||
setVerifyDetails({});
|
||||
setBotVerifyDetails({});
|
||||
} else {
|
||||
auto info = _verifyDetails ? *_verifyDetails : Ui::VerifyDetails();
|
||||
info.iconBgId = iconId;
|
||||
setVerifyDetails(info);
|
||||
auto info = _botVerifyDetails
|
||||
? *_botVerifyDetails
|
||||
: Ui::BotVerifyDetails();
|
||||
info.iconId = iconId;
|
||||
setBotVerifyDetails(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1277,7 +1279,8 @@ void ApplyChannelUpdate(
|
|||
.paidEnabled = update.is_paid_reactions_available(),
|
||||
});
|
||||
}
|
||||
channel->setVerifyDetails(ParseVerifyDetails(update.vbot_verification()));
|
||||
channel->setBotVerifyDetails(
|
||||
ParseBotVerifyDetails(update.vbot_verification()));
|
||||
channel->owner().stories().apply(channel, update.vstories());
|
||||
channel->fullUpdated();
|
||||
channel->setPendingRequestsCount(
|
||||
|
|
|
@ -376,10 +376,10 @@ public:
|
|||
[[nodiscard]] bool canRestrictParticipant(
|
||||
not_null<PeerData*> participant) const;
|
||||
|
||||
void setVerifyDetails(Ui::VerifyDetails details);
|
||||
void setVerifyDetailsIcon(DocumentId iconId);
|
||||
[[nodiscard]] Ui::VerifyDetails *verifyDetails() const {
|
||||
return _verifyDetails.get();
|
||||
void setBotVerifyDetails(Ui::BotVerifyDetails details);
|
||||
void setBotVerifyDetailsIcon(DocumentId iconId);
|
||||
[[nodiscard]] Ui::BotVerifyDetails *botVerifyDetails() const {
|
||||
return _botVerifyDetails.get();
|
||||
}
|
||||
|
||||
void setInviteLink(const QString &newInviteLink);
|
||||
|
@ -552,7 +552,7 @@ private:
|
|||
std::unique_ptr<Data::GroupCall> _call;
|
||||
PeerId _callDefaultJoinAs = 0;
|
||||
|
||||
std::unique_ptr<Ui::VerifyDetails> _verifyDetails;
|
||||
std::unique_ptr<Ui::BotVerifyDetails> _botVerifyDetails;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1247,22 +1247,15 @@ void PeerData::setStoriesHidden(bool hidden) {
|
|||
}
|
||||
}
|
||||
|
||||
Ui::VerifyDetails *PeerData::verifyDetails() const {
|
||||
Ui::BotVerifyDetails *PeerData::botVerifyDetails() const {
|
||||
if (const auto user = asUser()) {
|
||||
return user->verifyDetails();
|
||||
return user->botVerifyDetails();
|
||||
} else if (const auto channel = asChannel()) {
|
||||
return channel->verifyDetails();
|
||||
return channel->botVerifyDetails();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool PeerData::verifiedByTelegram() const {
|
||||
if (const auto details = verifyDetails()) {
|
||||
return (details->iconBgId == owner().verifiedByTelegram().iconBgId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Data::Forum *PeerData::forum() const {
|
||||
if (const auto channel = asChannel()) {
|
||||
return channel->forum();
|
||||
|
|
|
@ -23,7 +23,7 @@ enum class ChatRestriction;
|
|||
|
||||
namespace Ui {
|
||||
class EmptyUserpic;
|
||||
struct VerifyDetails;
|
||||
struct BotVerifyDetails;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
|
@ -234,8 +234,7 @@ public:
|
|||
[[nodiscard]] bool hasStoriesHidden() const;
|
||||
void setStoriesHidden(bool hidden);
|
||||
|
||||
[[nodiscard]] Ui::VerifyDetails *verifyDetails() const;
|
||||
[[nodiscard]] bool verifiedByTelegram() const;
|
||||
[[nodiscard]] Ui::BotVerifyDetails *botVerifyDetails() const;
|
||||
|
||||
[[nodiscard]] bool isNotificationsUser() const {
|
||||
return (id == peerFromUser(333000))
|
||||
|
|
|
@ -30,7 +30,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/view/media/history_view_media.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "inline_bots/inline_bot_layout_item.h"
|
||||
#include "storage/localimageloader.h"
|
||||
#include "storage/storage_account.h"
|
||||
#include "storage/storage_encrypted_file.h"
|
||||
#include "media/player/media_player_instance.h" // instance()->play()
|
||||
|
@ -81,11 +80,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/random.h"
|
||||
#include "spellcheck/spellcheck_highlight_syntax.h"
|
||||
|
||||
#include "ui/chat/attach/attach_prepare.h"
|
||||
#include "ui/unread_badge.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include <QtCore/QBuffer>
|
||||
|
||||
namespace Data {
|
||||
namespace {
|
||||
|
||||
|
@ -336,26 +330,6 @@ Session::Session(not_null<Main::Session*> session)
|
|||
}, _lifetime);
|
||||
}
|
||||
|
||||
|
||||
Ui::VerifyDetails Session::verifiedByTelegram() {
|
||||
if (!_verifiedByTelegramIconBgId) {
|
||||
const auto bg = ChatHelpers::GenerateLocalSticker(
|
||||
_session,
|
||||
u":/gui/art/verified_bg.webp"_q);
|
||||
bg->overrideEmojiUsesTextColor(true);
|
||||
const auto fg = ChatHelpers::GenerateLocalSticker(
|
||||
_session,
|
||||
u":/gui/art/verified_fg.webp"_q);
|
||||
fg->overrideEmojiUsesTextColor(true);
|
||||
_verifiedByTelegramIconBgId = bg->id;
|
||||
_verifiedByTelegramIconFgId = fg->id;
|
||||
}
|
||||
return {
|
||||
.iconBgId = _verifiedByTelegramIconBgId,
|
||||
.iconFgId = _verifiedByTelegramIconFgId,
|
||||
};
|
||||
}
|
||||
|
||||
void Session::subscribeForTopicRepliesLists() {
|
||||
repliesReadTillUpdates(
|
||||
) | rpl::start_with_next([=](const RepliesReadTillUpdate &update) {
|
||||
|
@ -596,11 +570,8 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
|||
| (data.is_stories_hidden() ? Flag::StoriesHidden : Flag())
|
||||
: Flag());
|
||||
result->setFlags((result->flags() & ~flagsMask) | flagsSet);
|
||||
if (data.is_verified()) {
|
||||
result->setVerifyDetails(verifiedByTelegram());
|
||||
} else {
|
||||
result->setVerifyDetailsIcon(data.vbot_verification_icon().value_or_empty());
|
||||
}
|
||||
result->setBotVerifyDetailsIcon(
|
||||
data.vbot_verification_icon().value_or_empty());
|
||||
if (minimal) {
|
||||
if (result->input.type() == mtpc_inputPeerEmpty) {
|
||||
result->input = MTP_inputPeerUser(
|
||||
|
@ -1016,12 +987,8 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
? Flag::StoriesHidden
|
||||
: Flag());
|
||||
channel->setFlags((channel->flags() & ~flagsMask) | flagsSet);
|
||||
if (data.is_verified()) {
|
||||
channel->setVerifyDetails(verifiedByTelegram());
|
||||
} else {
|
||||
channel->setVerifyDetailsIcon(
|
||||
data.vbot_verification_icon().value_or_empty());
|
||||
}
|
||||
channel->setBotVerifyDetailsIcon(
|
||||
data.vbot_verification_icon().value_or_empty());
|
||||
if (!minimal && storiesState) {
|
||||
result->setStoriesState(!storiesState->maxId
|
||||
? UserData::StoriesState::None
|
||||
|
|
|
@ -177,8 +177,6 @@ public:
|
|||
return ++_nonHistoryEntryId;
|
||||
}
|
||||
|
||||
[[nodiscard]] Ui::VerifyDetails verifiedByTelegram();
|
||||
|
||||
void subscribeForTopicRepliesLists();
|
||||
void clear();
|
||||
|
||||
|
@ -1142,9 +1140,6 @@ private:
|
|||
const std::unique_ptr<BusinessInfo> _businessInfo;
|
||||
std::unique_ptr<ShortcutMessages> _shortcutMessages;
|
||||
|
||||
DocumentId _verifiedByTelegramIconBgId = 0;
|
||||
DocumentId _verifiedByTelegramIconFgId = 0;
|
||||
|
||||
MsgId _nonHistoryEntryId = ShortcutMaxMsgId;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
|
|
@ -556,28 +556,30 @@ bool UserData::isUsernameEditable(QString username) const {
|
|||
return _username.isEditable(username);
|
||||
}
|
||||
|
||||
void UserData::setVerifyDetails(Ui::VerifyDetails details) {
|
||||
void UserData::setBotVerifyDetails(Ui::BotVerifyDetails details) {
|
||||
if (!details) {
|
||||
if (_verifyDetails) {
|
||||
_verifyDetails = nullptr;
|
||||
if (_botVerifyDetails) {
|
||||
_botVerifyDetails = nullptr;
|
||||
session().changes().peerUpdated(this, UpdateFlag::VerifyInfo);
|
||||
}
|
||||
} else if (!_verifyDetails) {
|
||||
_verifyDetails = std::make_unique<Ui::VerifyDetails>(details);
|
||||
} else if (!_botVerifyDetails) {
|
||||
_botVerifyDetails = std::make_unique<Ui::BotVerifyDetails>(details);
|
||||
session().changes().peerUpdated(this, UpdateFlag::VerifyInfo);
|
||||
} else if (*_verifyDetails != details) {
|
||||
*_verifyDetails = details;
|
||||
} else if (*_botVerifyDetails != details) {
|
||||
*_botVerifyDetails = details;
|
||||
session().changes().peerUpdated(this, UpdateFlag::VerifyInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void UserData::setVerifyDetailsIcon(DocumentId iconId) {
|
||||
void UserData::setBotVerifyDetailsIcon(DocumentId iconId) {
|
||||
if (!iconId) {
|
||||
setVerifyDetails({});
|
||||
setBotVerifyDetails({});
|
||||
} else {
|
||||
auto info = _verifyDetails ? *_verifyDetails : Ui::VerifyDetails();
|
||||
info.iconBgId = iconId;
|
||||
setVerifyDetails(info);
|
||||
auto info = _botVerifyDetails
|
||||
? *_botVerifyDetails
|
||||
: Ui::BotVerifyDetails();
|
||||
info.iconId = iconId;
|
||||
setBotVerifyDetails(info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -792,7 +794,8 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
|
|||
user->owner().businessInfo().applyGreetingSettings(
|
||||
FromMTP(&user->owner(), update.vbusiness_greeting_message()));
|
||||
}
|
||||
user->setVerifyDetails(ParseVerifyDetails(update.vbot_verification()));
|
||||
user->setBotVerifyDetails(
|
||||
ParseBotVerifyDetails(update.vbot_verification()));
|
||||
|
||||
user->owner().stories().apply(user, update.vstories());
|
||||
|
||||
|
@ -814,7 +817,7 @@ StarRefProgram ParseStarRefProgram(const MTPStarRefProgram *program) {
|
|||
return result;
|
||||
}
|
||||
|
||||
Ui::VerifyDetails ParseVerifyDetails(const MTPBotVerification *info) {
|
||||
Ui::BotVerifyDetails ParseBotVerifyDetails(const MTPBotVerification *info) {
|
||||
if (!info) {
|
||||
return {};
|
||||
}
|
||||
|
@ -823,7 +826,7 @@ Ui::VerifyDetails ParseVerifyDetails(const MTPBotVerification *info) {
|
|||
const auto flags = TextParseLinks;
|
||||
return {
|
||||
.botId = UserId(data.vbot_id().v),
|
||||
.iconBgId = DocumentId(data.vicon().v),
|
||||
.iconId = DocumentId(data.vicon().v),
|
||||
.description = TextUtilities::ParseEntities(description, flags),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -193,10 +193,10 @@ public:
|
|||
[[nodiscard]] const std::vector<QString> &usernames() const;
|
||||
[[nodiscard]] bool isUsernameEditable(QString username) const;
|
||||
|
||||
void setVerifyDetails(Ui::VerifyDetails details);
|
||||
void setVerifyDetailsIcon(DocumentId iconId);
|
||||
[[nodiscard]] Ui::VerifyDetails *verifyDetails() const {
|
||||
return _verifyDetails.get();
|
||||
void setBotVerifyDetails(Ui::BotVerifyDetails details);
|
||||
void setBotVerifyDetailsIcon(DocumentId iconId);
|
||||
[[nodiscard]] Ui::BotVerifyDetails *botVerifyDetails() const {
|
||||
return _botVerifyDetails.get();
|
||||
}
|
||||
|
||||
enum class ContactStatus : char {
|
||||
|
@ -277,7 +277,7 @@ private:
|
|||
std::vector<Data::UnavailableReason> _unavailableReasons;
|
||||
QString _phone;
|
||||
QString _privateForwardName;
|
||||
std::unique_ptr<Ui::VerifyDetails> _verifyDetails;
|
||||
std::unique_ptr<Ui::BotVerifyDetails> _botVerifyDetails;
|
||||
|
||||
ChannelId _personalChannelId = 0;
|
||||
MsgId _personalChannelMessageId = 0;
|
||||
|
@ -295,7 +295,7 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update);
|
|||
[[nodiscard]] StarRefProgram ParseStarRefProgram(
|
||||
const MTPStarRefProgram *program);
|
||||
|
||||
[[nodiscard]] Ui::VerifyDetails ParseVerifyDetails(
|
||||
[[nodiscard]] Ui::BotVerifyDetails ParseBotVerifyDetails(
|
||||
const MTPBotVerification *info);
|
||||
|
||||
} // namespace Data
|
||||
|
|
|
@ -32,8 +32,7 @@ ThreeStateIcon {
|
|||
}
|
||||
|
||||
VerifiedBadge {
|
||||
bg: color;
|
||||
fg: color;
|
||||
color: color;
|
||||
height: pixels;
|
||||
}
|
||||
|
||||
|
@ -411,18 +410,27 @@ dialogsLockIcon: ThreeStateIcon {
|
|||
|
||||
dialogsVerifiedColors: VerifiedBadge {
|
||||
height: 20px;
|
||||
bg: dialogsVerifiedIconBg;
|
||||
fg: dialogsVerifiedIconFg;
|
||||
color: dialogsVerifiedIconBg;
|
||||
}
|
||||
dialogsVerifiedColorsOver: VerifiedBadge(dialogsVerifiedColors) {
|
||||
bg: dialogsVerifiedIconBgOver;
|
||||
fg: dialogsVerifiedIconFgOver;
|
||||
color: dialogsVerifiedIconBgOver;
|
||||
}
|
||||
dialogsVerifiedColorsActive: VerifiedBadge(dialogsVerifiedColors) {
|
||||
bg: dialogsVerifiedIconBgActive;
|
||||
fg: dialogsVerifiedIconFgActive;
|
||||
color: dialogsVerifiedIconBgActive;
|
||||
}
|
||||
|
||||
dialogsVerifiedIcon: icon {
|
||||
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBg },
|
||||
{ "dialogs/dialogs_verified_check", dialogsVerifiedIconFg },
|
||||
};
|
||||
dialogsVerifiedIconOver: icon {
|
||||
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBgOver },
|
||||
{ "dialogs/dialogs_verified_check", dialogsVerifiedIconFgOver },
|
||||
};
|
||||
dialogsVerifiedIconActive: icon {
|
||||
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBgActive },
|
||||
{ "dialogs/dialogs_verified_check", dialogsVerifiedIconFgActive },
|
||||
};
|
||||
dialogsPremiumIcon: ThreeStateIcon {
|
||||
icon: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBg }};
|
||||
over: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBgOver }};
|
||||
|
|
|
@ -1385,10 +1385,10 @@ void InnerWidget::paintPeerSearchResult(
|
|||
Ui::NameTextOptions());
|
||||
}
|
||||
|
||||
if (const auto details = peer->verifyDetails()) {
|
||||
if (!result->badge.ready(details)) {
|
||||
if (const auto info = peer->botVerifyDetails()) {
|
||||
if (!result->badge.ready(info)) {
|
||||
result->badge.set(
|
||||
details,
|
||||
info,
|
||||
peer->owner().customEmojiManager().factory(),
|
||||
[=] { updateSearchResult(peer); });
|
||||
}
|
||||
|
@ -1409,6 +1409,11 @@ void InnerWidget::paintPeerSearchResult(
|
|||
context.width,
|
||||
{
|
||||
.peer = peer,
|
||||
.verified = (context.active
|
||||
? &st::dialogsVerifiedIconActive
|
||||
: context.selected
|
||||
? &st::dialogsVerifiedIconOver
|
||||
: &st::dialogsVerifiedIcon),
|
||||
.premium = &ThreeStateIcon(
|
||||
st::dialogsPremiumIcon,
|
||||
context.active,
|
||||
|
|
|
@ -449,10 +449,10 @@ void PaintRow(
|
|||
? tr::lng_badge_psa_default(tr::now)
|
||||
: custom;
|
||||
PaintRowTopRight(p, text, rectForName, context);
|
||||
} else if (const auto details = from ? from->verifyDetails() : nullptr) {
|
||||
if (!rowBadge.ready(details)) {
|
||||
} else if (const auto info = from ? from->botVerifyDetails() : nullptr) {
|
||||
if (!rowBadge.ready(info)) {
|
||||
rowBadge.set(
|
||||
details,
|
||||
info,
|
||||
from->owner().customEmojiManager().factory(),
|
||||
customEmojiRepaint);
|
||||
}
|
||||
|
@ -739,6 +739,11 @@ void PaintRow(
|
|||
context.width,
|
||||
{
|
||||
.peer = from,
|
||||
.verified = (context.active
|
||||
? &st::dialogsVerifiedIconActive
|
||||
: context.selected
|
||||
? &st::dialogsVerifiedIconOver
|
||||
: &st::dialogsVerifiedIcon),
|
||||
.premium = &ThreeStateIcon(
|
||||
st::dialogsPremiumIcon,
|
||||
context.active,
|
||||
|
|
|
@ -566,10 +566,10 @@ void TopBarWidget::paintTopBar(Painter &p) {
|
|||
TopBarNameText(namePeer, _activeChat.section),
|
||||
Ui::NameTextOptions());
|
||||
}
|
||||
if (const auto details = namePeer->verifyDetails()) {
|
||||
if (!_titleBadge.ready(details)) {
|
||||
if (const auto info = namePeer->botVerifyDetails()) {
|
||||
if (!_titleBadge.ready(info)) {
|
||||
_titleBadge.set(
|
||||
details,
|
||||
info,
|
||||
namePeer->owner().customEmojiManager().factory(),
|
||||
[=] { update(); });
|
||||
}
|
||||
|
@ -589,6 +589,7 @@ void TopBarWidget::paintTopBar(Painter &p) {
|
|||
width(),
|
||||
{
|
||||
.peer = namePeer,
|
||||
.verified = &st::dialogsVerifiedIcon,
|
||||
.premium = &st::dialogsPremiumIcon.icon,
|
||||
.scam = &st::attentionButtonFg,
|
||||
.premiumFg = &st::dialogsVerifiedIconBg,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -197,9 +197,12 @@ settingsInfoPhotoSkip: 7px;
|
|||
settingsInfoNameSkip: -1px;
|
||||
settingsInfoUploadLeft: 6px;
|
||||
settingsInfoPeerBadge: InfoPeerBadge {
|
||||
verified: icon {
|
||||
{ "dialogs/dialogs_verified_star", dialogsVerifiedIconBg },
|
||||
{ "dialogs/dialogs_verified_check", dialogsVerifiedIconFg },
|
||||
};
|
||||
premium: icon {{ "dialogs/dialogs_premium", dialogsVerifiedIconBg }};
|
||||
premiumFg: dialogsVerifiedIconBg;
|
||||
premiumInnerFg: dialogsVerifiedIconFg;
|
||||
sizeTag: 0; // Normal
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,9 @@ struct PeerBadge::EmojiStatus {
|
|||
int skip = 0;
|
||||
};
|
||||
|
||||
struct PeerBadge::VerifiedData {
|
||||
struct PeerBadge::BotVerifiedData {
|
||||
QImage cache;
|
||||
QImage cacheFg;
|
||||
std::unique_ptr<Text::CustomEmoji> bg;
|
||||
std::unique_ptr<Text::CustomEmoji> fg;
|
||||
std::unique_ptr<Text::CustomEmoji> icon;
|
||||
};
|
||||
|
||||
void UnreadBadge::setText(const QString &text, bool active) {
|
||||
|
@ -200,6 +198,14 @@ int PeerBadge::drawGetWidth(
|
|||
.paused = descriptor.paused || On(PowerSaving::kEmojiStatus),
|
||||
});
|
||||
return iconw - 4 * _emojiStatus->skip;
|
||||
} else if (descriptor.verified && peer->isVerified()) {
|
||||
const auto iconw = descriptor.verified->width();
|
||||
descriptor.verified->paint(
|
||||
p,
|
||||
rectForName.x() + qMin(nameWidth, rectForName.width() - iconw),
|
||||
rectForName.y(),
|
||||
outerWidth);
|
||||
return iconw;
|
||||
} else if (descriptor.premium
|
||||
&& peer->isPremium()
|
||||
&& peer->session().premiumBadgesShown()) {
|
||||
|
@ -218,45 +224,33 @@ void PeerBadge::unload() {
|
|||
_emojiStatus = nullptr;
|
||||
}
|
||||
|
||||
bool PeerBadge::ready(const VerifyDetails *details) const {
|
||||
bool PeerBadge::ready(const BotVerifyDetails *details) const {
|
||||
if (!details || !*details) {
|
||||
_verifiedData = nullptr;
|
||||
_botVerifiedData = nullptr;
|
||||
return true;
|
||||
} else if (!_verifiedData) {
|
||||
} else if (!_botVerifiedData) {
|
||||
return false;
|
||||
}
|
||||
if (!details->iconBgId) {
|
||||
_verifiedData->bg = nullptr;
|
||||
} else if (!_verifiedData->bg
|
||||
|| (_verifiedData->bg->entityData()
|
||||
!= Data::SerializeCustomEmojiId(details->iconBgId))) {
|
||||
return false;
|
||||
}
|
||||
if (!details->iconFgId) {
|
||||
_verifiedData->fg = nullptr;
|
||||
} else if (!_verifiedData->fg
|
||||
|| (_verifiedData->fg->entityData()
|
||||
!= Data::SerializeCustomEmojiId(details->iconFgId))) {
|
||||
if (!details->iconId) {
|
||||
_botVerifiedData->icon = nullptr;
|
||||
} else if (!_botVerifiedData->icon
|
||||
|| (_botVerifiedData->icon->entityData()
|
||||
!= Data::SerializeCustomEmojiId(details->iconId))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PeerBadge::set(
|
||||
not_null<const VerifyDetails*> details,
|
||||
not_null<const BotVerifyDetails*> details,
|
||||
Ui::Text::CustomEmojiFactory factory,
|
||||
Fn<void()> repaint) {
|
||||
if (!_verifiedData) {
|
||||
_verifiedData = std::make_unique<VerifiedData>();
|
||||
if (!_botVerifiedData) {
|
||||
_botVerifiedData = std::make_unique<BotVerifiedData>();
|
||||
}
|
||||
if (details->iconBgId) {
|
||||
_verifiedData->bg = factory(
|
||||
Data::SerializeCustomEmojiId(details->iconBgId),
|
||||
repaint);
|
||||
}
|
||||
if (details->iconFgId) {
|
||||
_verifiedData->fg = factory(
|
||||
Data::SerializeCustomEmojiId(details->iconFgId),
|
||||
if (details->iconId) {
|
||||
_botVerifiedData->icon = factory(
|
||||
Data::SerializeCustomEmojiId(details->iconId),
|
||||
repaint);
|
||||
}
|
||||
}
|
||||
|
@ -265,29 +259,19 @@ int PeerBadge::drawVerified(
|
|||
QPainter &p,
|
||||
QPoint position,
|
||||
const style::VerifiedBadge &st) {
|
||||
const auto data = _verifiedData.get();
|
||||
const auto data = _botVerifiedData.get();
|
||||
if (!data) {
|
||||
return 0;
|
||||
}
|
||||
const auto now = crl::now();
|
||||
auto result = 0;
|
||||
if (const auto bg = data->bg.get()) {
|
||||
bg->paint(p, {
|
||||
.textColor = st.bg->c,
|
||||
.now = now,
|
||||
if (const auto icon = data->icon.get()) {
|
||||
icon->paint(p, {
|
||||
.textColor = st.color->c,
|
||||
.now = crl::now(),
|
||||
.position = position,
|
||||
});
|
||||
result = bg->width();
|
||||
return icon->width();
|
||||
}
|
||||
if (const auto fg = data->fg.get()) {
|
||||
fg->paint(p, {
|
||||
.textColor = st.fg->c,
|
||||
.now = now,
|
||||
.position = position,
|
||||
});
|
||||
result = std::max(result, fg->width());
|
||||
}
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -32,18 +32,17 @@ private:
|
|||
|
||||
};
|
||||
|
||||
struct VerifyDetails {
|
||||
struct BotVerifyDetails {
|
||||
UserId botId = 0;
|
||||
DocumentId iconBgId = 0;
|
||||
DocumentId iconFgId = 0;
|
||||
DocumentId iconId = 0;
|
||||
TextWithEntities description;
|
||||
|
||||
explicit operator bool() const {
|
||||
return iconBgId || iconFgId;
|
||||
return iconId != 0;
|
||||
}
|
||||
friend inline bool operator==(
|
||||
const VerifyDetails &,
|
||||
const VerifyDetails &) = default;
|
||||
const BotVerifyDetails &,
|
||||
const BotVerifyDetails &) = default;
|
||||
};
|
||||
|
||||
class PeerBadge {
|
||||
|
@ -69,9 +68,9 @@ public:
|
|||
const Descriptor &descriptor);
|
||||
void unload();
|
||||
|
||||
[[nodiscard]] bool ready(const VerifyDetails *details) const;
|
||||
[[nodiscard]] bool ready(const BotVerifyDetails *details) const;
|
||||
void set(
|
||||
not_null<const VerifyDetails*> details,
|
||||
not_null<const BotVerifyDetails*> details,
|
||||
Text::CustomEmojiFactory factory,
|
||||
Fn<void()> repaint);
|
||||
|
||||
|
@ -83,10 +82,10 @@ public:
|
|||
|
||||
private:
|
||||
struct EmojiStatus;
|
||||
struct VerifiedData;
|
||||
struct BotVerifiedData;
|
||||
|
||||
std::unique_ptr<EmojiStatus> _emojiStatus;
|
||||
mutable std::unique_ptr<VerifiedData> _verifiedData;
|
||||
mutable std::unique_ptr<BotVerifiedData> _botVerifiedData;
|
||||
|
||||
};
|
||||
|
||||
|
|