|
|
|
@ -43,7 +43,6 @@ if False:
|
|
|
|
|
|
|
|
|
|
__all__ = (
|
|
|
|
|
"confirm_action",
|
|
|
|
|
"confirm_wipe",
|
|
|
|
|
"confirm_reset_device",
|
|
|
|
|
"confirm_backup",
|
|
|
|
|
"confirm_path_warning",
|
|
|
|
@ -79,13 +78,13 @@ async def confirm_action(
|
|
|
|
|
verb: Union[str, bytes, None] = Confirm.DEFAULT_CONFIRM,
|
|
|
|
|
verb_cancel: Union[str, bytes, None] = Confirm.DEFAULT_CANCEL,
|
|
|
|
|
hold: bool = False,
|
|
|
|
|
hold_danger: bool = False,
|
|
|
|
|
icon: str = None, # TODO cleanup @ redesign
|
|
|
|
|
icon_color: int = None, # TODO cleanup @ redesign
|
|
|
|
|
reverse: bool = False, # TODO cleanup @ redesign
|
|
|
|
|
larger_vspace: bool = False, # TODO cleanup @ redesign
|
|
|
|
|
exc: ExceptionType = wire.ActionCancelled,
|
|
|
|
|
br_code: EnumTypeButtonRequestType = ButtonRequestType.Other,
|
|
|
|
|
**kwargs: Any,
|
|
|
|
|
) -> None:
|
|
|
|
|
text = Text(
|
|
|
|
|
title,
|
|
|
|
@ -118,10 +117,13 @@ async def confirm_action(
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
cls = HoldToConfirm if hold else Confirm
|
|
|
|
|
kwargs = {}
|
|
|
|
|
if hold_danger:
|
|
|
|
|
kwargs = {"loader_style": LoaderDanger, "confirm_style": ButtonCancel}
|
|
|
|
|
await raise_if_cancelled(
|
|
|
|
|
interact(
|
|
|
|
|
ctx,
|
|
|
|
|
cls(text, confirm=verb, cancel=verb_cancel),
|
|
|
|
|
cls(text, confirm=verb, cancel=verb_cancel, **kwargs),
|
|
|
|
|
br_type,
|
|
|
|
|
br_code,
|
|
|
|
|
),
|
|
|
|
@ -129,21 +131,6 @@ async def confirm_action(
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO cleanup @ redesign
|
|
|
|
|
async def confirm_wipe(ctx: wire.GenericContext) -> None:
|
|
|
|
|
text = Text("Wipe device", ui.ICON_WIPE, ui.RED)
|
|
|
|
|
text.normal("Do you really want to", "wipe the device?", "")
|
|
|
|
|
text.bold("All data will be lost.")
|
|
|
|
|
await raise_if_cancelled(
|
|
|
|
|
interact(
|
|
|
|
|
ctx,
|
|
|
|
|
HoldToConfirm(text, confirm_style=ButtonCancel, loader_style=LoaderDanger),
|
|
|
|
|
"wipe_device",
|
|
|
|
|
ButtonRequestType.WipeDevice,
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def confirm_reset_device(ctx: wire.GenericContext, prompt: str) -> None:
|
|
|
|
|
text = Text("Create new wallet", ui.ICON_RESET, new_lines=False)
|
|
|
|
|
text.bold(prompt)
|
|
|
|
|