Returned display of button in box for passkey creation when unsupported.

This commit is contained in:
23rd
2025-12-13 05:25:07 +03:00
committed by John Preston
parent 9cc30741d9
commit e0159c32cc
2 changed files with 11 additions and 2 deletions
+1
View File
@@ -1270,6 +1270,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_passkeys_none_info3_title" = "Store Passkey securely";
"lng_settings_passkeys_none_info3_about" = "Your passkey is stored safely in the cloud service you choose.";
"lng_settings_passkeys_none_button" = "Create Passkey";
"lng_settings_passkeys_none_button_unsupported" = "Unsupported";
"lng_settings_passkeys_created" = "Created {date}";
"lng_settings_passkeys_last_used" = "Last used {date}";
"lng_settings_passkeys_unsigned_error" = "Passkeys are not available in unsigned builds. Please use an official signed version of Telegram Desktop.";
@@ -171,12 +171,15 @@ void PasskeysNoneBox(
}
Ui::AddSkip(content);
Ui::AddSkip(content);
if (session->passkeys().canRegister()) {
{
const auto &st = st::premiumPreviewDoubledLimitsBox;
const auto canRegister = session->passkeys().canRegister();
box->setStyle(st);
auto button = object_ptr<Ui::RoundButton>(
box,
tr::lng_settings_passkeys_none_button(),
canRegister
? tr::lng_settings_passkeys_none_button()
: tr::lng_settings_passkeys_none_button_unsupported(),
st::defaultActiveButton);
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
button->resizeToWidth(box->width()
@@ -202,6 +205,11 @@ void PasskeysNoneBox(
});
});
});
if (!canRegister) {
button->setAttribute(Qt::WA_TransparentForMouseEvents);
button->setTextFgOverride(
anim::with_alpha(button->st().textFg->c, 0.5));
}
box->addButton(std::move(button));
}
}