mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
fixup! chore(core): adapt wipe pin flow
This commit is contained in:
parent
3d7720e660
commit
5e9dc98b90
@ -244,7 +244,6 @@ static void _librust_qstrs(void) {
|
||||
MP_QSTR_firmware_update__title_fingerprint;
|
||||
MP_QSTR_flow_confirm_output;
|
||||
MP_QSTR_flow_confirm_set_new_pin;
|
||||
MP_QSTR_flow_confirm_set_new_wipe_code;
|
||||
MP_QSTR_flow_get_address;
|
||||
MP_QSTR_get_language;
|
||||
MP_QSTR_get_transition_out;
|
||||
@ -301,6 +300,7 @@ static void _librust_qstrs(void) {
|
||||
MP_QSTR_instructions__tap_to_start;
|
||||
MP_QSTR_instructions__view_all_data;
|
||||
MP_QSTR_is_type_of;
|
||||
MP_QSTR_is_wipe_code;
|
||||
MP_QSTR_items;
|
||||
MP_QSTR_joint__title;
|
||||
MP_QSTR_joint__to_the_total_amount;
|
||||
|
@ -533,24 +533,10 @@ extern "C" fn new_flow_confirm_set_new_pin(
|
||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
|
||||
let cancel_title: TString = kwargs.get(Qstr::MP_QSTR_cancel_title)?.try_into()?;
|
||||
let is_wipe_code: bool = kwargs.get(Qstr::MP_QSTR_is_wipe_code)?.try_into()?;
|
||||
|
||||
let layout = ModelUI::flow_confirm_set_new_pin(title, description, cancel_title)?;
|
||||
Ok(LayoutObj::new_root(layout)?.into())
|
||||
};
|
||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||
}
|
||||
|
||||
extern "C" fn new_flow_confirm_set_new_wipe_code(
|
||||
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: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
|
||||
let cancel_title: TString = kwargs.get(Qstr::MP_QSTR_cancel_title)?.try_into()?;
|
||||
|
||||
let layout = ModelUI::flow_confirm_set_new_wipe_code(title, description, cancel_title)?;
|
||||
let layout =
|
||||
ModelUI::flow_confirm_set_new_pin(title, description, cancel_title, is_wipe_code)?;
|
||||
Ok(LayoutObj::new_root(layout)?.into())
|
||||
};
|
||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||
@ -1400,19 +1386,11 @@ pub static mp_module_trezorui_api: Module = obj_module! {
|
||||
/// title: str,
|
||||
/// description: str,
|
||||
/// cancel_title: str,
|
||||
/// is_wipe_code: bool,
|
||||
/// ) -> LayoutObj[UiResult]:
|
||||
/// """Confirm new PIN setup with an option to cancel action."""
|
||||
Qstr::MP_QSTR_flow_confirm_set_new_pin => obj_fn_kw!(0, new_flow_confirm_set_new_pin).as_obj(),
|
||||
|
||||
/// def flow_confirm_set_new_wipe_code(
|
||||
/// *,
|
||||
/// title: str,
|
||||
/// description: str,
|
||||
/// cancel_title: str,
|
||||
/// ) -> LayoutObj[UiResult]:
|
||||
/// """Confirm new wipe code setup with an option to cancel action."""
|
||||
Qstr::MP_QSTR_flow_confirm_set_new_wipe_code => obj_fn_kw!(0, new_flow_confirm_set_new_wipe_code).as_obj(),
|
||||
|
||||
/// def flow_get_address(
|
||||
/// *,
|
||||
/// address: str | bytes,
|
||||
|
@ -632,21 +632,17 @@ impl FirmwareUI for UIMercury {
|
||||
title: TString<'static>,
|
||||
description: TString<'static>,
|
||||
cancel_title: TString<'static>,
|
||||
is_wipe_code: bool,
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
let flow = flow::confirm_set_new_pin::new_set_new_pin(title, description, cancel_title)?;
|
||||
Ok(flow)
|
||||
}
|
||||
|
||||
fn flow_confirm_set_new_wipe_code(
|
||||
title: TString<'static>,
|
||||
description: TString<'static>,
|
||||
cancel_title: TString<'static>,
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
let flow = flow::confirm_set_new_wipe_code::new_set_new_wipe_code(
|
||||
title,
|
||||
description,
|
||||
cancel_title,
|
||||
)?;
|
||||
let flow = if is_wipe_code {
|
||||
flow::confirm_set_new_wipe_code::new_set_new_wipe_code(
|
||||
title,
|
||||
description,
|
||||
cancel_title,
|
||||
)?
|
||||
} else {
|
||||
flow::confirm_set_new_pin::new_set_new_pin(title, description, cancel_title)?
|
||||
};
|
||||
Ok(flow)
|
||||
}
|
||||
|
||||
|
@ -725,22 +725,13 @@ impl FirmwareUI for UIModelTR {
|
||||
_title: TString<'static>,
|
||||
_description: TString<'static>,
|
||||
_cancel_title: TString<'static>,
|
||||
_is_wipe_code: bool,
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
|
||||
c"flow_confirm_set_new_pin not supported",
|
||||
))
|
||||
}
|
||||
|
||||
fn flow_confirm_set_new_wipe_code(
|
||||
_title: TString<'static>,
|
||||
_description: TString<'static>,
|
||||
_cancel_title: TString<'static>,
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
|
||||
c"flow_confirm_set_new_wipe_code not supported",
|
||||
))
|
||||
}
|
||||
|
||||
fn flow_get_address(
|
||||
_address: Obj,
|
||||
_title: TString<'static>,
|
||||
|
@ -576,22 +576,13 @@ impl FirmwareUI for UIModelTT {
|
||||
_title: TString<'static>,
|
||||
_description: TString<'static>,
|
||||
_cancel_title: TString<'static>,
|
||||
_is_wipe_code: bool,
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
|
||||
c"flow_confirm_set_new_pin not supported",
|
||||
))
|
||||
}
|
||||
|
||||
fn flow_confirm_set_new_wipe_code(
|
||||
_title: TString<'static>,
|
||||
_description: TString<'static>,
|
||||
_cancel_title: TString<'static>,
|
||||
) -> Result<impl LayoutMaybeTrace, Error> {
|
||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(
|
||||
c"flow_confirm_set_new_wipe_code not supported",
|
||||
))
|
||||
}
|
||||
|
||||
fn flow_get_address(
|
||||
_address: Obj,
|
||||
_title: TString<'static>,
|
||||
|
@ -198,12 +198,7 @@ pub trait FirmwareUI {
|
||||
title: TString<'static>,
|
||||
description: TString<'static>,
|
||||
cancel_title: TString<'static>,
|
||||
) -> Result<impl LayoutMaybeTrace, Error>;
|
||||
|
||||
fn flow_confirm_set_new_wipe_code(
|
||||
title: TString<'static>,
|
||||
description: TString<'static>,
|
||||
cancel_title: TString<'static>,
|
||||
is_wipe_code: bool,
|
||||
) -> Result<impl LayoutMaybeTrace, Error>;
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
@ -341,20 +341,11 @@ def flow_confirm_set_new_pin(
|
||||
title: str,
|
||||
description: str,
|
||||
cancel_title: str,
|
||||
is_wipe_code: bool,
|
||||
) -> LayoutObj[UiResult]:
|
||||
"""Confirm new PIN setup with an option to cancel action."""
|
||||
|
||||
|
||||
# rust/src/ui/api/firmware_micropython.rs
|
||||
def flow_confirm_set_new_wipe_code(
|
||||
*,
|
||||
title: str,
|
||||
description: str,
|
||||
cancel_title: str,
|
||||
) -> LayoutObj[UiResult]:
|
||||
"""Confirm new wipe code setup with an option to cancel action."""
|
||||
|
||||
|
||||
# rust/src/ui/api/firmware_micropython.rs
|
||||
def flow_get_address(
|
||||
*,
|
||||
|
@ -1211,26 +1211,16 @@ def confirm_set_new_pin(
|
||||
is_wipe_code: bool = False,
|
||||
br_code: ButtonRequestType = BR_CODE_OTHER,
|
||||
) -> Awaitable[None]:
|
||||
if is_wipe_code:
|
||||
return raise_if_not_confirmed(
|
||||
trezorui_api.flow_confirm_set_new_wipe_code(
|
||||
title=title,
|
||||
description=description + "\n" + information,
|
||||
cancel_title=cancel_title,
|
||||
),
|
||||
br_name,
|
||||
br_code,
|
||||
)
|
||||
else:
|
||||
return raise_if_not_confirmed(
|
||||
trezorui_api.flow_confirm_set_new_pin(
|
||||
title=title,
|
||||
description=description + "\n" + information,
|
||||
cancel_title=cancel_title,
|
||||
),
|
||||
br_name,
|
||||
br_code,
|
||||
)
|
||||
return raise_if_not_confirmed(
|
||||
trezorui_api.flow_confirm_set_new_pin(
|
||||
title=title,
|
||||
description=description + "\n" + information,
|
||||
cancel_title=cancel_title,
|
||||
is_wipe_code=is_wipe_code,
|
||||
),
|
||||
br_name,
|
||||
br_code,
|
||||
)
|
||||
|
||||
|
||||
def confirm_firmware_update(description: str, fingerprint: str) -> Awaitable[None]:
|
||||
|
Loading…
Reference in New Issue
Block a user