Show ID in profile info

This commit is contained in:
Eric Kotato 2019-09-29 21:38:51 +03:00
parent a25aaaf531
commit a562e8b195
4 changed files with 40 additions and 0 deletions

View file

@ -2227,5 +2227,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ktg_about_text3" = "Visit {channel_link} or {faq_link} for more info.";
"ktg_about_text3_channel" = "Kotatogram channel";
"ktg_copy_btn_callback" = "Copy callback data";
"ktg_profile_copy_id" = "Copy ID";
"ktg_profile_bot_id" = "Bot ID";
"ktg_profile_user_id" = "User ID";
"ktg_profile_group_id" = "Group ID";
"ktg_profile_supergroup_id" = "Supergroup ID";
"ktg_profile_channel_id" = "Channel ID";
// Keys finished

View file

@ -274,6 +274,18 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
UsernameValue(user),
tr::lng_context_copy_mention(tr::now));
if (user->isBot()) {
addInfoOneLine(
tr::ktg_profile_bot_id(),
IDValue(user),
tr::ktg_profile_copy_id(tr::now));
} else {
addInfoOneLine(
tr::ktg_profile_user_id(),
IDValue(user),
tr::ktg_profile_copy_id(tr::now));
}
const auto window = &_controller->parentController()->window();
AddMainButton(
result,
@ -324,6 +336,23 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
)->setLinksTrusted();
}
if (_peer->isChat()) {
addInfoOneLine(
tr::ktg_profile_group_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
} else if (_peer->isMegagroup()) {
addInfoOneLine(
tr::ktg_profile_supergroup_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
} else {
addInfoOneLine(
tr::ktg_profile_channel_id(),
IDValue(_peer),
tr::ktg_profile_copy_id(tr::now));
}
addInfoLine(tr::lng_info_about_label(), AboutValue(_peer));
}
if (!_peer->isSelf()) {

View file

@ -45,6 +45,10 @@ auto PlainUsernameValue(not_null<PeerData*> peer) {
} // namespace
rpl::producer<TextWithEntities> IDValue(not_null<PeerData*> peer) {
return rpl::single(QString("%1").arg(peer->bareId())) | Ui::Text::ToWithEntities();
}
rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer) {
return Notify::PeerUpdateValue(
peer,

View file

@ -35,6 +35,7 @@ inline auto ToSingleLine() {
rpl::producer<not_null<PeerData*>> MigratedOrMeValue(
not_null<PeerData*> peer);
rpl::producer<TextWithEntities> IDValue(not_null<PeerData*> peer);
rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer);
rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user);
rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user);