Skip to content

Commit

Permalink
refactor(core): get rid of description_font_green
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
ibz committed Nov 13, 2024
1 parent 5b12ade commit a623611
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 20 deletions.
1 change: 0 additions & 1 deletion core/embed/rust/librust_qstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ static void _librust_qstrs(void) {
MP_QSTR_decode;
MP_QSTR_deinit;
MP_QSTR_description;
MP_QSTR_description_font_green;
MP_QSTR_details_title;
MP_QSTR_device_name__change_template;
MP_QSTR_device_name__title;
Expand Down
18 changes: 10 additions & 8 deletions core/embed/rust/src/ui/model_mercury/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,10 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
let block = move |_args: &[Obj], kwargs: &Map| {
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
let description: Option<TString> =
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
let description_font_green: bool =
kwargs.get_or(Qstr::MP_QSTR_description_font_green, false)?;
let description: Option<TString> = kwargs
.get(Qstr::MP_QSTR_description)
.unwrap_or_else(|_| Obj::const_none())
.try_into_option()?;
let text_mono: bool = kwargs.get_or(Qstr::MP_QSTR_text_mono, true)?;
let extra: Option<TString> = kwargs
.get(Qstr::MP_QSTR_extra)
Expand Down Expand Up @@ -408,10 +408,13 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
.unwrap_or_else(|_| Obj::const_none())
.try_into_option()?;

let description_font = if description_font_green {
&theme::TEXT_SUB_GREEN_LIME
let (description, description_font) = if page_limit == Some(1) {
(
Some(TR::instructions__view_all_data.into()),
&theme::TEXT_SUB_GREEN_LIME,
)
} else {
&theme::TEXT_NORMAL
(description, &theme::TEXT_NORMAL)
};

ConfirmBlobParams::new(
Expand Down Expand Up @@ -1248,7 +1251,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str,
/// data: str | bytes,
/// description: str | None,
/// description_font_green: bool = False,
/// text_mono: bool = True,
/// extra: str | None = None,
/// subtitle: str | None = None,
Expand Down
1 change: 0 additions & 1 deletion core/embed/rust/src/ui/model_tr/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str,
/// data: str | bytes,
/// description: str | None,
/// description_font_green: bool = False,
/// text_mono: bool = True,
/// extra: str | None = None,
/// subtitle: str | None = None,
Expand Down
1 change: 0 additions & 1 deletion core/embed/rust/src/ui/model_tt/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str,
/// data: str | bytes,
/// description: str | None,
/// description_font_green: bool = False,
/// text_mono: bool = True,
/// extra: str | None = None,
/// subtitle: str | None = None,
Expand Down
3 changes: 0 additions & 3 deletions core/mocks/generated/trezorui2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def confirm_blob(
title: str,
data: str | bytes,
description: str | None,
description_font_green: bool = False,
text_mono: bool = True,
extra: str | None = None,
subtitle: str | None = None,
Expand Down Expand Up @@ -632,7 +631,6 @@ def confirm_blob(
title: str,
data: str | bytes,
description: str | None,
description_font_green: bool = False,
text_mono: bool = True,
extra: str | None = None,
subtitle: str | None = None,
Expand Down Expand Up @@ -1204,7 +1202,6 @@ def confirm_blob(
title: str,
data: str | bytes,
description: str | None,
description_font_green: bool = False,
text_mono: bool = True,
extra: str | None = None,
subtitle: str | None = None,
Expand Down
7 changes: 3 additions & 4 deletions core/src/trezor/ui/layouts/mercury/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,8 @@ def confirm_blob(
main_layout = trezorui2.confirm_blob(
title=title,
data=data,
description=TR.instructions__view_all_data,
description_font_green=True,
subtitle=subtitle,
description=None,
subtitle=description,
verb=verb,
verb_cancel=verb_cancel,
verb_info=TR.buttons__view_all_data,
Expand Down Expand Up @@ -539,7 +538,7 @@ def confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
"confirm_data",
TR.ethereum__title_input_data,
data,
subtitle=TR.ethereum__data_size_template.format(data_total),
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=TR.send__cancel_sign,
br_code=ButtonRequestType.SignTx,
Expand Down
2 changes: 1 addition & 1 deletion core/src/trezor/ui/layouts/tr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ def confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
"confirm_data",
TR.ethereum__title_input_data,
data,
subtitle=TR.ethereum__data_size_template.format(data_total),
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=None,
br_code=ButtonRequestType.SignTx,
Expand Down
2 changes: 1 addition & 1 deletion core/src/trezor/ui/layouts/tt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
"confirm_data",
TR.ethereum__title_input_data,
data,
subtitle=TR.ethereum__data_size_template.format(data_total),
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=None,
br_code=ButtonRequestType.SignTx,
Expand Down

0 comments on commit a623611

Please sign in to comment.