diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index d68b1fe481..64ea921bb2 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -649,10 +649,6 @@ extern "C" fn new_confirm_summary(n_args: usize, args: *const Obj, kwargs: *mut .get(Qstr::MP_QSTR_title) .unwrap_or_else(|_| Obj::const_none()) .try_into_option()?; - let fee_items: Option = kwargs - .get(Qstr::MP_QSTR_fee_items) - .unwrap_or_else(|_| Obj::const_none()) - .try_into_option()?; let account_items: Option = kwargs .get(Qstr::MP_QSTR_account_items) .unwrap_or_else(|_| Obj::const_none()) @@ -661,22 +657,25 @@ extern "C" fn new_confirm_summary(n_args: usize, args: *const Obj, kwargs: *mut .get(Qstr::MP_QSTR_extra_items) .unwrap_or_else(|_| Obj::const_none()) .try_into_option()?; + let extra_title: Option = kwargs + .get(Qstr::MP_QSTR_extra_title) + .unwrap_or_else(|_| Obj::const_none()) + .try_into_option()?; let verb_cancel: Option> = kwargs .get(Qstr::MP_QSTR_verb_cancel) .unwrap_or_else(|_| Obj::const_none()) .try_into_option()?; // collect available info pages - let mut info_pages: Vec<(TString, Obj), 3> = Vec::new(); - if let Some(info) = fee_items { - unwrap!(info_pages.push((TR::confirm_total__title_fee.into(), info))); + let mut info_pages: Vec<(TString, Obj), 2> = Vec::new(); + if let Some(info) = extra_items { + // put extra items first as it's typically used for fee info + let extra_title = extra_title.unwrap_or(TR::words__title_information.into()); + unwrap!(info_pages.push((extra_title, info))); } if let Some(info) = account_items { unwrap!(info_pages.push((TR::confirm_total__title_sending_from.into(), info))); } - if let Some(info) = extra_items { - unwrap!(info_pages.push((TR::words__title_information.into(), info))); - } // button layouts and actions let verb_cancel: TString = verb_cancel.unwrap_or(TString::empty()); @@ -1795,9 +1794,9 @@ pub static mp_module_trezorui2: Module = obj_module! { /// fee: str, /// fee_label: str, /// title: str | None = None, - /// fee_items: Iterable[tuple[str, str]] | None = None, /// account_items: Iterable[tuple[str, str]] | None = None, /// extra_items: Iterable[tuple[str, str]] | None = None, + /// extra_title: str | None = None, /// verb_cancel: str | None = None, /// ) -> LayoutObj[UiResult]: /// """Confirm summary of a transaction.""" diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index 87e45c6ef1..d83c908960 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -752,9 +752,9 @@ def confirm_summary( fee: str, fee_label: str, title: str | None = None, - fee_items: Iterable[tuple[str, str]] | None = None, account_items: Iterable[tuple[str, str]] | None = None, extra_items: Iterable[tuple[str, str]] | None = None, + extra_title: str | None = None, verb_cancel: str | None = None, ) -> LayoutObj[UiResult]: """Confirm summary of a transaction.""" diff --git a/core/src/trezor/ui/layouts/tr/__init__.py b/core/src/trezor/ui/layouts/tr/__init__.py index dd878f6af5..4d29bcb632 100644 --- a/core/src/trezor/ui/layouts/tr/__init__.py +++ b/core/src/trezor/ui/layouts/tr/__init__.py @@ -803,8 +803,9 @@ def confirm_total( amount_label=total_label, fee=fee_amount, fee_label=fee_label, - fee_items=fee_info_items or None, account_items=account_info_items or None, + extra_items=fee_info_items or None, + extra_title=TR.confirm_total__title_fee, ), br_name, br_code, @@ -861,7 +862,8 @@ if not utils.BITCOIN_ONLY: amount_label=amount_title, fee=maximum_fee, fee_label=f"{TR.send__maximum_fee}:", - fee_items=[(f"{k}:", v) for (k, v) in info_items], + extra_items=[(f"{k}:", v) for (k, v) in info_items], + extra_title=TR.confirm_total__title_fee, ), br_name=br_name, br_code=br_code, @@ -886,7 +888,7 @@ if not utils.BITCOIN_ONLY: amount_label=amount_title, fee=fee, fee_label=fee_title, - fee_items=items, + extra_items=items, # TODO: extra_title here? ), br_name=br_name, br_code=br_code, @@ -931,7 +933,8 @@ if not utils.BITCOIN_ONLY: amount_label=f"{TR.words__amount}:", fee=maximum_fee, fee_label=f"{TR.send__maximum_fee}:", - fee_items=[(f"{k}:", v) for (k, v) in fee_info_items], + extra_items=[(f"{k}:", v) for (k, v) in fee_info_items], + extra_title=TR.confirm_total__title_fee, ) if not is_contract_interaction: