From 8d78dd887248c3e56c41ab9f2d622297b7d6fc77 Mon Sep 17 00:00:00 2001 From: grdddj Date: Mon, 7 Aug 2023 13:07:36 +0200 Subject: [PATCH] chore(core): change some UI text and TR's screens to match the Figma designs [no changelog] --- core/embed/rust/src/ui/model_tr/layout.rs | 6 +-- core/src/apps/bitcoin/sign_tx/layout.py | 12 +++--- .../apps/management/get_next_u2f_counter.py | 4 +- .../management/recovery_device/__init__.py | 3 +- .../apps/management/recovery_device/layout.py | 10 +++-- core/src/apps/management/set_u2f_counter.py | 3 +- .../webauthn/list_resident_credentials.py | 3 +- core/src/trezor/ui/layouts/tr/__init__.py | 8 ++-- core/src/trezor/ui/layouts/tr/reset.py | 6 +-- tests/click_tests/test_autolock.py | 5 +-- tests/input_flows.py | 40 ++++++++----------- tests/input_flows_helpers.py | 4 +- .../test_shamir_persistence.py | 2 +- 13 files changed, 51 insertions(+), 55 deletions(-) diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index f730f8155..6729cc727 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -496,7 +496,7 @@ extern "C" fn new_confirm_value(n_args: usize, args: *const Obj, kwargs: *mut Ma title, paragraphs, verb.unwrap_or_else(|| "CONFIRM".into()), - None, + Some("".into()), hold, ) }; @@ -519,7 +519,7 @@ extern "C" fn new_confirm_joint_total(n_args: usize, args: *const Obj, kwargs: * "JOINT TRANSACTION".into(), paragraphs, "HOLD TO CONFIRM".into(), - None, + Some("".into()), true, ) }; @@ -552,7 +552,7 @@ extern "C" fn new_confirm_modify_output(n_args: usize, args: *const Obj, kwargs: "MODIFY AMOUNT".into(), paragraphs, "CONFIRM".into(), - None, + Some("".into()), false, ) }; diff --git a/core/src/apps/bitcoin/sign_tx/layout.py b/core/src/apps/bitcoin/sign_tx/layout.py index a8b3eeea2..68222b168 100644 --- a/core/src/apps/bitcoin/sign_tx/layout.py +++ b/core/src/apps/bitcoin/sign_tx/layout.py @@ -263,8 +263,8 @@ async def confirm_unverified_external_input() -> None: await layouts.show_warning( "unverified_external_input", "The transaction contains unverified external inputs.", - "Proceed anyway?", - button="Proceed", + "Continue anyway?", + button="Continue", br_code=ButtonRequestType.SignTx, ) @@ -276,16 +276,16 @@ async def confirm_nondefault_locktime(lock_time: int, lock_time_disabled: bool) await layouts.show_warning( "nondefault_locktime", "Locktime is set but will have no effect.", - "Proceed anyway?", - button="Proceed", + "Continue anyway?", + button="Continue", br_code=ButtonRequestType.SignTx, ) else: if lock_time < _LOCKTIME_TIMESTAMP_MIN_VALUE: - text = "Locktime for this transaction is set to blockheight:" + text = "Locktime set to blockheight:" value = str(lock_time) else: - text = "Locktime for this transaction is set to:" + text = "Locktime set to:" value = format_timestamp(lock_time) await layouts.confirm_value( "Confirm locktime", diff --git a/core/src/apps/management/get_next_u2f_counter.py b/core/src/apps/management/get_next_u2f_counter.py index 85fe95c49..d0c51b2d2 100644 --- a/core/src/apps/management/get_next_u2f_counter.py +++ b/core/src/apps/management/get_next_u2f_counter.py @@ -16,8 +16,8 @@ async def get_next_u2f_counter(msg: GetNextU2FCounter) -> NextU2FCounter: await confirm_action( "get_u2f_counter", - "Get next U2F counter", - description="Do you really want to increase and retrieve the U2F counter?", + "Get U2F counter", + description="Increase and retrieve the U2F counter?", br_code=ButtonRequestType.ProtectCall, ) diff --git a/core/src/apps/management/recovery_device/__init__.py b/core/src/apps/management/recovery_device/__init__.py index 40d81b7fd..b38b3e2b8 100644 --- a/core/src/apps/management/recovery_device/__init__.py +++ b/core/src/apps/management/recovery_device/__init__.py @@ -61,8 +61,9 @@ async def recovery_device(msg: RecoveryDevice) -> Success: await confirm_action( "confirm_seedcheck", "Backup check", - description="Do you really want to check the recovery seed?", + description="Check your backup?", br_code=ButtonRequestType.ProtectCall, + verb="Check", ) # END _continue_dialog # -------------------------------------------------------- diff --git a/core/src/apps/management/recovery_device/layout.py b/core/src/apps/management/recovery_device/layout.py index 3e530707f..e34c7f140 100644 --- a/core/src/apps/management/recovery_device/layout.py +++ b/core/src/apps/management/recovery_device/layout.py @@ -20,16 +20,18 @@ async def _confirm_abort(dry_run: bool = False) -> None: if dry_run: await confirm_action( "abort_recovery", - "Abort backup check", - description="Do you really want to abort the backup check?", + "Cancel backup check", + description="Are you sure you want to cancel the backup check?", + verb="CANCEL", br_code=ButtonRequestType.ProtectCall, ) else: await confirm_action( "abort_recovery", - "Abort recovery", + "Cancel recovery", "All progress will be lost.", - "Do you really want to abort the recovery process?", + "Are you sure you want to cancel the recovery process?", + verb="CANCEL", reverse=True, br_code=ButtonRequestType.ProtectCall, ) diff --git a/core/src/apps/management/set_u2f_counter.py b/core/src/apps/management/set_u2f_counter.py index 1b064b353..e32b30666 100644 --- a/core/src/apps/management/set_u2f_counter.py +++ b/core/src/apps/management/set_u2f_counter.py @@ -19,8 +19,9 @@ async def set_u2f_counter(msg: SetU2FCounter) -> Success: await confirm_action( "set_u2f_counter", "Set U2F counter", - description="Do you really want to set the U2F counter to {}?", + description="Set the U2F counter to {}?", description_param=str(msg.u2f_counter), + verb="SET", br_code=ButtonRequestType.ProtectCall, ) diff --git a/core/src/apps/webauthn/list_resident_credentials.py b/core/src/apps/webauthn/list_resident_credentials.py index 9e0357a7f..f7485bb05 100644 --- a/core/src/apps/webauthn/list_resident_credentials.py +++ b/core/src/apps/webauthn/list_resident_credentials.py @@ -15,7 +15,8 @@ async def list_resident_credentials( await confirm_action( "credentials_list", "List credentials", - description="Do you want to export information about the resident credentials stored on this device?", + description="Export information about the credentials stored on this device?", + verb="EXPORT", ) creds = [ WebAuthnCredential( diff --git a/core/src/trezor/ui/layouts/tr/__init__.py b/core/src/trezor/ui/layouts/tr/__init__.py index cd4aa14a0..5661535b8 100644 --- a/core/src/trezor/ui/layouts/tr/__init__.py +++ b/core/src/trezor/ui/layouts/tr/__init__.py @@ -634,7 +634,7 @@ def show_success( # Special case for Shamir backup - to show everything just on one page # in regular font. if "Continue with" in content: - content = f"{subheader}\n{content}" + content = f"{subheader}\n\n{content}" subheader = None title = "" @@ -760,6 +760,7 @@ async def confirm_blob( description=description, data=data, extra=None, + verb_cancel="", # to show the cancel icon hold=hold, ) ) @@ -956,10 +957,10 @@ async def confirm_replacement(description: str, txid: str) -> None: await confirm_value( description.upper(), txid, - "Confirm transaction ID:", + "Transaction ID:", "confirm_replacement", ButtonRequestType.SignTx, - verb="CONFIRM", + verb="CONTINUE", ) @@ -1161,6 +1162,7 @@ async def confirm_reenter_pin( title, description=f"Please re-enter {description} to confirm.", verb="CONTINUE", + verb_cancel=None, br_code=BR_TYPE_OTHER, ) diff --git a/core/src/trezor/ui/layouts/tr/reset.py b/core/src/trezor/ui/layouts/tr/reset.py index 973e8982d..64052e758 100644 --- a/core/src/trezor/ui/layouts/tr/reset.py +++ b/core/src/trezor/ui/layouts/tr/reset.py @@ -31,7 +31,7 @@ async def show_share_words( title = f"SHARE #{share_index + 1}" check_title = f"CHECK SHARE #{share_index + 1}" else: - title = f"G{group_index + 1} - SHARE {share_index + 1}" + title = f"GROUP {group_index + 1} - SHARE {share_index + 1}" check_title = f"GROUP {group_index + 1} - SHARE {share_index + 1}" # We want the option to go back from words to the previous screen @@ -166,7 +166,7 @@ async def slip39_prompt_threshold( await confirm_action( "slip39_prompt_threshold", "Threshold", - description="= minimum number of unique words used for recovery.", + description="= minimum number of unique word lists used for recovery.", verb="CONTINUE", verb_cancel=None, ) @@ -276,8 +276,8 @@ async def show_reset_warning( ) -> None: await show_warning( br_type, - button.upper(), subheader or "", content, + button.upper(), br_code=br_code, ) diff --git a/tests/click_tests/test_autolock.py b/tests/click_tests/test_autolock.py index dbf40c624..225faacb0 100644 --- a/tests/click_tests/test_autolock.py +++ b/tests/click_tests/test_autolock.py @@ -241,10 +241,7 @@ def test_autolock_interrupts_passphrase(device_handler: "BackgroundDeviceHandler def unlock_dry_run(debug: "DebugLink") -> "LayoutContent": - assert ( - "Do you really want to check the recovery seed?" - in debug.wait_layout().text_content() - ) + assert "Check your backup?" in debug.wait_layout().text_content() layout = go_next(debug, wait=True) assert "PinKeyboard" in layout.all_components() diff --git a/tests/input_flows.py b/tests/input_flows.py index 7e23541e3..a6774db57 100644 --- a/tests/input_flows.py +++ b/tests/input_flows.py @@ -624,21 +624,18 @@ class InputFlowLockTimeBlockHeight(InputFlowBase): super().__init__(client) self.block_height = block_height - def input_flow_tt(self) -> BRGeneratorType: - def assert_func(debug: DebugLink) -> None: - layout_text = debug.wait_layout().text_content() - assert "blockheight" in layout_text - assert self.block_height in layout_text + def assert_func(self, debug: DebugLink) -> None: + layout_text = debug.wait_layout().text_content() + assert "blockheight" in layout_text + assert self.block_height in layout_text - yield from lock_time_input_flow_tt(self.debug, assert_func, double_confirm=True) + def input_flow_tt(self) -> BRGeneratorType: + yield from lock_time_input_flow_tt( + self.debug, self.assert_func, double_confirm=True + ) def input_flow_tr(self) -> BRGeneratorType: - def assert_func(debug: DebugLink) -> None: - assert "blockheight" in debug.wait_layout().text_content() - debug.press_right() - assert self.block_height in debug.wait_layout().text_content() - - yield from lock_time_input_flow_tr(self.debug, assert_func) + yield from lock_time_input_flow_tr(self.debug, self.assert_func) class InputFlowLockTimeDatetime(InputFlowBase): @@ -646,21 +643,16 @@ class InputFlowLockTimeDatetime(InputFlowBase): super().__init__(client) self.lock_time_str = lock_time_str - def input_flow_tt(self) -> BRGeneratorType: - def assert_func(debug: DebugLink): - layout_text = debug.wait_layout().text_content() - assert "Locktime" in layout_text - assert self.lock_time_str in layout_text + def assert_func(self, debug: DebugLink): + layout_text = debug.wait_layout().text_content() + assert "Locktime" in layout_text + assert self.lock_time_str in layout_text - yield from lock_time_input_flow_tt(self.debug, assert_func) + def input_flow_tt(self) -> BRGeneratorType: + yield from lock_time_input_flow_tt(self.debug, self.assert_func) def input_flow_tr(self) -> BRGeneratorType: - def assert_func(debug: DebugLink): - assert "Locktime" in debug.wait_layout().text_content() - debug.press_right() - assert self.lock_time_str in debug.wait_layout().text_content() - - yield from lock_time_input_flow_tr(self.debug, assert_func) + yield from lock_time_input_flow_tr(self.debug, self.assert_func) class InputFlowEIP712ShowMore(InputFlowBase): diff --git a/tests/input_flows_helpers.py b/tests/input_flows_helpers.py index d196f1c11..52fa35c45 100644 --- a/tests/input_flows_helpers.py +++ b/tests/input_flows_helpers.py @@ -56,7 +56,7 @@ class RecoveryFlow: def confirm_dry_run(self) -> BRGeneratorType: yield - assert "check the recovery seed" in self.debug.wait_layout().text_content() + assert "Check your backup" in self.debug.wait_layout().text_content() self.debug.press_yes() def setup_slip39_recovery(self, num_words: int) -> BRGeneratorType: @@ -109,7 +109,7 @@ class RecoveryFlow: self.debug.press_no() yield - assert "abort the recovery" in self.debug.wait_layout().text_content() + assert "cancel the recovery" in self.debug.wait_layout().text_content() if self.debug.model == "R": self.debug.press_right() if confirm: diff --git a/tests/persistence_tests/test_shamir_persistence.py b/tests/persistence_tests/test_shamir_persistence.py index d5981ac94..fb3cc5881 100644 --- a/tests/persistence_tests/test_shamir_persistence.py +++ b/tests/persistence_tests/test_shamir_persistence.py @@ -61,7 +61,7 @@ def test_abort(core_emulator: Emulator): assert "Enter your backup" in debug.read_layout().text_content() layout = debug.click(buttons.CANCEL, wait=True) - assert layout.title() == "ABORT RECOVERY" + assert layout.title() in ("ABORT RECOVERY", "CANCEL RECOVERY") layout = debug.click(buttons.OK, wait=True) assert layout.main_component() == "Homescreen"