mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-04 21:48:17 +00:00
fixup! refactor(core): model_r confirm_summary
This commit is contained in:
parent
da71639ce3
commit
c3ac40889f
@ -649,10 +649,6 @@ extern "C" fn new_confirm_summary(n_args: usize, args: *const Obj, kwargs: *mut
|
|||||||
.get(Qstr::MP_QSTR_title)
|
.get(Qstr::MP_QSTR_title)
|
||||||
.unwrap_or_else(|_| Obj::const_none())
|
.unwrap_or_else(|_| Obj::const_none())
|
||||||
.try_into_option()?;
|
.try_into_option()?;
|
||||||
let fee_items: Option<Obj> = kwargs
|
|
||||||
.get(Qstr::MP_QSTR_fee_items)
|
|
||||||
.unwrap_or_else(|_| Obj::const_none())
|
|
||||||
.try_into_option()?;
|
|
||||||
let account_items: Option<Obj> = kwargs
|
let account_items: Option<Obj> = kwargs
|
||||||
.get(Qstr::MP_QSTR_account_items)
|
.get(Qstr::MP_QSTR_account_items)
|
||||||
.unwrap_or_else(|_| Obj::const_none())
|
.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)
|
.get(Qstr::MP_QSTR_extra_items)
|
||||||
.unwrap_or_else(|_| Obj::const_none())
|
.unwrap_or_else(|_| Obj::const_none())
|
||||||
.try_into_option()?;
|
.try_into_option()?;
|
||||||
|
let extra_title: Option<TString> = kwargs
|
||||||
|
.get(Qstr::MP_QSTR_extra_title)
|
||||||
|
.unwrap_or_else(|_| Obj::const_none())
|
||||||
|
.try_into_option()?;
|
||||||
let verb_cancel: Option<TString<'static>> = kwargs
|
let verb_cancel: Option<TString<'static>> = kwargs
|
||||||
.get(Qstr::MP_QSTR_verb_cancel)
|
.get(Qstr::MP_QSTR_verb_cancel)
|
||||||
.unwrap_or_else(|_| Obj::const_none())
|
.unwrap_or_else(|_| Obj::const_none())
|
||||||
.try_into_option()?;
|
.try_into_option()?;
|
||||||
|
|
||||||
// collect available info pages
|
// collect available info pages
|
||||||
let mut info_pages: Vec<(TString, Obj), 3> = Vec::new();
|
let mut info_pages: Vec<(TString, Obj), 2> = Vec::new();
|
||||||
if let Some(info) = fee_items {
|
if let Some(info) = extra_items {
|
||||||
unwrap!(info_pages.push((TR::confirm_total__title_fee.into(), info)));
|
// 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 {
|
if let Some(info) = account_items {
|
||||||
unwrap!(info_pages.push((TR::confirm_total__title_sending_from.into(), info)));
|
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
|
// button layouts and actions
|
||||||
let verb_cancel: TString = verb_cancel.unwrap_or(TString::empty());
|
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: str,
|
||||||
/// fee_label: str,
|
/// fee_label: str,
|
||||||
/// title: str | None = None,
|
/// title: str | None = None,
|
||||||
/// fee_items: Iterable[tuple[str, str]] | None = None,
|
|
||||||
/// account_items: Iterable[tuple[str, str]] | None = None,
|
/// account_items: Iterable[tuple[str, str]] | None = None,
|
||||||
/// extra_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,
|
/// verb_cancel: str | None = None,
|
||||||
/// ) -> LayoutObj[UiResult]:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm summary of a transaction."""
|
/// """Confirm summary of a transaction."""
|
||||||
|
@ -752,9 +752,9 @@ def confirm_summary(
|
|||||||
fee: str,
|
fee: str,
|
||||||
fee_label: str,
|
fee_label: str,
|
||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
fee_items: Iterable[tuple[str, str]] | None = None,
|
|
||||||
account_items: Iterable[tuple[str, str]] | None = None,
|
account_items: Iterable[tuple[str, str]] | None = None,
|
||||||
extra_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,
|
verb_cancel: str | None = None,
|
||||||
) -> LayoutObj[UiResult]:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm summary of a transaction."""
|
"""Confirm summary of a transaction."""
|
||||||
|
@ -803,8 +803,9 @@ def confirm_total(
|
|||||||
amount_label=total_label,
|
amount_label=total_label,
|
||||||
fee=fee_amount,
|
fee=fee_amount,
|
||||||
fee_label=fee_label,
|
fee_label=fee_label,
|
||||||
fee_items=fee_info_items or None,
|
|
||||||
account_items=account_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_name,
|
||||||
br_code,
|
br_code,
|
||||||
@ -861,7 +862,8 @@ if not utils.BITCOIN_ONLY:
|
|||||||
amount_label=amount_title,
|
amount_label=amount_title,
|
||||||
fee=maximum_fee,
|
fee=maximum_fee,
|
||||||
fee_label=f"{TR.send__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_name=br_name,
|
||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
@ -886,7 +888,7 @@ if not utils.BITCOIN_ONLY:
|
|||||||
amount_label=amount_title,
|
amount_label=amount_title,
|
||||||
fee=fee,
|
fee=fee,
|
||||||
fee_label=fee_title,
|
fee_label=fee_title,
|
||||||
fee_items=items,
|
extra_items=items, # TODO: extra_title here?
|
||||||
),
|
),
|
||||||
br_name=br_name,
|
br_name=br_name,
|
||||||
br_code=br_code,
|
br_code=br_code,
|
||||||
@ -931,7 +933,8 @@ if not utils.BITCOIN_ONLY:
|
|||||||
amount_label=f"{TR.words__amount}:",
|
amount_label=f"{TR.words__amount}:",
|
||||||
fee=maximum_fee,
|
fee=maximum_fee,
|
||||||
fee_label=f"{TR.send__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:
|
if not is_contract_interaction:
|
||||||
|
Loading…
Reference in New Issue
Block a user