mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
chore(core): new designs of passphrase dialogs
[no changelog]
This commit is contained in:
parent
3f6a55cc3a
commit
10449759bf
@ -111,6 +111,7 @@ static void _librust_qstrs(void) {
|
||||
MP_QSTR_show_info;
|
||||
MP_QSTR_show_lockscreen;
|
||||
MP_QSTR_show_mismatch;
|
||||
MP_QSTR_show_passphrase;
|
||||
MP_QSTR_show_progress;
|
||||
MP_QSTR_show_progress_coinjoin;
|
||||
MP_QSTR_show_remaining_shares;
|
||||
|
@ -904,6 +904,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) }
|
||||
}
|
||||
|
||||
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 {
|
||||
let block = move || {
|
||||
let get_page = move |page_index| {
|
||||
@ -1464,6 +1475,10 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
||||
/// """Info modal."""
|
||||
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:
|
||||
/// """Warning modal, receiving address mismatch."""
|
||||
Qstr::MP_QSTR_show_mismatch => obj_fn_0!(new_show_mismatch).as_obj(),
|
||||
|
@ -184,6 +184,11 @@ def show_info(
|
||||
"""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
|
||||
def show_mismatch() -> object:
|
||||
"""Warning modal, receiving address mismatch."""
|
||||
|
@ -175,12 +175,14 @@ async def _require_confirm_change_label(label: str) -> None:
|
||||
|
||||
|
||||
async def _require_confirm_change_passphrase(use: bool) -> None:
|
||||
template = "Do you want to {} passphrase protection?"
|
||||
description = template.format("enable" if use else "disable")
|
||||
on_or_off = "on" if use else "off"
|
||||
description = f"Turn {on_or_off} passphrase protection?"
|
||||
verb = f"Turn {on_or_off}"
|
||||
await confirm_action(
|
||||
"set_passphrase",
|
||||
"Enable passphrase" if use else "Disable passphrase",
|
||||
"Passphrase settings",
|
||||
description=description,
|
||||
verb=verb,
|
||||
br_code=BRT_PROTECT_CALL,
|
||||
)
|
||||
|
||||
|
@ -1089,12 +1089,7 @@ async def show_error_popup(
|
||||
|
||||
|
||||
def request_passphrase_on_host() -> None:
|
||||
draw_simple(
|
||||
trezorui2.show_info(
|
||||
title="HIDDEN WALLET",
|
||||
description="Please type your passphrase on the connected host.",
|
||||
)
|
||||
)
|
||||
draw_simple(trezorui2.show_passphrase())
|
||||
|
||||
|
||||
async def request_passphrase_on_device(max_len: int) -> str:
|
||||
|
@ -1131,7 +1131,7 @@ def request_passphrase_on_host() -> None:
|
||||
draw_simple(
|
||||
trezorui2.show_simple(
|
||||
title=None,
|
||||
description="Please type your passphrase on the connected host.",
|
||||
description="Please enter your passphrase.",
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user