Skip to content

Commit

Permalink
refactor(core): remove confirm_blob unused params
Browse files Browse the repository at this point in the history
  • Loading branch information
ibz committed Nov 21, 2024
1 parent 2799415 commit 8d6f5e3
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 43 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 @@ -742,7 +742,6 @@ static void _librust_qstrs(void) {
MP_QSTR_value;
MP_QSTR_verb;
MP_QSTR_verb_cancel;
MP_QSTR_verb_info;
MP_QSTR_verify;
MP_QSTR_version;
MP_QSTR_warning;
Expand Down
14 changes: 1 addition & 13 deletions core/embed/rust/src/ui/model_mercury/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
.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)
.unwrap_or_else(|_| Obj::const_none())
Expand All @@ -286,10 +285,6 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
.get(Qstr::MP_QSTR_verb_cancel)
.unwrap_or_else(|_| Obj::const_none())
.try_into_option()?;
let verb_info: Option<TString> = kwargs
.get(Qstr::MP_QSTR_verb_info)
.unwrap_or_else(|_| Obj::const_none())
.try_into_option()?;
let info: bool = kwargs.get_or(Qstr::MP_QSTR_info, true)?;
let hold: bool = kwargs.get_or(Qstr::MP_QSTR_hold, false)?;
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
Expand All @@ -298,15 +293,10 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
let cancel: bool = kwargs.get_or(Qstr::MP_QSTR_cancel, false)?;

ConfirmBlobParams::new(title, data, description)
.with_text_mono(text_mono)
.with_subtitle(subtitle)
.with_verb(verb)
.with_verb_cancel(verb_cancel.unwrap_or(TR::buttons__cancel.into()))
.with_verb_info(if info {
Some(verb_info.unwrap_or(TR::words__title_information.into()))
} else {
None
})
.with_verb_info(if info { Some(TR::words__title_information.into()) } else { None })
.with_extra(extra)
.with_chunkify(chunkify)
.with_page_counter(page_counter)
Expand Down Expand Up @@ -1589,12 +1579,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str,
/// data: str | bytes,
/// description: str | None,
/// text_mono: bool = True,
/// extra: str | None = None,
/// subtitle: str | None = None,
/// verb: str | None = None,
/// verb_cancel: str | None = None,
/// verb_info: str | None = None,
/// info: bool = True,
/// hold: bool = False,
/// chunkify: bool = False,
Expand Down
2 changes: 0 additions & 2 deletions core/embed/rust/src/ui/model_tr/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,12 +1700,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str,
/// data: str | bytes,
/// description: str | None,
/// text_mono: bool = True,
/// extra: str | None = None,
/// subtitle: str | None = None,
/// verb: str = "CONFIRM",
/// verb_cancel: str | None = None,
/// verb_info: str | None = None,
/// info: bool = True,
/// hold: bool = False,
/// chunkify: bool = False,
Expand Down
4 changes: 0 additions & 4 deletions core/embed/rust/src/ui/model_tt/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
let description: Option<TString> =
kwargs.get(Qstr::MP_QSTR_description)?.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)
.unwrap_or_else(|_| Obj::const_none())
Expand All @@ -527,7 +526,6 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;

ConfirmBlobParams::new(title, data, description, verb, verb_cancel, hold)
.with_text_mono(text_mono)
.with_extra(extra)
.with_chunkify(chunkify)
.with_info_button(info)
Expand Down Expand Up @@ -1781,12 +1779,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str,
/// data: str | bytes,
/// description: str | None,
/// text_mono: bool = True,
/// extra: str | None = None,
/// subtitle: str | None = None,
/// verb: str | None = None,
/// verb_cancel: str | None = None,
/// verb_info: str | None = None,
/// info: bool = True,
/// hold: bool = False,
/// chunkify: bool = False,
Expand Down
6 changes: 0 additions & 6 deletions core/mocks/generated/trezorui2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,10 @@ def confirm_blob(
title: str,
data: str | bytes,
description: str | None,
text_mono: bool = True,
extra: str | None = None,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
verb_info: str | None = None,
info: bool = True,
hold: bool = False,
chunkify: bool = False,
Expand Down Expand Up @@ -636,12 +634,10 @@ def confirm_blob(
title: str,
data: str | bytes,
description: str | None,
text_mono: bool = True,
extra: str | None = None,
subtitle: str | None = None,
verb: str = "CONFIRM",
verb_cancel: str | None = None,
verb_info: str | None = None,
info: bool = True,
hold: bool = False,
chunkify: bool = False,
Expand Down Expand Up @@ -1208,12 +1204,10 @@ def confirm_blob(
title: str,
data: str | bytes,
description: str | None,
text_mono: bool = True,
extra: str | None = None,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
verb_info: str | None = None,
info: bool = True,
hold: bool = False,
chunkify: bool = False,
Expand Down
7 changes: 0 additions & 7 deletions core/src/trezor/ui/layouts/mercury/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,9 @@ def confirm_blob(
title: str,
data: bytes | str,
description: str | None = None,
text_mono: bool = True,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER,
ask_pagination: bool = False,
chunkify: bool = False,
Expand All @@ -498,7 +495,6 @@ def confirm_blob(
verb=None,
verb_cancel=verb_cancel,
info=False,
hold=False,
chunkify=chunkify,
page_counter=True,
prompt_screen=False,
Expand All @@ -518,12 +514,9 @@ def confirm_blob(
title=title,
data=data,
description=description,
text_mono=text_mono,
subtitle=subtitle,
verb=verb,
verb_cancel=verb_cancel,
info=info,
hold=hold,
chunkify=chunkify,
prompt_screen=prompt_screen,
)
Expand Down
4 changes: 0 additions & 4 deletions core/src/trezor/ui/layouts/tr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,6 @@ def confirm_blob(
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None, # icon
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER,
ask_pagination: bool = False,
chunkify: bool = False,
Expand All @@ -593,12 +591,10 @@ def confirm_blob(
data=data,
verb=verb,
verb_cancel="",
hold=hold,
chunkify=chunkify,
)

if ask_pagination and layout.page_count() > 1:
assert not hold
return _confirm_ask_pagination(br_name, title, data, description or "", br_code)
else:
return raise_if_not_confirmed(layout, br_name, br_code)
Expand Down
6 changes: 0 additions & 6 deletions core/src/trezor/ui/layouts/tt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,9 @@ def confirm_blob(
title: str,
data: bytes | str,
description: str | None = None,
text_mono: bool = True,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER,
ask_pagination: bool = False,
chunkify: bool = False,
Expand All @@ -587,16 +584,13 @@ def confirm_blob(
layout = trezorui2.confirm_blob(
title=title,
description=description,
text_mono=text_mono,
data=data,
hold=hold,
verb=verb,
verb_cancel=None,
chunkify=chunkify,
)

if ask_pagination and layout.page_count() > 1:
assert not hold
return _confirm_ask_pagination(br_name, title, data, description or "", br_code)
else:
return raise_if_not_confirmed(
Expand Down

0 comments on commit 8d6f5e3

Please sign in to comment.