Used fallback name for passkeys without name in list from settings.

This commit is contained in:
23rd
2025-12-10 11:15:56 +03:00
parent 3f3b2cb2ba
commit 29b714dd5f
2 changed files with 11 additions and 4 deletions

View File

@@ -1273,7 +1273,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"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.";
"lng_settings_passkey_unknown" = "Passkey";
"lng_settings_quick_dialog_action_title" = "Chat list quick action";
"lng_settings_quick_dialog_action_about" = "Choose the action you want to perform when you middle-click or swipe left in the chat list.";

View File

@@ -317,17 +317,24 @@ void Passkeys::setupContent(
lt_date,
formatDateTime(passkey.date));
const auto nameText = button->lifetime().make_state<
Ui::Text::String>(*nameStyle, passkey.name);
Ui::Text::String>(
*nameStyle,
passkey.name.isEmpty()
? tr::lng_settings_passkey_unknown(tr::now)
: passkey.name);
const auto dateText = button->lifetime().make_state<
Ui::Text::String>(st::defaultTextStyle, date);
button->paintOn([=](QPainter &p) {
const auto iconTop = (st.height - iconSize) / 2;
if (emojiPtr) {
const auto emojiY = (st.height - iconSize) / 2;
emojiPtr->paint(p, {
.textColor = st.nameFg->c,
.now = crl::now(),
.position = QPoint(iconLeft, emojiY),
.position = QPoint(iconLeft, iconTop),
});
} else {
const auto w = button->width();
st::settingsIconPasskeys.paint(p, iconLeft, iconTop, w);
}
const auto textLeft = st::settingsButton.padding.left();
const auto textWidth = button->width() - textLeft