From e08b15ecaf0b1145eaaae7ad4be9dec18f36bdf0 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Tue, 25 Feb 2025 10:51:35 +0200 Subject: [PATCH] feat(core): use `Account info` instead of `Send from` in Delizia staking UI [no changelog] --- core/embed/rust/librust_qstr.h | 1 + core/embed/rust/src/ui/api/firmware_micropython.rs | 3 +++ core/embed/rust/src/ui/layout_bolt/ui_firmware.rs | 1 + core/embed/rust/src/ui/layout_caesar/ui_firmware.rs | 1 + core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs | 3 ++- core/embed/rust/src/ui/layout_delizia/ui_firmware.rs | 2 ++ 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 ++++ 9 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h index 622ff3c297..9fc8def62e 100644 --- a/core/embed/rust/librust_qstr.h +++ b/core/embed/rust/librust_qstr.h @@ -39,6 +39,7 @@ static void _librust_qstrs(void) { MP_QSTR_account; MP_QSTR_account_items; MP_QSTR_account_path; + MP_QSTR_account_title; MP_QSTR_accounts; MP_QSTR_action; MP_QSTR_active; diff --git a/core/embed/rust/src/ui/api/firmware_micropython.rs b/core/embed/rust/src/ui/api/firmware_micropython.rs index 10eea0a46c..b6f16c41a2 100644 --- a/core/embed/rust/src/ui/api/firmware_micropython.rs +++ b/core/embed/rust/src/ui/api/firmware_micropython.rs @@ -438,6 +438,7 @@ extern "C" fn new_flow_confirm_output(n_args: usize, args: *const Obj, kwargs: * let amount: Option = kwargs.get(Qstr::MP_QSTR_amount)?.try_into_option()?; let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?; let text_mono: bool = kwargs.get_or(Qstr::MP_QSTR_text_mono, true)?; + let account_title: TString = kwargs.get(Qstr::MP_QSTR_account_title)?.try_into()?; let account: Option = kwargs.get(Qstr::MP_QSTR_account)?.try_into_option()?; let account_path: Option = kwargs.get(Qstr::MP_QSTR_account_path)?.try_into_option()?; @@ -482,6 +483,7 @@ extern "C" fn new_flow_confirm_output(n_args: usize, args: *const Obj, kwargs: * amount, chunkify, text_mono, + account_title, account, account_path, br_code, @@ -1353,6 +1355,7 @@ pub static mp_module_trezorui_api: Module = obj_module! { /// amount: str | None, /// chunkify: bool, /// text_mono: bool, + /// account_title: str, /// account: str | None, /// account_path: str | None, /// br_code: ButtonRequestType, 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 9cf66c6a0c..8a48a44267 100644 --- a/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_bolt/ui_firmware.rs @@ -559,6 +559,7 @@ impl FirmwareUI for UIBolt { _amount: Option, _chunkify: bool, _text_mono: bool, + _account_title: TString<'static>, _account: Option>, _account_path: Option>, _br_code: u16, 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 629354c4af..12f0a44739 100644 --- a/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_caesar/ui_firmware.rs @@ -685,6 +685,7 @@ impl FirmwareUI for UICaesar { _amount: Option, _chunkify: bool, _text_mono: bool, + _account_title: TString<'static>, _account: Option>, _account_path: Option>, _br_code: u16, diff --git a/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs b/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs index 32fac8f799..27188d9d7e 100644 --- a/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs +++ b/core/embed/rust/src/ui/layout_delizia/flow/confirm_output.rs @@ -218,6 +218,7 @@ fn get_cancel_page( #[allow(clippy::too_many_arguments)] pub fn new_confirm_output( confirm_main: ConfirmValue, + account_title: TString<'static>, account: Option>, account_path: Option>, br_name: TString<'static>, @@ -266,7 +267,7 @@ pub fn new_confirm_output( }); // AccountInfo - let ac = AddressDetails::new(TR::send__send_from.into(), account, account_path)?; + let ac = AddressDetails::new(account_title, account, account_path)?; let account_content = ac.map(|_| Some(FlowMsg::Cancelled)); let res = if let Some(confirm_amount) = confirm_amount { 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 547bbf9c38..f32e53d8d3 100644 --- a/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_delizia/ui_firmware.rs @@ -512,6 +512,7 @@ impl FirmwareUI for UIDelizia { amount: Option, chunkify: bool, text_mono: bool, + account_title: TString<'static>, account: Option>, account_path: Option>, br_code: u16, @@ -584,6 +585,7 @@ impl FirmwareUI for UIDelizia { let flow = flow::confirm_output::new_confirm_output( confirm_main, + account_title, account, account_path, br_name, diff --git a/core/embed/rust/src/ui/ui_firmware.rs b/core/embed/rust/src/ui/ui_firmware.rs index 26b9ca9a07..dd17a4f18d 100644 --- a/core/embed/rust/src/ui/ui_firmware.rs +++ b/core/embed/rust/src/ui/ui_firmware.rs @@ -167,6 +167,7 @@ pub trait FirmwareUI { amount: Option, // TODO: replace Obj chunkify: bool, text_mono: bool, + account_title: TString<'static>, account: Option>, account_path: Option>, br_code: u16, diff --git a/core/mocks/generated/trezorui_api.pyi b/core/mocks/generated/trezorui_api.pyi index cd1c1632f4..b2d011c64b 100644 --- a/core/mocks/generated/trezorui_api.pyi +++ b/core/mocks/generated/trezorui_api.pyi @@ -317,6 +317,7 @@ def flow_confirm_output( amount: str | None, chunkify: bool, text_mono: bool, + account_title: str, account: str | None, account_path: str | None, br_code: ButtonRequestType, diff --git a/core/src/trezor/ui/layouts/delizia/__init__.py b/core/src/trezor/ui/layouts/delizia/__init__.py index cbd62e668d..a5db5e0c2b 100644 --- a/core/src/trezor/ui/layouts/delizia/__init__.py +++ b/core/src/trezor/ui/layouts/delizia/__init__.py @@ -396,6 +396,7 @@ async def confirm_output( amount=amount, chunkify=chunkify, text_mono=True, + account_title=TR.send__send_from, account=source_account, account_path=source_account_path, address_item=None, @@ -773,6 +774,7 @@ if not utils.BITCOIN_ONLY: amount=None, chunkify=(chunkify if recipient else False), text_mono=True, + account_title=TR.send__send_from, account=account, account_path=account_path, address_item=None, @@ -823,6 +825,7 @@ if not utils.BITCOIN_ONLY: amount=None, chunkify=False, text_mono=False, + account_title=TR.address_details__account_info, account=account, account_path=account_path, br_code=br_code, @@ -888,6 +891,7 @@ if not utils.BITCOIN_ONLY: amount=None, chunkify=True, text_mono=True, + account_title=TR.address_details__account_info, account=account, account_path=account_path, br_code=br_code,