diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs index 2309bf4885..4ce99f4bbd 100644 --- a/core/embed/rust/src/ui/api/firmware_micropython.rs +++ b/core/embed/rust/src/ui/api/firmware_micropython.rs @@ -149,6 +149,7 @@ extern "C" fn new_confirm_value(n_args: usize, args: *const Obj, kwargs: *mut Ma .get(Qstr::MP_QSTR_warning_footer) .unwrap_or_else(|_| Obj::const_none()) .try_into_option()?; + let external_menu: bool = kwargs.get_or(Qstr::MP_QSTR_external_menu, false)?; let layout_obj = ModelUI::confirm_value( title, @@ -166,6 +167,7 @@ extern "C" fn new_confirm_value(n_args: usize, args: *const Obj, kwargs: *mut Ma prompt_screen, cancel, warning_footer, + external_menu, )?; Ok(layout_obj.into()) }; @@ -1387,6 +1389,7 @@ pub static mp_module_trezorui_api: Module = obj_module! { /// prompt_screen: bool = False, /// cancel: bool = False, /// warning_footer: str | None = None, + /// external_menu: bool = False, /// ) -> LayoutObj[UiResult]: /// """Confirm a generic piece of information on the screen. /// The value can either be human readable text (`is_data=False`) diff --git a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs index 52369d6ca0..3f53651509 100644 --- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs @@ -119,6 +119,7 @@ impl FirmwareUI for UIBolt { _prompt_screen: bool, _cancel: bool, _warning_footer: Option>, + _external_menu: bool, ) -> Result, Error> { ConfirmValue::new(title, value, description, verb, verb_cancel, hold) .with_text_mono(is_data) diff --git a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs index 98a2dd38f2..de1db0400e 100644 --- a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs @@ -149,6 +149,7 @@ impl FirmwareUI for UICaesar { _prompt_screen: bool, _cancel: bool, _warning_footer: Option>, + _external_menu: bool, ) -> Result, Error> { let paragraphs = ConfirmValueParams { description: description.unwrap_or("".into()), diff --git a/core/embed/rust/src/ui/layout_delizia/flow/util.rs b/core/embed/rust/src/ui/layout_delizia/flow/util.rs index a6e06fe123..d2539d5f9b 100644 --- a/core/embed/rust/src/ui/layout_delizia/flow/util.rs +++ b/core/embed/rust/src/ui/layout_delizia/flow/util.rs @@ -58,6 +58,7 @@ pub struct ConfirmValue { swipe_right: bool, frame_margin: usize, cancel: bool, + external_menu: bool, } impl ConfirmValue { @@ -89,6 +90,7 @@ impl ConfirmValue { swipe_right: false, frame_margin: 0, cancel: false, + external_menu: false, } } @@ -170,6 +172,11 @@ impl ConfirmValue { self } + pub const fn with_external_menu(mut self, external_menu: bool) -> Self { + self.external_menu = external_menu; + self.with_menu_button() + } + pub const fn with_footer( mut self, instruction: TString<'static>, @@ -300,7 +307,9 @@ impl ConfirmValue { } .into_paragraphs(); - let confirm_extra = if self.cancel { + let confirm_extra = if self.external_menu { + ConfirmActionExtra::ExternalMenu + } else if self.cancel { ConfirmActionExtra::Cancel } else { ConfirmActionExtra::Menu( diff --git a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs index 7ca6339eb5..6906ca3836 100644 --- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs @@ -106,6 +106,7 @@ impl FirmwareUI for UIDelizia { prompt_screen: bool, cancel: bool, _warning_footer: Option>, + external_menu: bool, ) -> Result, Error> { ConfirmValue::new(title, value, description) .with_description_font(&theme::TEXT_SUB_GREY) @@ -123,6 +124,7 @@ impl FirmwareUI for UIDelizia { .with_page_counter(page_counter) .with_cancel(cancel) .with_prompt(prompt_screen) + .with_external_menu(external_menu) .with_hold(hold) .into_flow() .and_then(LayoutObj::new_root) diff --git a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs index 7c278e3f98..2b629a4679 100644 --- a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs @@ -407,6 +407,7 @@ impl FirmwareUI for UIEckhart { _prompt_screen: bool, cancel: bool, warning_footer: Option>, + _external_menu: bool, ) -> Result, Error> { let paragraphs = ConfirmValueParams { description: description.unwrap_or("".into()), diff --git a/core/embed/rust/src/ui/ui_firmware.rs b/core/embed/rust/src/ui/ui_firmware.rs index 05eaf409ee..e5bc13e5fa 100644 --- a/core/embed/rust/src/ui/ui_firmware.rs +++ b/core/embed/rust/src/ui/ui_firmware.rs @@ -61,6 +61,7 @@ pub trait FirmwareUI { prompt_screen: bool, cancel: bool, warning_footer: Option>, + external_menu: bool, ) -> Result, Error>; // TODO: return LayoutMaybeTrace fn confirm_value_intro( diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi index f2cbd5e6cf..f7fc743682 100644 --- a/core/mocks/generated/trezorui_api.pyi +++ b/core/mocks/generated/trezorui_api.pyi @@ -146,6 +146,7 @@ def confirm_value( prompt_screen: bool = False, cancel: bool = False, warning_footer: str | None = None, + external_menu: bool = False, ) -> LayoutObj[UiResult]: """Confirm a generic piece of information on the screen. The value can either be human readable text (`is_data=False`)