mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-06 21:40:56 +00:00
chore(core/ui): remove new_confirm_address on Mercury
[no changelog]
This commit is contained in:
parent
deb5ce3f48
commit
5c8ee873c6
@ -48,7 +48,7 @@ use crate::{
|
|||||||
base::LAYOUT_STATE,
|
base::LAYOUT_STATE,
|
||||||
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
|
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
|
||||||
result::{CANCELLED, CONFIRMED, INFO},
|
result::{CANCELLED, CONFIRMED, INFO},
|
||||||
util::{upy_disable_animation, PropsList, RecoveryType, StrOrBytes},
|
util::{upy_disable_animation, PropsList, RecoveryType},
|
||||||
},
|
},
|
||||||
model_mercury::{
|
model_mercury::{
|
||||||
component::{check_homescreen_format, SwipeContent},
|
component::{check_homescreen_format, SwipeContent},
|
||||||
@ -392,44 +392,6 @@ extern "C" fn new_confirm_action(n_args: usize, args: *const Obj, kwargs: *mut M
|
|||||||
};
|
};
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
}
|
}
|
||||||
extern "C" fn new_confirm_address(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
|
||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
|
||||||
let description: Option<TString> =
|
|
||||||
kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?;
|
|
||||||
let _extra: Option<TString> = kwargs.get(Qstr::MP_QSTR_extra)?.try_into_option()?;
|
|
||||||
let data: Obj = kwargs.get(Qstr::MP_QSTR_data)?;
|
|
||||||
let chunkify: bool = kwargs.get_or(Qstr::MP_QSTR_chunkify, false)?;
|
|
||||||
|
|
||||||
let data_style = if chunkify {
|
|
||||||
let address: TString = data.try_into()?;
|
|
||||||
theme::get_chunkified_text_style(address.len())
|
|
||||||
} else {
|
|
||||||
&theme::TEXT_MONO
|
|
||||||
};
|
|
||||||
|
|
||||||
let data: StrOrBytes = data.try_into()?;
|
|
||||||
let paragraphs = ParagraphVecShort::from_iter([
|
|
||||||
Paragraph::new(&theme::TEXT_NORMAL, description.unwrap_or("".into())),
|
|
||||||
Paragraph::new(data_style, data.as_str_offset(0)),
|
|
||||||
])
|
|
||||||
.into_paragraphs();
|
|
||||||
|
|
||||||
let flow = flow::new_confirm_action_simple(
|
|
||||||
paragraphs,
|
|
||||||
ConfirmActionExtra::Menu(
|
|
||||||
ConfirmActionMenuStrings::new().with_verb_info(Some(TR::buttons__more_info.into())),
|
|
||||||
),
|
|
||||||
ConfirmActionStrings::new(title, None, None, None),
|
|
||||||
false,
|
|
||||||
None,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)?;
|
|
||||||
Ok(LayoutObj::new_root(flow)?.into())
|
|
||||||
};
|
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" fn new_confirm_firmware_update(
|
extern "C" fn new_confirm_firmware_update(
|
||||||
n_args: usize,
|
n_args: usize,
|
||||||
@ -767,6 +729,10 @@ extern "C" fn new_confirm_value(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|||||||
.get(Qstr::MP_QSTR_verb)
|
.get(Qstr::MP_QSTR_verb)
|
||||||
.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 verb_cancel: Option<TString> = kwargs
|
let verb_cancel: Option<TString> = 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())
|
||||||
@ -780,7 +746,7 @@ extern "C" fn new_confirm_value(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|||||||
.with_verb(verb)
|
.with_verb(verb)
|
||||||
.with_verb_cancel(verb_cancel)
|
.with_verb_cancel(verb_cancel)
|
||||||
.with_verb_info(if info_button {
|
.with_verb_info(if info_button {
|
||||||
Some(TR::words__title_information.into())
|
Some(verb_info.unwrap_or(TR::words__title_information.into()))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
@ -1634,19 +1600,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// which can then be confirmed using confirm_blob."""
|
/// which can then be confirmed using confirm_blob."""
|
||||||
Qstr::MP_QSTR_confirm_blob_intro => obj_fn_kw!(0, new_confirm_blob_intro).as_obj(),
|
Qstr::MP_QSTR_confirm_blob_intro => obj_fn_kw!(0, new_confirm_blob_intro).as_obj(),
|
||||||
|
|
||||||
/// def confirm_address(
|
|
||||||
/// *,
|
|
||||||
/// title: str,
|
|
||||||
/// data: str | bytes,
|
|
||||||
/// description: str | None,
|
|
||||||
/// verb: str | None = "CONFIRM",
|
|
||||||
/// extra: str | None,
|
|
||||||
/// chunkify: bool = False,
|
|
||||||
/// ) -> LayoutObj[UiResult]:
|
|
||||||
/// """Confirm address. Similar to `confirm_blob` but has corner info button
|
|
||||||
/// and allows left swipe which does the same thing as the button."""
|
|
||||||
Qstr::MP_QSTR_confirm_address => obj_fn_kw!(0, new_confirm_address).as_obj(),
|
|
||||||
|
|
||||||
/// def confirm_properties(
|
/// def confirm_properties(
|
||||||
/// *,
|
/// *,
|
||||||
/// title: str,
|
/// title: str,
|
||||||
@ -1687,6 +1640,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str | None,
|
/// description: str | None,
|
||||||
/// subtitle: str | None,
|
/// subtitle: str | None,
|
||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
|
/// verb_info: str | None = None,
|
||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
|
@ -1769,6 +1769,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str,
|
/// description: str,
|
||||||
/// value: str,
|
/// value: str,
|
||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
|
/// verb_info: str | None = None,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
/// ) -> LayoutObj[UiResult]:
|
/// ) -> LayoutObj[UiResult]:
|
||||||
/// """Confirm value."""
|
/// """Confirm value."""
|
||||||
|
@ -1858,6 +1858,7 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// description: str | None,
|
/// description: str | None,
|
||||||
/// subtitle: str | None,
|
/// subtitle: str | None,
|
||||||
/// verb: str | None = None,
|
/// verb: str | None = None,
|
||||||
|
/// verb_info: str | None = None,
|
||||||
/// verb_cancel: str | None = None,
|
/// verb_cancel: str | None = None,
|
||||||
/// info_button: bool = False,
|
/// info_button: bool = False,
|
||||||
/// hold: bool = False,
|
/// hold: bool = False,
|
||||||
|
@ -90,20 +90,6 @@ def confirm_blob_intro(
|
|||||||
which can then be confirmed using confirm_blob."""
|
which can then be confirmed using confirm_blob."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_mercury/layout.rs
|
|
||||||
def confirm_address(
|
|
||||||
*,
|
|
||||||
title: str,
|
|
||||||
data: str | bytes,
|
|
||||||
description: str | None,
|
|
||||||
verb: str | None = "CONFIRM",
|
|
||||||
extra: str | None,
|
|
||||||
chunkify: bool = False,
|
|
||||||
) -> LayoutObj[UiResult]:
|
|
||||||
"""Confirm address. Similar to `confirm_blob` but has corner info button
|
|
||||||
and allows left swipe which does the same thing as the button."""
|
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_mercury/layout.rs
|
# rust/src/ui/model_mercury/layout.rs
|
||||||
def confirm_properties(
|
def confirm_properties(
|
||||||
*,
|
*,
|
||||||
@ -148,6 +134,7 @@ def confirm_value(
|
|||||||
description: str | None,
|
description: str | None,
|
||||||
subtitle: str | None,
|
subtitle: str | None,
|
||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
|
verb_info: str | None = None,
|
||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
@ -710,6 +697,7 @@ def confirm_value(
|
|||||||
description: str,
|
description: str,
|
||||||
value: str,
|
value: str,
|
||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
|
verb_info: str | None = None,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
) -> LayoutObj[UiResult]:
|
) -> LayoutObj[UiResult]:
|
||||||
"""Confirm value."""
|
"""Confirm value."""
|
||||||
@ -1291,6 +1279,7 @@ def confirm_value(
|
|||||||
description: str | None,
|
description: str | None,
|
||||||
subtitle: str | None,
|
subtitle: str | None,
|
||||||
verb: str | None = None,
|
verb: str | None = None,
|
||||||
|
verb_info: str | None = None,
|
||||||
verb_cancel: str | None = None,
|
verb_cancel: str | None = None,
|
||||||
info_button: bool = False,
|
info_button: bool = False,
|
||||||
hold: bool = False,
|
hold: bool = False,
|
||||||
|
@ -1010,12 +1010,14 @@ async def confirm_signverify(
|
|||||||
address_title = TR.sign_message__confirm_address
|
address_title = TR.sign_message__confirm_address
|
||||||
br_name = "sign_message"
|
br_name = "sign_message"
|
||||||
|
|
||||||
address_layout = trezorui2.confirm_address(
|
address_layout = trezorui2.confirm_value(
|
||||||
title=address_title,
|
title=address_title,
|
||||||
data=address,
|
subtitle=None,
|
||||||
description="",
|
description="",
|
||||||
|
value=address,
|
||||||
verb=TR.buttons__continue,
|
verb=TR.buttons__continue,
|
||||||
extra=None,
|
verb_info=TR.buttons__more_info,
|
||||||
|
info_button=True,
|
||||||
chunkify=chunkify,
|
chunkify=chunkify,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user