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) {
const auto copyUsername = Ui::CreateChild<Ui::IconButton>(
usernameLine.text->parentWidget(),
user->isBot()
? st::infoProfileLabeledButtonCopy
: st::infoProfileLabeledButtonQr);
st::infoProfileLabeledButtonQr);
fitLabelToButton(copyUsername, usernameLine.text);
copyUsername->setClickedCallback([=] {
if (!user->isBot()) {
controller->show(
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));
}
controller->show(
Box(Ui::FillPeerQrBox, user, std::nullopt, nullptr));
return false;
});
} else {