From d4081546bae3cf3407207b3ccc67b194cddcc56a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Thu, 21 Nov 2024 13:28:41 +0100 Subject: [PATCH] refactor(core): remove confirm_blob unused params text_mono, info and hold were removed. [no changelog] --- core/embed/rust/librust_qstr.h | 1 - core/embed/rust/src/ui/model_mercury/layout.rs | 14 +------------- core/embed/rust/src/ui/model_tr/layout.rs | 2 -- core/embed/rust/src/ui/model_tt/layout.rs | 4 ---- core/mocks/generated/trezorui2.pyi | 6 ------ core/src/trezor/ui/layouts/mercury/__init__.py | 7 ------- core/src/trezor/ui/layouts/tr/__init__.py | 4 ---- core/src/trezor/ui/layouts/tt/__init__.py | 6 ------ 8 files changed, 1 insertion(+), 43 deletions(-) diff --git a/core/embed/rust/librust_qstr.h b/core/embed/rust/librust_qstr.h index d04460c4a2..c5e0e56599 100644 --- a/core/embed/rust/librust_qstr.h +++ b/core/embed/rust/librust_qstr.h @@ -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; diff --git a/core/embed/rust/src/ui/model_mercury/layout.rs b/core/embed/rust/src/ui/model_mercury/layout.rs index a810ad160b..787cc3b325 100644 --- a/core/embed/rust/src/ui/model_mercury/layout.rs +++ b/core/embed/rust/src/ui/model_mercury/layout.rs @@ -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 = kwargs .get(Qstr::MP_QSTR_extra) .unwrap_or_else(|_| Obj::const_none()) @@ -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 = 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)?; @@ -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) @@ -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, diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 9c32929da5..1c997bb544 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -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, diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index 46b645d8aa..3485a5c5a9 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -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 = 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 = kwargs .get(Qstr::MP_QSTR_extra) .unwrap_or_else(|_| Obj::const_none()) @@ -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) @@ -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, diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index e7aadccea9..c2fe0f2761 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -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, @@ -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, @@ -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, diff --git a/core/src/trezor/ui/layouts/mercury/__init__.py b/core/src/trezor/ui/layouts/mercury/__init__.py index 0cd5c86958..1007266b08 100644 --- a/core/src/trezor/ui/layouts/mercury/__init__.py +++ b/core/src/trezor/ui/layouts/mercury/__init__.py @@ -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, @@ -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, @@ -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, ) diff --git a/core/src/trezor/ui/layouts/tr/__init__.py b/core/src/trezor/ui/layouts/tr/__init__.py index 7eb18ad9a5..7d00177ae5 100644 --- a/core/src/trezor/ui/layouts/tr/__init__.py +++ b/core/src/trezor/ui/layouts/tr/__init__.py @@ -580,8 +580,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, @@ -594,12 +592,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) diff --git a/core/src/trezor/ui/layouts/tt/__init__.py b/core/src/trezor/ui/layouts/tt/__init__.py index 5680ae380f..23dee82900 100644 --- a/core/src/trezor/ui/layouts/tt/__init__.py +++ b/core/src/trezor/ui/layouts/tt/__init__.py @@ -574,12 +574,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, @@ -589,16 +586,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(