1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28:10 +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 block = move |_args: &[Obj], kwargs: &Map| {
let title: Option<TString> = kwargs.get(Qstr::MP_QSTR_title)?.try_into_option()?; 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 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 { let obj = if let Some(t) = title {
LayoutObj::new(Frame::left_aligned( LayoutObj::new(Frame::left_aligned(
t, t,
Dialog::new( Paragraphs::new(Paragraph::new(&theme::TEXT_NORMAL, description)),
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)
})),
),
))? ))?
.into() .into()
} else { } else {
LayoutObj::new(Border::new( LayoutObj::new(Border::new(
theme::borders(), theme::borders(),
Dialog::new( Paragraphs::new(Paragraph::new(&theme::TEXT_DEMIBOLD, description)),
Paragraphs::new(
[Paragraph::new(&theme::TEXT_DEMIBOLD, description).centered()],
),
Empty,
),
))? ))?
.into() .into()
}; };

View File

@ -62,7 +62,7 @@ async def _request_on_host() -> str:
await confirm_action( await confirm_action(
"passphrase_host1_hidden", "passphrase_host1_hidden",
TR.passphrase__hidden_wallet, 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: else:
await confirm_action( await confirm_action(

View File

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

View File

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

File diff suppressed because it is too large Load Diff