mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
feat(core): revise path warning on model T
This commit is contained in:
parent
c1492159f0
commit
7e9f127aec
1
core/.changelog.d/2161.changed
Normal file
1
core/.changelog.d/2161.changed
Normal file
@ -0,0 +1 @@
|
||||
Changed design of the path warning screen (model T only).
|
@ -134,6 +134,10 @@ where
|
||||
self.with_text(&theme::TEXT_NORMAL_OFF_WHITE, description)
|
||||
}
|
||||
|
||||
pub fn with_value(self, value: T) -> Self {
|
||||
self.with_text(&theme::TEXT_MONO, value)
|
||||
}
|
||||
|
||||
pub fn new_shares(lines: [T; 4], controls: U) -> Self {
|
||||
let [l0, l1, l2, l3] = lines;
|
||||
Self {
|
||||
|
@ -919,6 +919,7 @@ fn new_show_modal(
|
||||
button_style: ButtonStyleSheet,
|
||||
) -> Result<Obj, Error> {
|
||||
let title: StrBuffer = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||
let value: StrBuffer = kwargs.get_or(Qstr::MP_QSTR_value, StrBuffer::empty())?;
|
||||
let description: StrBuffer = kwargs.get_or(Qstr::MP_QSTR_description, StrBuffer::empty())?;
|
||||
let button: StrBuffer = kwargs.get_or(Qstr::MP_QSTR_button, "CONTINUE".into())?;
|
||||
let allow_cancel: bool = kwargs.get_or(Qstr::MP_QSTR_allow_cancel, true)?;
|
||||
@ -928,7 +929,12 @@ fn new_show_modal(
|
||||
let obj = if no_buttons && time_ms == 0 {
|
||||
// No buttons and no timer, used when we only want to draw the dialog once and
|
||||
// then throw away the layout object.
|
||||
LayoutObj::new(IconDialog::new(icon, title, Empty).with_description(description))?.into()
|
||||
LayoutObj::new(
|
||||
IconDialog::new(icon, title, Empty)
|
||||
.with_value(value)
|
||||
.with_description(description),
|
||||
)?
|
||||
.into()
|
||||
} else if no_buttons && time_ms > 0 {
|
||||
// Timeout, no buttons.
|
||||
LayoutObj::new(
|
||||
@ -937,6 +943,7 @@ fn new_show_modal(
|
||||
title,
|
||||
Timeout::new(time_ms).map(|_| Some(CancelConfirmMsg::Confirmed)),
|
||||
)
|
||||
.with_value(value)
|
||||
.with_description(description),
|
||||
)?
|
||||
.into()
|
||||
@ -952,6 +959,7 @@ fn new_show_modal(
|
||||
false,
|
||||
),
|
||||
)
|
||||
.with_value(value)
|
||||
.with_description(description),
|
||||
)?
|
||||
.into()
|
||||
@ -965,6 +973,7 @@ fn new_show_modal(
|
||||
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
|
||||
})),
|
||||
)
|
||||
.with_value(value)
|
||||
.with_description(description),
|
||||
)?
|
||||
.into()
|
||||
@ -1788,6 +1797,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
||||
/// *,
|
||||
/// title: str,
|
||||
/// button: str = "CONTINUE",
|
||||
/// value: str = "",
|
||||
/// description: str = "",
|
||||
/// allow_cancel: bool = False,
|
||||
/// time_ms: int = 0,
|
||||
|
@ -623,6 +623,7 @@ def show_warning(
|
||||
*,
|
||||
title: str,
|
||||
button: str = "CONTINUE",
|
||||
value: str = "",
|
||||
description: str = "",
|
||||
allow_cancel: bool = False,
|
||||
time_ms: int = 0,
|
||||
|
@ -365,12 +365,24 @@ async def confirm_path_warning(
|
||||
path: str,
|
||||
path_type: str | None = None,
|
||||
) -> None:
|
||||
title = "Unknown path" if not path_type else f"Unknown {path_type.lower()}"
|
||||
await show_warning(
|
||||
"path_warning",
|
||||
title,
|
||||
path,
|
||||
br_code=ButtonRequestType.UnknownDerivationPath,
|
||||
title = (
|
||||
"Wrong derivation path for selected account."
|
||||
if not path_type
|
||||
else f"Unknown {path_type.lower()}."
|
||||
)
|
||||
await raise_if_not_confirmed(
|
||||
interact(
|
||||
RustLayout(
|
||||
trezorui2.show_warning(
|
||||
title=title,
|
||||
value=path,
|
||||
description="Continue anyway?",
|
||||
button="CONTINUE",
|
||||
)
|
||||
),
|
||||
"path_warning",
|
||||
br_code=ButtonRequestType.UnknownDerivationPath,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user