1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

fix(core/ui): T3T1: improve passphrase prompt

[no changelog]
This commit is contained in:
Martin Milata 2024-06-03 23:10:44 +02:00 committed by matejcik
parent 9ee670a440
commit e268f79749
5 changed files with 2744 additions and 2766 deletions

View File

@ -1020,39 +1020,17 @@ extern "C" fn new_show_simple(n_args: usize, args: *const Obj, kwargs: *mut Map)
let block = move |_args: &[Obj], kwargs: &Map| {
let title: Option<TString> = kwargs.get(Qstr::MP_QSTR_title)?.try_into_option()?;
let description: TString = kwargs.get_or(Qstr::MP_QSTR_description, "".into())?;
let button: TString = kwargs.get_or(Qstr::MP_QSTR_button, "".into())?;
let obj = if let Some(t) = title {
LayoutObj::new(Frame::left_aligned(
t,
Dialog::new(
Paragraphs::new([Paragraph::new(&theme::TEXT_NORMAL, description)]),
theme::button_bar(Button::with_text(button).map(|msg| {
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
})),
),
))?
.into()
} else if !button.is_empty() {
LayoutObj::new(Border::new(
theme::borders(),
Dialog::new(
Paragraphs::new([Paragraph::new(&theme::TEXT_NORMAL, description)]),
theme::button_bar(Button::with_text(button).map(|msg| {
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
})),
),
Paragraphs::new(Paragraph::new(&theme::TEXT_NORMAL, description)),
))?
.into()
} else {
LayoutObj::new(Border::new(
theme::borders(),
Dialog::new(
Paragraphs::new(
[Paragraph::new(&theme::TEXT_DEMIBOLD, description).centered()],
),
Empty,
),
Paragraphs::new(Paragraph::new(&theme::TEXT_DEMIBOLD, description)),
))?
.into()
};

View File

@ -62,7 +62,7 @@ async def _request_on_host() -> str:
await confirm_action(
"passphrase_host1_hidden",
TR.passphrase__hidden_wallet,
description=f"{TR.passphrase__access_hidden_wallet}\n{TR.passphrase__from_host_not_shown}",
description=TR.passphrase__from_host_not_shown,
)
else:
await confirm_action(

View File

@ -728,7 +728,6 @@ async def confirm_blob(
ask_pagination: bool = False,
chunkify: bool = False,
) -> None:
verb = verb or TR.buttons__confirm # def_arg
layout = RustLayout(
trezorui2.confirm_blob(
title=title,

View File

@ -398,9 +398,10 @@ def test_hide_passphrase_from_host(client: Client):
def input_flow():
yield
TR.assert_in(
client.debug.wait_layout().text_content(),
"passphrase__access_hidden_wallet",
content = client.debug.wait_layout().text_content().lower()
assert any(
(s[:50].lower() in content)
for s in TR.translate("passphrase__from_host_not_shown")
)
if client.model in (models.T2T1, models.T3T1):
client.debug.press_yes()

File diff suppressed because it is too large Load Diff