mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-24 17:58:45 +00:00
feat(core/ui): implement all layouts raising NotImplementedError
This commit is contained in:
parent
ae525fed26
commit
2cbb9efeca
@ -170,7 +170,7 @@ class _RustLayout(ui.Layout):
|
|||||||
|
|
||||||
async def raise_if_not_confirmed(a: Awaitable[T], exc: Any = ActionCancelled) -> T:
|
async def raise_if_not_confirmed(a: Awaitable[T], exc: Any = ActionCancelled) -> T:
|
||||||
result = await a
|
result = await a
|
||||||
if result is not trezorui2.CONFIRMED:
|
if result is not CONFIRMED:
|
||||||
raise exc
|
raise exc
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -614,15 +614,15 @@ async def confirm_blob(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def confirm_address(
|
async def confirm_address(
|
||||||
ctx: GenericContext,
|
ctx: GenericContext,
|
||||||
title: str,
|
title: str,
|
||||||
address: str,
|
address: str,
|
||||||
description: str | None = "Address:",
|
description: str | None = "Address:",
|
||||||
br_type: str = "confirm_address",
|
br_type: str = "confirm_address",
|
||||||
br_code: ButtonRequestType = BR_TYPE_OTHER,
|
br_code: ButtonRequestType = BR_TYPE_OTHER,
|
||||||
) -> Awaitable[None]:
|
) -> None:
|
||||||
return confirm_value(
|
return await confirm_value(
|
||||||
ctx,
|
ctx,
|
||||||
title,
|
title,
|
||||||
address,
|
address,
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
from typing import TYPE_CHECKING
|
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 ...components.common.webauthn import ConfirmInfo
|
||||||
|
from ..common import interact
|
||||||
|
from . import _RustLayout
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from trezor.wire import GenericContext
|
from trezor.wire import GenericContext
|
||||||
@ -13,8 +20,30 @@ async def confirm_webauthn(
|
|||||||
info: ConfirmInfo,
|
info: ConfirmInfo,
|
||||||
pageable: Pageable | None = None,
|
pageable: Pageable | None = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
if pageable is not None:
|
||||||
raise NotImplementedError
|
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:
|
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?",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user