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
|
import storage.cache as storage_cache
|
||||||
from trezor import config, utils, wire
|
from trezor import config, utils, wire
|
||||||
|
from trezor.ui.layouts import show_error_and_raise
|
||||||
|
|
||||||
|
|
||||||
async def _request_sd_salt(
|
async def _request_sd_salt(
|
||||||
@ -125,8 +126,6 @@ async def verify_user_pin(
|
|||||||
|
|
||||||
|
|
||||||
async def error_pin_invalid() -> NoReturn:
|
async def error_pin_invalid() -> NoReturn:
|
||||||
from trezor.ui.layouts import show_error_and_raise
|
|
||||||
|
|
||||||
await show_error_and_raise(
|
await show_error_and_raise(
|
||||||
"warning_wrong_pin",
|
"warning_wrong_pin",
|
||||||
"The PIN you have entered is not valid.",
|
"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:
|
async def error_pin_matches_wipe_code() -> NoReturn:
|
||||||
from trezor.ui.layouts import show_error_and_raise
|
|
||||||
|
|
||||||
await show_error_and_raise(
|
await show_error_and_raise(
|
||||||
"warning_invalid_new_pin",
|
"warning_invalid_new_pin",
|
||||||
"The new PIN must be different from your wipe code.",
|
"The new PIN must be different from your wipe code.",
|
||||||
|
@ -580,21 +580,16 @@ async def _show_modal(
|
|||||||
async def show_error_and_raise(
|
async def show_error_and_raise(
|
||||||
br_type: str,
|
br_type: str,
|
||||||
content: str,
|
content: str,
|
||||||
header: str = "Error",
|
|
||||||
subheader: str | None = None,
|
subheader: str | None = None,
|
||||||
button: str = "Close",
|
button: str = "TRY AGAIN",
|
||||||
red: bool = False, # unused on TR
|
|
||||||
exc: ExceptionType = ActionCancelled,
|
exc: ExceptionType = ActionCancelled,
|
||||||
) -> NoReturn:
|
) -> NoReturn:
|
||||||
await _show_modal(
|
await show_warning(
|
||||||
br_type,
|
br_type,
|
||||||
header,
|
subheader or "",
|
||||||
subheader,
|
|
||||||
content,
|
content,
|
||||||
button_confirm=None,
|
button=button,
|
||||||
button_cancel=button,
|
|
||||||
br_code=BR_TYPE_OTHER,
|
br_code=BR_TYPE_OTHER,
|
||||||
exc=exc,
|
|
||||||
)
|
)
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ async def show_error_and_raise(
|
|||||||
br_type: str,
|
br_type: str,
|
||||||
content: str,
|
content: str,
|
||||||
subheader: str | None = None,
|
subheader: str | None = None,
|
||||||
button: str = "CLOSE",
|
button: str = "TRY AGAIN",
|
||||||
exc: ExceptionType = ActionCancelled,
|
exc: ExceptionType = ActionCancelled,
|
||||||
) -> NoReturn:
|
) -> NoReturn:
|
||||||
await interact(
|
await interact(
|
||||||
|
@ -51,11 +51,16 @@ def go_next(debug: "DebugLink", wait: bool = False) -> "LayoutContent" | None:
|
|||||||
raise RuntimeError("Unknown model")
|
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":
|
if debug.model == "T":
|
||||||
return debug.click(buttons.CANCEL, wait=wait) # type: ignore
|
return debug.click(buttons.CANCEL, wait=wait) # type: ignore
|
||||||
elif debug.model == "R":
|
elif debug.model == "R":
|
||||||
return debug.press_left(wait=wait) # type: ignore
|
if r_middle:
|
||||||
|
return debug.press_middle(wait=wait) # type: ignore
|
||||||
|
else:
|
||||||
|
return debug.press_left(wait=wait) # type: ignore
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Unknown model")
|
raise RuntimeError("Unknown model")
|
||||||
|
|
||||||
|
@ -311,4 +311,4 @@ def test_pin_same_as_wipe_code(device_handler: "BackgroundDeviceHandler"):
|
|||||||
_enter_two_times(debug, "1", "1")
|
_enter_two_times(debug, "1", "1")
|
||||||
with PIN_INVALID, prepare(device_handler, Situation.PIN_SETUP) as debug:
|
with PIN_INVALID, prepare(device_handler, Situation.PIN_SETUP) as debug:
|
||||||
_enter_two_times(debug, "1", "1")
|
_enter_two_times(debug, "1", "1")
|
||||||
go_back(debug)
|
go_back(debug, r_middle=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user