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

fixup! fixup! refactor(core): drop confirm_blob_with_optional_pagination

This commit is contained in:
Ioan Bizău 2024-11-18 13:58:02 +01:00
parent 4ede5370e4
commit 7abacb3ff7
5 changed files with 26 additions and 56 deletions

View File

@ -176,9 +176,16 @@ def require_confirm_address(address_bytes: bytes) -> Awaitable[None]:
def require_confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
from trezor.ui.layouts import confirm_other_data
return confirm_other_data(data, data_total)
return confirm_blob(
"confirm_data",
TR.ethereum__title_input_data,
data,
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=TR.send__cancel_sign,
br_code=ButtonRequestType.SignTx,
ask_pagination=True,
)
async def confirm_typed_data_final() -> None:

View File

@ -715,18 +715,6 @@ def _confirm_summary(
if not utils.BITCOIN_ONLY:
def confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
return confirm_blob(
"confirm_data",
TR.ethereum__title_input_data,
data,
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=TR.send__cancel_sign,
br_code=ButtonRequestType.SignTx,
ask_pagination=True,
)
def confirm_ethereum_unknown_contract_warning() -> Awaitable[None]:
return raise_if_not_confirmed(
trezorui2.flow_warning_hi_prio(

View File

@ -559,7 +559,7 @@ def confirm_blob(
text_mono: bool = True,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = "", # icon
verb_cancel: str | None = None, # icon
info: bool = True,
hold: bool = False,
br_code: ButtonRequestType = BR_CODE_OTHER,
@ -573,7 +573,7 @@ def confirm_blob(
description=description,
data=data,
verb=verb,
verb_cancel=verb_cancel,
verb_cancel=None,
hold=hold,
chunkify=chunkify,
)
@ -581,7 +581,7 @@ def confirm_blob(
if ask_pagination and layout.page_count() > 1:
assert not hold
return _confirm_ask_pagination(
br_name, title, data, description or "", verb_cancel, br_code
br_name, title, data, description or "", br_code
)
else:
return raise_if_not_confirmed(layout, br_name, br_code)
@ -592,7 +592,6 @@ async def _confirm_ask_pagination(
title: str,
data: bytes | str,
description: str,
verb_cancel: str | None,
br_code: ButtonRequestType,
) -> None:
# TODO: make should_show_more/confirm_more accept bytes directly
@ -611,7 +610,7 @@ async def _confirm_ask_pagination(
if not await should_show_more(
title,
para=[(ui.NORMAL, description), (ui.MONO, data)],
verb_cancel=verb_cancel,
verb_cancel=None,
br_name=br_name,
br_code=br_code,
):
@ -805,19 +804,6 @@ def confirm_total(
if not utils.BITCOIN_ONLY:
def confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
return confirm_blob(
"confirm_data",
TR.ethereum__title_input_data,
data,
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=None,
br_code=ButtonRequestType.SignTx,
ask_pagination=True,
)
def confirm_ethereum_unknown_contract_warning() -> Awaitable[ui.UiResult]:
return show_warning(
"unknown_contract_warning",
@ -1116,13 +1102,18 @@ async def confirm_signverify(
br_code=BR_CODE_OTHER,
)
try:
await confirm_blob(
await raise_if_not_confirmed(
trezorui2.confirm_blob(
title=TR.sign_message__confirm_message,
description=None,
data=message,
verb=None,
verb_cancel="^",
hold=False,
chunkify=chunkify,
),
br_name,
TR.sign_message__confirm_message,
message,
verb_cancel="^",
br_code=BR_CODE_OTHER,
ask_pagination=True,
BR_CODE_OTHER,
)
except ActionCancelled:
continue

View File

@ -574,7 +574,7 @@ def confirm_blob(
data=data,
hold=hold,
verb=verb,
verb_cancel=verb_cancel,
verb_cancel=None,
chunkify=chunkify,
)
@ -770,18 +770,6 @@ def _confirm_summary(
if not utils.BITCOIN_ONLY:
def confirm_other_data(data: bytes, data_total: int) -> Awaitable[None]:
return confirm_blob(
"confirm_data",
TR.ethereum__title_input_data,
data,
TR.ethereum__data_size_template.format(data_total),
verb=TR.buttons__confirm,
verb_cancel=None,
br_code=ButtonRequestType.SignTx,
ask_pagination=True,
)
def confirm_ethereum_unknown_contract_warning() -> Awaitable[None]:
return show_warning(
"unknown_contract_warning",

View File

@ -216,10 +216,6 @@ class InputFlowSignMessagePagination(InputFlowBase):
yield
self.debug.press_yes()
# press info
yield
self.debug.press_right()
# paginate through the whole message
br = yield
# TODO: try load the message_read the same way as in model T