mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-02 20:08:31 +00:00
WIP - delete the special PIN confirm functionality
This commit is contained in:
parent
3f6de842df
commit
761976aa89
@ -50,7 +50,6 @@ static void _librust_qstrs(void) {
|
|||||||
MP_QSTR_request_pin;
|
MP_QSTR_request_pin;
|
||||||
MP_QSTR_request_passphrase;
|
MP_QSTR_request_passphrase;
|
||||||
MP_QSTR_confirm_word;
|
MP_QSTR_confirm_word;
|
||||||
MP_QSTR_pin_confirm_action;
|
|
||||||
MP_QSTR_request_bip39;
|
MP_QSTR_request_bip39;
|
||||||
MP_QSTR_request_number;
|
MP_QSTR_request_number;
|
||||||
MP_QSTR_request_passphrase;
|
MP_QSTR_request_passphrase;
|
||||||
|
@ -409,47 +409,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) }
|
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 {
|
extern "C" fn request_pin(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
let block = |_args: &[Obj], kwargs: &Map| {
|
let block = |_args: &[Obj], kwargs: &Map| {
|
||||||
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
let prompt: StrBuffer = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
||||||
@ -590,10 +549,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// """Show user how to interact with the device."""
|
/// """Show user how to interact with the device."""
|
||||||
Qstr::MP_QSTR_tutorial => obj_fn_kw!(0, tutorial).as_obj(),
|
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(
|
/// def request_pin(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
|
@ -83,11 +83,6 @@ def tutorial() -> object:
|
|||||||
"""Show user how to interact with the device."""
|
"""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
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def request_pin(
|
def request_pin(
|
||||||
*,
|
*,
|
||||||
|
@ -510,36 +510,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(
|
async def confirm_reset_device(
|
||||||
ctx: wire.GenericContext,
|
ctx: wire.GenericContext,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
|
Loading…
Reference in New Issue
Block a user