1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-25 16:08:32 +00:00

feat(delizia): allow external menu on confirm_value

[no changelog]
This commit is contained in:
Ioan Bizău 2025-07-07 15:05:01 +02:00 committed by Ioan Bizău
parent 5a29fed99f
commit 00d8683e77
8 changed files with 20 additions and 1 deletions

View File

@ -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`)

View File

@ -119,6 +119,7 @@ impl FirmwareUI for UIBolt {
_prompt_screen: bool,
_cancel: bool,
_warning_footer: Option<TString<'static>>,
_external_menu: bool,
) -> Result<Gc<LayoutObj>, Error> {
ConfirmValue::new(title, value, description, verb, verb_cancel, hold)
.with_text_mono(is_data)

View File

@ -149,6 +149,7 @@ impl FirmwareUI for UICaesar {
_prompt_screen: bool,
_cancel: bool,
_warning_footer: Option<TString<'static>>,
_external_menu: bool,
) -> Result<Gc<LayoutObj>, Error> {
let paragraphs = ConfirmValueParams {
description: description.unwrap_or("".into()),

View File

@ -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(

View File

@ -106,6 +106,7 @@ impl FirmwareUI for UIDelizia {
prompt_screen: bool,
cancel: bool,
_warning_footer: Option<TString<'static>>,
external_menu: bool,
) -> Result<Gc<LayoutObj>, 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)

View File

@ -407,6 +407,7 @@ impl FirmwareUI for UIEckhart {
_prompt_screen: bool,
cancel: bool,
warning_footer: Option<TString<'static>>,
_external_menu: bool,
) -> Result<Gc<LayoutObj>, Error> {
let paragraphs = ConfirmValueParams {
description: description.unwrap_or("".into()),

View File

@ -61,6 +61,7 @@ pub trait FirmwareUI {
prompt_screen: bool,
cancel: bool,
warning_footer: Option<TString<'static>>,
external_menu: bool,
) -> Result<Gc<LayoutObj>, Error>; // TODO: return LayoutMaybeTrace
fn confirm_value_intro(

View File

@ -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`)