1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

refactor(core): remove confirm_blob unused params

text_mono, info and hold were removed.

[no changelog]
This commit is contained in:
Ioan Bizău 2024-11-21 13:28:41 +01:00
parent 945b9010fa
commit d4081546ba
8 changed files with 1 additions and 43 deletions

View File

@ -742,7 +742,6 @@ static void _librust_qstrs(void) {
MP_QSTR_value; MP_QSTR_value;
MP_QSTR_verb; MP_QSTR_verb;
MP_QSTR_verb_cancel; MP_QSTR_verb_cancel;
MP_QSTR_verb_info;
MP_QSTR_verify; MP_QSTR_verify;
MP_QSTR_version; MP_QSTR_version;
MP_QSTR_warning; MP_QSTR_warning;

View File

@ -269,7 +269,6 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
.get(Qstr::MP_QSTR_description) .get(Qstr::MP_QSTR_description)
.unwrap_or_else(|_| Obj::const_none()) .unwrap_or_else(|_| Obj::const_none())
.try_into_option()?; .try_into_option()?;
let text_mono: bool = kwargs.get_or(Qstr::MP_QSTR_text_mono, true)?;
let extra: Option<TString> = kwargs let extra: Option<TString> = kwargs
.get(Qstr::MP_QSTR_extra) .get(Qstr::MP_QSTR_extra)
.unwrap_or_else(|_| Obj::const_none()) .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) .get(Qstr::MP_QSTR_verb_cancel)
.unwrap_or_else(|_| Obj::const_none()) .unwrap_or_else(|_| Obj::const_none())
.try_into_option()?; .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 info: bool = kwargs.get_or(Qstr::MP_QSTR_info, true)?;
let hold: bool = kwargs.get_or(Qstr::MP_QSTR_hold, false)?; let hold: bool = kwargs.get_or(Qstr::MP_QSTR_hold, false)?;
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, 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)?; let cancel: bool = kwargs.get_or(Qstr::MP_QSTR_cancel, false)?;
ConfirmBlobParams::new(title, data, description) ConfirmBlobParams::new(title, data, description)
.with_text_mono(text_mono)
.with_subtitle(subtitle) .with_subtitle(subtitle)
.with_verb(verb) .with_verb(verb)
.with_verb_cancel(verb_cancel.unwrap_or(TR::buttons__cancel.into())) .with_verb_cancel(verb_cancel.unwrap_or(TR::buttons__cancel.into()))
.with_verb_info(if info { .with_verb_info(if info { Some(TR::words__title_information.into()) } else { None })
Some(verb_info.unwrap_or(TR::words__title_information.into()))
} else {
None
})
.with_extra(extra) .with_extra(extra)
.with_chunkify(chunkify) .with_chunkify(chunkify)
.with_page_counter(page_counter) .with_page_counter(page_counter)
@ -1589,12 +1579,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str, /// title: str,
/// data: str | bytes, /// data: str | bytes,
/// description: str | None, /// description: str | None,
/// text_mono: bool = True,
/// extra: str | None = None, /// extra: str | None = None,
/// subtitle: str | None = None, /// subtitle: str | None = None,
/// verb: str | None = None, /// verb: str | None = None,
/// verb_cancel: str | None = None, /// verb_cancel: str | None = None,
/// verb_info: str | None = None,
/// info: bool = True, /// info: bool = True,
/// hold: bool = False, /// hold: bool = False,
/// chunkify: bool = False, /// chunkify: bool = False,

View File

@ -1700,12 +1700,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str, /// title: str,
/// data: str | bytes, /// data: str | bytes,
/// description: str | None, /// description: str | None,
/// text_mono: bool = True,
/// extra: str | None = None, /// extra: str | None = None,
/// subtitle: str | None = None, /// subtitle: str | None = None,
/// verb: str = "CONFIRM", /// verb: str = "CONFIRM",
/// verb_cancel: str | None = None, /// verb_cancel: str | None = None,
/// verb_info: str | None = None,
/// info: bool = True, /// info: bool = True,
/// hold: bool = False, /// hold: bool = False,
/// chunkify: bool = False, /// chunkify: bool = False,

View File

@ -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 data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
let description: Option<TString> = let description: Option<TString> =
kwargs.get(Qstr::MP_QSTR_description)?.try_into_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<TString> = kwargs let extra: Option<TString> = kwargs
.get(Qstr::MP_QSTR_extra) .get(Qstr::MP_QSTR_extra)
.unwrap_or_else(|_| Obj::const_none()) .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)?; let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
ConfirmBlobParams::new(title, data, description, verb, verb_cancel, hold) ConfirmBlobParams::new(title, data, description, verb, verb_cancel, hold)
.with_text_mono(text_mono)
.with_extra(extra) .with_extra(extra)
.with_chunkify(chunkify) .with_chunkify(chunkify)
.with_info_button(info) .with_info_button(info)
@ -1781,12 +1779,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// title: str, /// title: str,
/// data: str | bytes, /// data: str | bytes,
/// description: str | None, /// description: str | None,
/// text_mono: bool = True,
/// extra: str | None = None, /// extra: str | None = None,
/// subtitle: str | None = None, /// subtitle: str | None = None,
/// verb: str | None = None, /// verb: str | None = None,
/// verb_cancel: str | None = None, /// verb_cancel: str | None = None,
/// verb_info: str | None = None,
/// info: bool = True, /// info: bool = True,
/// hold: bool = False, /// hold: bool = False,
/// chunkify: bool = False, /// chunkify: bool = False,

View File

@ -59,12 +59,10 @@ def confirm_blob(
title: str, title: str,
data: str | bytes, data: str | bytes,
description: str | None, description: str | None,
text_mono: bool = True,
extra: str | None = None, extra: str | None = None,
subtitle: str | None = None, subtitle: str | None = None,
verb: str | None = None, verb: str | None = None,
verb_cancel: str | None = None, verb_cancel: str | None = None,
verb_info: str | None = None,
info: bool = True, info: bool = True,
hold: bool = False, hold: bool = False,
chunkify: bool = False, chunkify: bool = False,
@ -636,12 +634,10 @@ def confirm_blob(
title: str, title: str,
data: str | bytes, data: str | bytes,
description: str | None, description: str | None,
text_mono: bool = True,
extra: str | None = None, extra: str | None = None,
subtitle: str | None = None, subtitle: str | None = None,
verb: str = "CONFIRM", verb: str = "CONFIRM",
verb_cancel: str | None = None, verb_cancel: str | None = None,
verb_info: str | None = None,
info: bool = True, info: bool = True,
hold: bool = False, hold: bool = False,
chunkify: bool = False, chunkify: bool = False,
@ -1208,12 +1204,10 @@ def confirm_blob(
title: str, title: str,
data: str | bytes, data: str | bytes,
description: str | None, description: str | None,
text_mono: bool = True,
extra: str | None = None, extra: str | None = None,
subtitle: str | None = None, subtitle: str | None = None,
verb: str | None = None, verb: str | None = None,
verb_cancel: str | None = None, verb_cancel: str | None = None,
verb_info: str | None = None,
info: bool = True, info: bool = True,
hold: bool = False, hold: bool = False,
chunkify: bool = False, chunkify: bool = False,

View File

@ -470,12 +470,9 @@ def confirm_blob(
title: str, title: str,
data: bytes | str, data: bytes | str,
description: str | None = None, description: str | None = None,
text_mono: bool = True,
subtitle: str | None = None, subtitle: str | None = None,
verb: str | None = None, verb: str | None = None,
verb_cancel: str | None = None, verb_cancel: str | None = None,
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER, br_code: ButtonRequestType = BR_CODE_OTHER,
ask_pagination: bool = False, ask_pagination: bool = False,
chunkify: bool = False, chunkify: bool = False,
@ -498,7 +495,6 @@ def confirm_blob(
verb=None, verb=None,
verb_cancel=verb_cancel, verb_cancel=verb_cancel,
info=False, info=False,
hold=False,
chunkify=chunkify, chunkify=chunkify,
page_counter=True, page_counter=True,
prompt_screen=False, prompt_screen=False,
@ -518,12 +514,9 @@ def confirm_blob(
title=title, title=title,
data=data, data=data,
description=description, description=description,
text_mono=text_mono,
subtitle=subtitle, subtitle=subtitle,
verb=verb, verb=verb,
verb_cancel=verb_cancel, verb_cancel=verb_cancel,
info=info,
hold=hold,
chunkify=chunkify, chunkify=chunkify,
prompt_screen=prompt_screen, prompt_screen=prompt_screen,
) )

View File

@ -580,8 +580,6 @@ def confirm_blob(
subtitle: str | None = None, subtitle: str | None = None,
verb: str | None = None, verb: str | None = None,
verb_cancel: str | None = None, # icon verb_cancel: str | None = None, # icon
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER, br_code: ButtonRequestType = BR_CODE_OTHER,
ask_pagination: bool = False, ask_pagination: bool = False,
chunkify: bool = False, chunkify: bool = False,
@ -594,12 +592,10 @@ def confirm_blob(
data=data, data=data,
verb=verb, verb=verb,
verb_cancel="", verb_cancel="",
hold=hold,
chunkify=chunkify, chunkify=chunkify,
) )
if ask_pagination and layout.page_count() > 1: if ask_pagination and layout.page_count() > 1:
assert not hold
return _confirm_ask_pagination(br_name, title, data, description or "", br_code) return _confirm_ask_pagination(br_name, title, data, description or "", br_code)
else: else:
return raise_if_not_confirmed(layout, br_name, br_code) return raise_if_not_confirmed(layout, br_name, br_code)

View File

@ -574,12 +574,9 @@ def confirm_blob(
title: str, title: str,
data: bytes | str, data: bytes | str,
description: str | None = None, description: str | None = None,
text_mono: bool = True,
subtitle: str | None = None, subtitle: str | None = None,
verb: str | None = None, verb: str | None = None,
verb_cancel: str | None = None, verb_cancel: str | None = None,
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER, br_code: ButtonRequestType = BR_CODE_OTHER,
ask_pagination: bool = False, ask_pagination: bool = False,
chunkify: bool = False, chunkify: bool = False,
@ -589,16 +586,13 @@ def confirm_blob(
layout = trezorui2.confirm_blob( layout = trezorui2.confirm_blob(
title=title, title=title,
description=description, description=description,
text_mono=text_mono,
data=data, data=data,
hold=hold,
verb=verb, verb=verb,
verb_cancel=None, verb_cancel=None,
chunkify=chunkify, chunkify=chunkify,
) )
if ask_pagination and layout.page_count() > 1: if ask_pagination and layout.page_count() > 1:
assert not hold
return _confirm_ask_pagination(br_name, title, data, description or "", br_code) return _confirm_ask_pagination(br_name, title, data, description or "", br_code)
else: else:
return raise_if_not_confirmed( return raise_if_not_confirmed(