mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-06 23:02:33 +00:00
chore(core): passphrase flow design changes
[no changelog]
This commit is contained in:
parent
20c9d81018
commit
c3f7e29548
@ -108,6 +108,7 @@ static void _librust_qstrs(void) {
|
|||||||
MP_QSTR_show_info;
|
MP_QSTR_show_info;
|
||||||
MP_QSTR_show_lockscreen;
|
MP_QSTR_show_lockscreen;
|
||||||
MP_QSTR_show_mismatch;
|
MP_QSTR_show_mismatch;
|
||||||
|
MP_QSTR_show_passphrase;
|
||||||
MP_QSTR_show_progress;
|
MP_QSTR_show_progress;
|
||||||
MP_QSTR_show_progress_coinjoin;
|
MP_QSTR_show_progress_coinjoin;
|
||||||
MP_QSTR_show_remaining_shares;
|
MP_QSTR_show_remaining_shares;
|
||||||
|
@ -900,6 +900,17 @@ extern "C" fn new_show_info(n_args: usize, args: *const Obj, kwargs: *mut Map) -
|
|||||||
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_show_passphrase() -> Obj {
|
||||||
|
let block = move || {
|
||||||
|
let text: StrBuffer = "Please enter your passphrase.".into();
|
||||||
|
let paragraph = Paragraph::new(&theme::TEXT_NORMAL, text).centered();
|
||||||
|
let content = Paragraphs::new([paragraph]);
|
||||||
|
let obj = LayoutObj::new(content)?;
|
||||||
|
Ok(obj.into())
|
||||||
|
};
|
||||||
|
unsafe { util::try_or_raise(block) }
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" fn new_show_mismatch() -> Obj {
|
extern "C" fn new_show_mismatch() -> Obj {
|
||||||
let block = move || {
|
let block = move || {
|
||||||
let get_page = move |page_index| {
|
let get_page = move |page_index| {
|
||||||
@ -1457,6 +1468,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// """Info modal."""
|
/// """Info modal."""
|
||||||
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
Qstr::MP_QSTR_show_info => obj_fn_kw!(0, new_show_info).as_obj(),
|
||||||
|
|
||||||
|
/// def show_passphrase() -> object:
|
||||||
|
/// """Show passphrase on host dialog."""
|
||||||
|
Qstr::MP_QSTR_show_passphrase => obj_fn_0!(new_show_passphrase).as_obj(),
|
||||||
|
|
||||||
/// def show_mismatch() -> object:
|
/// def show_mismatch() -> object:
|
||||||
/// """Warning modal, receiving address mismatch."""
|
/// """Warning modal, receiving address mismatch."""
|
||||||
Qstr::MP_QSTR_show_mismatch => obj_fn_0!(new_show_mismatch).as_obj(),
|
Qstr::MP_QSTR_show_mismatch => obj_fn_0!(new_show_mismatch).as_obj(),
|
||||||
|
@ -184,6 +184,11 @@ def show_info(
|
|||||||
"""Info modal."""
|
"""Info modal."""
|
||||||
|
|
||||||
|
|
||||||
|
# rust/src/ui/model_tr/layout.rs
|
||||||
|
def show_passphrase() -> object:
|
||||||
|
"""Show passphrase on host dialog."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def show_mismatch() -> object:
|
def show_mismatch() -> object:
|
||||||
"""Warning modal, receiving address mismatch."""
|
"""Warning modal, receiving address mismatch."""
|
||||||
|
@ -183,13 +183,15 @@ async def _require_confirm_change_label(ctx: GenericContext, label: str) -> None
|
|||||||
|
|
||||||
|
|
||||||
async def _require_confirm_change_passphrase(ctx: GenericContext, use: bool) -> None:
|
async def _require_confirm_change_passphrase(ctx: GenericContext, use: bool) -> None:
|
||||||
template = "Do you want to {} passphrase protection?"
|
on_or_off = "on" if use else "off"
|
||||||
description = template.format("enable" if use else "disable")
|
description = f"Turn {on_or_off} passphrase protection?"
|
||||||
|
verb = f"Turn {on_or_off}"
|
||||||
await confirm_action(
|
await confirm_action(
|
||||||
ctx,
|
ctx,
|
||||||
"set_passphrase",
|
"set_passphrase",
|
||||||
"Enable passphrase" if use else "Disable passphrase",
|
"Passphrase settings",
|
||||||
description=description,
|
description=description,
|
||||||
|
verb=verb,
|
||||||
br_code=BRT_PROTECT_CALL,
|
br_code=BRT_PROTECT_CALL,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1157,12 +1157,7 @@ async def show_error_popup(
|
|||||||
|
|
||||||
|
|
||||||
def request_passphrase_on_host() -> None:
|
def request_passphrase_on_host() -> None:
|
||||||
draw_simple(
|
draw_simple(trezorui2.show_passphrase())
|
||||||
trezorui2.show_info(
|
|
||||||
title="HIDDEN WALLET",
|
|
||||||
description="Please type your passphrase on the connected host.",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def request_passphrase_on_device(ctx: GenericContext, max_len: int) -> str:
|
async def request_passphrase_on_device(ctx: GenericContext, max_len: int) -> str:
|
||||||
|
@ -1197,7 +1197,7 @@ def request_passphrase_on_host() -> None:
|
|||||||
draw_simple(
|
draw_simple(
|
||||||
trezorui2.show_simple(
|
trezorui2.show_simple(
|
||||||
title=None,
|
title=None,
|
||||||
description="Please type your passphrase on the connected host.",
|
description="Please enter your passphrase.",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user