1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-19 14:08:11 +00:00

feat(core/ui): implement all layouts raising NotImplementedError

This commit is contained in:
grdddj 2022-10-20 14:56:02 +02:00 committed by Martin Milata
parent ae525fed26
commit 2cbb9efeca
2 changed files with 35 additions and 6 deletions

View File

@ -170,7 +170,7 @@ class _RustLayout(ui.Layout):
async def raise_if_not_confirmed(a: Awaitable[T], exc: Any = ActionCancelled) -> T:
result = await a
if result is not trezorui2.CONFIRMED:
if result is not CONFIRMED:
raise exc
return result
@ -614,15 +614,15 @@ async def confirm_blob(
)
def confirm_address(
async def confirm_address(
ctx: GenericContext,
title: str,
address: str,
description: str | None = "Address:",
br_type: str = "confirm_address",
br_code: ButtonRequestType = BR_TYPE_OTHER,
) -> Awaitable[None]:
return confirm_value(
) -> None:
return await confirm_value(
ctx,
title,
address,

View File

@ -1,6 +1,13 @@
from typing import TYPE_CHECKING
from trezor.enums import ButtonRequestType
import trezorui2
from ...components.common.confirm import is_confirmed
from ...components.common.webauthn import ConfirmInfo
from ..common import interact
from . import _RustLayout
if TYPE_CHECKING:
from trezor.wire import GenericContext
@ -13,8 +20,30 @@ async def confirm_webauthn(
info: ConfirmInfo,
pageable: Pageable | None = None,
) -> bool:
raise NotImplementedError
if pageable is not None:
raise NotImplementedError
confirm = _RustLayout(
trezorui2.confirm_blob(
title=info.get_header().upper(),
data=f"{info.app_name()}\n{info.account_name()}",
)
)
if ctx is None:
return is_confirmed(await confirm)
else:
return is_confirmed(
await interact(ctx, confirm, "confirm_webauthn", ButtonRequestType.Other)
)
async def confirm_webauthn_reset() -> bool:
raise NotImplementedError
return is_confirmed(
await _RustLayout(
trezorui2.confirm_blob(
title="FIDO2 RESET",
data="Do you really want to\nerase all credentials?",
)
)
)