Added ability to share QR code of bots.

This commit is contained in:
23rd 2024-09-27 18:55:54 +03:00 committed by John Preston
parent fbaa79f168
commit 7cc9a0b9aa

View file

@ -1121,22 +1121,11 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
if (user) { if (user) {
const auto copyUsername = Ui::CreateChild<Ui::IconButton>( const auto copyUsername = Ui::CreateChild<Ui::IconButton>(
usernameLine.text->parentWidget(), usernameLine.text->parentWidget(),
user->isBot() st::infoProfileLabeledButtonQr);
? st::infoProfileLabeledButtonCopy
: st::infoProfileLabeledButtonQr);
fitLabelToButton(copyUsername, usernameLine.text); fitLabelToButton(copyUsername, usernameLine.text);
copyUsername->setClickedCallback([=] { copyUsername->setClickedCallback([=] {
if (!user->isBot()) { controller->show(
controller->show( Box(Ui::FillPeerQrBox, user, std::nullopt, nullptr));
Box(Ui::FillPeerQrBox, user, std::nullopt, nullptr));
return false;
}
const auto link = user->session().createInternalLinkFull(
user->username());
if (!link.isEmpty()) {
QGuiApplication::clipboard()->setText(link);
controller->showToast(tr::lng_username_copied(tr::now));
}
return false; return false;
}); });
} else { } else {