diff --git a/core/.changelog.d/2161.changed b/core/.changelog.d/2161.changed new file mode 100644 index 0000000000..7adcda3212 --- /dev/null +++ b/core/.changelog.d/2161.changed @@ -0,0 +1 @@ +Changed design of the path warning screen (model T only). diff --git a/core/embed/rust/src/ui/model_tt/component/dialog.rs b/core/embed/rust/src/ui/model_tt/component/dialog.rs index cb9c3a1c41..2e7f409b67 100644 --- a/core/embed/rust/src/ui/model_tt/component/dialog.rs +++ b/core/embed/rust/src/ui/model_tt/component/dialog.rs @@ -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 { diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index b84e3c193c..4ef825d48d 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -919,6 +919,7 @@ fn new_show_modal( button_style: ButtonStyleSheet, ) -> Result { 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, diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index 2fdc0c28ac..506f278fd2 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -623,6 +623,7 @@ def show_warning( *, title: str, button: str = "CONTINUE", + value: str = "", description: str = "", allow_cancel: bool = False, time_ms: int = 0, diff --git a/core/src/trezor/ui/layouts/tt_v2/__init__.py b/core/src/trezor/ui/layouts/tt_v2/__init__.py index d8e939fdd6..93dce7d109 100644 --- a/core/src/trezor/ui/layouts/tt_v2/__init__.py +++ b/core/src/trezor/ui/layouts/tt_v2/__init__.py @@ -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, + ) )