// This is the source code of AyuGram for Desktop. // // We do not and cannot prevent the use of our code, // but be respectful and credit the original author. // // Copyright @Radolyn, 2026 #include "ayu/ui/utils/ayu_profile_values.h" #include "ayu/ayu_settings.h" #include "ayu/utils/telegram_helpers.h" #include "data/data_peer.h" #include "lang/lang_text_entity.h" constexpr auto kMaxChannelId = -1000000000000; QString IDString(const not_null peer) { auto resultId = QString::number(getBareID(peer)); const auto &settings = AyuSettings::getInstance(); if (settings.showPeerId() == PeerIdDisplay::BotApi) { if (peer->isChannel()) { resultId = QString::number(peerToChannel(peer->id).bare - kMaxChannelId).prepend("-"); } else if (peer->isChat()) { resultId = resultId.prepend("-"); } } return resultId; } QString IDString(MsgId topicRootId) { return QString::number(topicRootId.bare); } rpl::producer IDValue(not_null peer) { return AyuSettings::getInstance().showPeerIdValue( ) | rpl::map([=](PeerIdDisplay display) { return (display == PeerIdDisplay::Hidden) ? TextWithEntities() : tr::marked(IDString(peer)); }); } rpl::producer IDValue(MsgId topicRootId) { return AyuSettings::getInstance().showPeerIdValue( ) | rpl::map([=](PeerIdDisplay display) { return (display == PeerIdDisplay::Hidden) ? TextWithEntities() : tr::marked(IDString(topicRootId)); }); }