1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 05:28:40 +00:00

WIP - delete the special PIN confirm functionality

This commit is contained in:
grdddj 2022-11-05 16:33:18 +01:00
parent 6bbf56f8e0
commit b2667b13ca
4 changed files with 0 additions and 86 deletions

View File

@ -36,7 +36,6 @@ static void _librust_qstrs(void) {
MP_QSTR_confirm_value;
MP_QSTR_confirm_with_info;
MP_QSTR_confirm_word;
MP_QSTR_pin_confirm_action;
MP_QSTR_request_bip39;
MP_QSTR_request_number;
MP_QSTR_request_passphrase;

View File

@ -407,47 +407,6 @@ extern "C" fn tutorial(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn pin_confirm_action(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = |_args: &[Obj], kwargs: &Map| {
let action: StrBuffer = kwargs.get(Qstr::MP_QSTR_action)?.try_into()?;
let get_page = move |page_index| {
let screen = match page_index {
// title, text, btn_layout, btn_actions
// NOTE: doing the newlines manually to look exactly same
// as in the design.
0 => (
"PIN settings".into(),
"PIN should contain at least 6 digits",
ButtonLayout::cancel_and_text("GOT IT"),
ButtonActions::cancel_next(),
),
1 => (
action.clone(),
"You'll use\nthis PIN to\naccess this\ndevice.",
ButtonLayout::cancel_and_htc_text(
"HOLD TO CONFIRM",
Duration::from_millis(1000),
),
ButtonActions::cancel_confirm(),
),
_ => unreachable!(),
};
Page::<10>::new(screen.2.clone(), screen.3.clone(), Font::BOLD)
.text_bold(screen.0)
.newline()
.newline_half()
.text_mono(screen.1.into())
};
let pages = FlowPages::new(get_page, 2);
let obj = LayoutObj::new(Flow::new(pages).into_child())?;
Ok(obj.into())
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
extern "C" fn request_pin(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
let block = |_args: &[Obj], kwargs: &Map| {
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
@ -583,10 +542,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
/// """Show user how to interact with the device."""
Qstr::MP_QSTR_tutorial => obj_fn_kw!(0, tutorial).as_obj(),
/// def pin_confirm_action(*, action: str) -> object:
/// """Confirm PIN action and informing user about it."""
Qstr::MP_QSTR_pin_confirm_action => obj_fn_kw!(0, pin_confirm_action).as_obj(),
/// def request_pin(
/// *,
/// prompt: str,

View File

@ -72,11 +72,6 @@ def tutorial() -> object:
"""Show user how to interact with the device."""
# rust/src/ui/model_tr/layout.rs
def pin_confirm_action(*, action: str) -> object:
"""Confirm PIN action and informing user about it."""
# rust/src/ui/model_tr/layout.rs
def request_pin(
*,

View File

@ -477,11 +477,6 @@ async def confirm_action(
exc: ExceptionType = wire.ActionCancelled,
br_code: ButtonRequestType = ButtonRequestType.Other,
) -> None:
# TEMPORARY: when the action targets PIN, it gets handled differently
if br_type == "set_pin":
assert action is not None
return await pin_confirm_action(ctx, br_type, action)
if isinstance(verb, bytes) or isinstance(verb_cancel, bytes):
raise NotImplementedError
@ -517,36 +512,6 @@ async def confirm_action(
)
async def pin_confirm_action(
ctx: wire.GenericContext,
br_type: str,
action: str,
exc: ExceptionType = wire.ActionCancelled,
br_code: ButtonRequestType = ButtonRequestType.Other,
) -> None:
"""Custom layout for PIN confirmation.
Contains some additional information about PIN,
divided into two screens with different buttons.
"""
# Making the first letter in action upper
# There is no capitalize() method in micropython
action = action[0].upper() + action[1:]
await raise_if_cancelled(
interact(
ctx,
RustLayout(
trezorui2.pin_confirm_action(
action=action,
)
),
br_type,
br_code,
),
exc,
)
async def confirm_reset_device(
ctx: wire.GenericContext,
prompt: str,