mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
chore(core): change error screens according to design
[no changelog]
This commit is contained in:
parent
088e3b058e
commit
45639eeacf
@ -3,6 +3,7 @@ from typing import Any, NoReturn
|
||||
|
||||
import storage.cache as storage_cache
|
||||
from trezor import config, utils, wire
|
||||
from trezor.ui.layouts import show_error_and_raise
|
||||
|
||||
|
||||
async def _request_sd_salt(
|
||||
@ -125,8 +126,6 @@ async def verify_user_pin(
|
||||
|
||||
|
||||
async def error_pin_invalid() -> NoReturn:
|
||||
from trezor.ui.layouts import show_error_and_raise
|
||||
|
||||
await show_error_and_raise(
|
||||
"warning_wrong_pin",
|
||||
"The PIN you have entered is not valid.",
|
||||
@ -137,8 +136,6 @@ async def error_pin_invalid() -> NoReturn:
|
||||
|
||||
|
||||
async def error_pin_matches_wipe_code() -> NoReturn:
|
||||
from trezor.ui.layouts import show_error_and_raise
|
||||
|
||||
await show_error_and_raise(
|
||||
"warning_invalid_new_pin",
|
||||
"The new PIN must be different from your wipe code.",
|
||||
|
@ -580,21 +580,16 @@ async def _show_modal(
|
||||
async def show_error_and_raise(
|
||||
br_type: str,
|
||||
content: str,
|
||||
header: str = "Error",
|
||||
subheader: str | None = None,
|
||||
button: str = "Close",
|
||||
red: bool = False, # unused on TR
|
||||
button: str = "TRY AGAIN",
|
||||
exc: ExceptionType = ActionCancelled,
|
||||
) -> NoReturn:
|
||||
await _show_modal(
|
||||
await show_warning(
|
||||
br_type,
|
||||
header,
|
||||
subheader,
|
||||
subheader or "",
|
||||
content,
|
||||
button_confirm=None,
|
||||
button_cancel=button,
|
||||
button=button,
|
||||
br_code=BR_TYPE_OTHER,
|
||||
exc=exc,
|
||||
)
|
||||
raise exc
|
||||
|
||||
|
@ -491,7 +491,7 @@ async def show_error_and_raise(
|
||||
br_type: str,
|
||||
content: str,
|
||||
subheader: str | None = None,
|
||||
button: str = "CLOSE",
|
||||
button: str = "TRY AGAIN",
|
||||
exc: ExceptionType = ActionCancelled,
|
||||
) -> NoReturn:
|
||||
await interact(
|
||||
|
@ -51,10 +51,15 @@ def go_next(debug: "DebugLink", wait: bool = False) -> "LayoutContent" | None:
|
||||
raise RuntimeError("Unknown model")
|
||||
|
||||
|
||||
def go_back(debug: "DebugLink", wait: bool = False) -> "LayoutContent" | None:
|
||||
def go_back(
|
||||
debug: "DebugLink", wait: bool = False, r_middle: bool = False
|
||||
) -> "LayoutContent" | None:
|
||||
if debug.model == "T":
|
||||
return debug.click(buttons.CANCEL, wait=wait) # type: ignore
|
||||
elif debug.model == "R":
|
||||
if r_middle:
|
||||
return debug.press_middle(wait=wait) # type: ignore
|
||||
else:
|
||||
return debug.press_left(wait=wait) # type: ignore
|
||||
else:
|
||||
raise RuntimeError("Unknown model")
|
||||
|
@ -311,4 +311,4 @@ def test_pin_same_as_wipe_code(device_handler: "BackgroundDeviceHandler"):
|
||||
_enter_two_times(debug, "1", "1")
|
||||
with PIN_INVALID, prepare(device_handler, Situation.PIN_SETUP) as debug:
|
||||
_enter_two_times(debug, "1", "1")
|
||||
go_back(debug)
|
||||
go_back(debug, r_middle=True)
|
||||
|
Loading…
Reference in New Issue
Block a user