From 803955b047a0920a2bd72696ea4f69f6c0f02fd7 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sun, 23 Feb 2025 20:37:49 +0200 Subject: [PATCH] feat(core): add `description` to Delizia `confirm_output()` It will allow confirming the vote account for Solana staking. [no changelog] --- .../rust/src/ui/api/firmware_micropython.rs | 4 ++++ .../embed/rust/src/ui/layout_bolt/ui_firmware.rs | 1 + .../rust/src/ui/layout_caesar/ui_firmware.rs | 1 + .../rust/src/ui/layout_delizia/ui_firmware.rs | 16 +++++++++------- core/embed/rust/src/ui/ui_firmware.rs | 1 + core/mocks/generated/trezorui_api.pyi | 1 + core/src/trezor/ui/layouts/delizia/__init__.py | 4 ++++ 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs index 80a4d95837..7eafb6603c 100644 --- a/core/embed/rust/src/ui/api/firmware_micropython.rs +++ b/core/embed/rust/src/ui/api/firmware_micropython.rs @@ -423,6 +423,8 @@ extern "C" fn new_flow_confirm_output(n_args: usize, args: *const Obj, kwargs: * let block = move |_args: &[Obj], kwargs: &Map| { let title: Option = kwargs.get(Qstr::MP_QSTR_title)?.try_into_option()?; let subtitle: Option = kwargs.get(Qstr::MP_QSTR_subtitle)?.try_into_option()?; + let description: Option = + kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?; let message: Obj = kwargs.get(Qstr::MP_QSTR_message)?; let amount: Option = kwargs.get(Qstr::MP_QSTR_amount)?.try_into_option()?; let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?; @@ -466,6 +468,7 @@ extern "C" fn new_flow_confirm_output(n_args: usize, args: *const Obj, kwargs: * let layout = ModelUI::flow_confirm_output( title, subtitle, + description, message, amount, chunkify, @@ -1351,6 +1354,7 @@ pub static mp_module_trezorui_api: Module = obj_module! { /// summary_br_code: ButtonRequestType | None = None, /// summary_br_name: str | None = None, /// cancel_text: str | None = None, + /// description: str | None = None, /// ) -> LayoutObj[UiResult]: /// """Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page.""" Qstr::MP_QSTR_flow_confirm_output => obj_fn_kw!(0, new_flow_confirm_output).as_obj(), 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 d5366345a2..14fca09732 100644 --- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs @@ -539,6 +539,7 @@ impl FirmwareUI for UIBolt { fn flow_confirm_output( _title: Option>, _subtitle: Option>, + _description: Option>, _message: Obj, _amount: Option, _chunkify: bool, 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 31e1348af8..4e4a74fc5a 100644 --- a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs @@ -678,6 +678,7 @@ impl FirmwareUI for UICaesar { fn flow_confirm_output( _title: Option>, _subtitle: Option>, + _description: Option>, _message: Obj, _amount: Option, _chunkify: bool, 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 15a032227e..5a628d92d8 100644 --- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs @@ -510,6 +510,7 @@ impl FirmwareUI for UIDelizia { fn flow_confirm_output( title: Option>, subtitle: Option>, + description: Option>, message: Obj, amount: Option, chunkify: bool, @@ -527,13 +528,14 @@ impl FirmwareUI for UIDelizia { summary_br_name: Option>, cancel_text: Option>, ) -> Result { - let confirm_main = ConfirmValue::new(title.unwrap_or(TString::empty()), message, None) - .with_subtitle(subtitle) - .with_menu_button() - .with_footer(TR::instructions__swipe_up.into(), None) - .with_chunkify(chunkify) - .with_text_mono(text_mono) - .with_swipe_up(); + let confirm_main = + ConfirmValue::new(title.unwrap_or(TString::empty()), message, description) + .with_subtitle(subtitle) + .with_menu_button() + .with_footer(TR::instructions__swipe_up.into(), None) + .with_chunkify(chunkify) + .with_text_mono(text_mono) + .with_swipe_up(); let confirm_amount = amount.map(|amount| { ConfirmValue::new(TR::words__amount.into(), amount, None) diff --git a/core/embed/rust/src/ui/ui_firmware.rs b/core/embed/rust/src/ui/ui_firmware.rs index 683da9a9f9..795e201513 100644 --- a/core/embed/rust/src/ui/ui_firmware.rs +++ b/core/embed/rust/src/ui/ui_firmware.rs @@ -160,6 +160,7 @@ pub trait FirmwareUI { fn flow_confirm_output( title: Option>, subtitle: Option>, + description: Option>, message: Obj, // TODO: replace Obj amount: Option, // TODO: replace Obj chunkify: bool, diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi index 8421976b0b..4728e59a71 100644 --- a/core/mocks/generated/trezorui_api.pyi +++ b/core/mocks/generated/trezorui_api.pyi @@ -327,6 +327,7 @@ def flow_confirm_output( summary_br_code: ButtonRequestType | None = None, summary_br_name: str | None = None, cancel_text: str | None = None, + description: str | None = None, ) -> LayoutObj[UiResult]: """Confirm the recipient, (optionally) confirm the amount and (optionally) confirm the summary and present a Hold to Sign page.""" diff --git a/core/src/trezor/ui/layouts/delizia/__init__.py b/core/src/trezor/ui/layouts/delizia/__init__.py index 43586be0c3..845cc8f63d 100644 --- a/core/src/trezor/ui/layouts/delizia/__init__.py +++ b/core/src/trezor/ui/layouts/delizia/__init__.py @@ -377,6 +377,7 @@ async def confirm_output( source_account: str | None = None, source_account_path: str | None = None, cancel_text: str | None = None, + description: str | None = None, ) -> None: if address_label is not None: title = address_label @@ -407,6 +408,7 @@ async def confirm_output( summary_br_name=None, summary_br_code=None, cancel_text=cancel_text, + description=description, ), br_name=None, ) @@ -789,6 +791,7 @@ if not utils.BITCOIN_ONLY: summary_br_name="confirm_total", summary_br_code=ButtonRequestType.SignTx, cancel_text=TR.buttons__cancel, + description=None, ), None, ) @@ -835,6 +838,7 @@ if not utils.BITCOIN_ONLY: summary_br_name="confirm_total", summary_br_code=ButtonRequestType.SignTx, cancel_text=TR.buttons__cancel, # cancel staking + description=None, ), br_name=None, )