1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-20 13:28:10 +00:00

feat(core): slight change of passphrase copy

Usage of different copy in mercury (especially titles and subtitles)
requires moving the layout code deeper into the model specifics.

[no changelog]
This commit is contained in:
obrusvit 2024-08-08 19:16:08 +02:00 committed by Vít Obrusník
parent 80792eae5a
commit b7dc557bfa
5 changed files with 135 additions and 37 deletions

View File

@ -147,33 +147,24 @@ async def _require_confirm_change_label(label: str) -> None:
async def _require_confirm_change_passphrase(use: bool) -> None: async def _require_confirm_change_passphrase(use: bool) -> None:
description = TR.passphrase__turn_on if use else TR.passphrase__turn_off from trezor.ui.layouts import confirm_change_passphrase
verb = TR.buttons__turn_on if use else TR.buttons__turn_off
await confirm_action( await confirm_change_passphrase(use)
"set_passphrase",
TR.passphrase__title_settings,
description=description, async def _require_confirm_hide_passphrase_from_host(enable: bool) -> None:
verb=verb, from trezor.ui.layouts import confirm_hide_passphrase_from_host
br_code=BRT_PROTECT_CALL,
prompt_screen=True, if enable:
) await confirm_hide_passphrase_from_host()
async def _require_confirm_change_passphrase_source( async def _require_confirm_change_passphrase_source(
passphrase_always_on_device: bool, passphrase_always_on_device: bool,
) -> None: ) -> None:
description = ( from trezor.ui.layouts import confirm_change_passphrase_source
TR.passphrase__always_on_device
if passphrase_always_on_device await confirm_change_passphrase_source(passphrase_always_on_device)
else TR.passphrase__revoke_on_device
)
await confirm_action(
"set_passphrase_source",
TR.passphrase__title_source,
description=description,
br_code=BRT_PROTECT_CALL,
prompt_screen=True,
)
async def _require_confirm_change_display_rotation(rotation: int) -> None: async def _require_confirm_change_display_rotation(rotation: int) -> None:
@ -263,17 +254,6 @@ async def _require_confirm_experimental_features(enable: bool) -> None:
) )
async def _require_confirm_hide_passphrase_from_host(enable: bool) -> None:
if enable:
await confirm_action(
"set_hide_passphrase_from_host",
TR.passphrase__title_hide,
description=TR.passphrase__hide,
br_code=BRT_PROTECT_CALL,
prompt_screen=True,
)
if utils.USE_HAPTIC: if utils.USE_HAPTIC:
async def _require_confirm_haptic_feedback(enable: bool) -> None: async def _require_confirm_haptic_feedback(enable: bool) -> None:

View File

@ -446,6 +446,48 @@ def confirm_homescreen(
) )
def confirm_change_passphrase(use: bool) -> Awaitable[None]:
description = TR.passphrase__turn_on if use else TR.passphrase__turn_off
return confirm_action(
"set_passphrase",
TR.passphrase__title_passphrase,
subtitle=TR.words__settings,
description=description,
br_code=ButtonRequestType.ProtectCall,
prompt_screen=True,
)
def confirm_hide_passphrase_from_host() -> Awaitable[None]:
return confirm_action(
"set_hide_passphrase_from_host",
TR.passphrase__title_passphrase,
subtitle=TR.words__settings,
description=TR.passphrase__hide,
br_code=ButtonRequestType.ProtectCall,
prompt_screen=True,
)
def confirm_change_passphrase_source(
passphrase_always_on_device: bool,
) -> Awaitable[None]:
description = (
TR.passphrase__always_on_device
if passphrase_always_on_device
else TR.passphrase__revoke_on_device
)
return confirm_action(
"set_passphrase_source",
TR.passphrase__title_passphrase,
subtitle=TR.words__settings,
description=description,
br_code=ButtonRequestType.ProtectCall,
prompt_screen=True,
)
async def show_address( async def show_address(
address: str, address: str,
*, *,

View File

@ -394,7 +394,7 @@ def confirm_action(
reverse: bool = False, reverse: bool = False,
exc: ExceptionType = ActionCancelled, exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_CODE_OTHER, br_code: ButtonRequestType = BR_CODE_OTHER,
prompt_screen: bool = False, prompt_screen: bool = False, # unused on TR
prompt_title: str | None = None, prompt_title: str | None = None,
) -> Awaitable[None]: ) -> Awaitable[None]:
verb = verb or TR.buttons__confirm # def_arg verb = verb or TR.buttons__confirm # def_arg
@ -536,6 +536,44 @@ def confirm_homescreen(image: bytes) -> Awaitable[None]:
) )
def confirm_change_passphrase(use: bool) -> Awaitable[None]:
description = TR.passphrase__turn_on if use else TR.passphrase__turn_off
verb = TR.buttons__turn_on if use else TR.buttons__turn_off
return confirm_action(
"set_passphrase",
TR.passphrase__title_settings,
description=description,
verb=verb,
br_code=ButtonRequestType.ProtectCall,
)
def confirm_hide_passphrase_from_host() -> Awaitable[None]:
return confirm_action(
"set_hide_passphrase_from_host",
TR.passphrase__title_hide,
description=TR.passphrase__hide,
br_code=ButtonRequestType.ProtectCall,
)
def confirm_change_passphrase_source(
passphrase_always_on_device: bool,
) -> Awaitable[None]:
description = (
TR.passphrase__always_on_device
if passphrase_always_on_device
else TR.passphrase__revoke_on_device
)
return confirm_action(
"set_passphrase_source",
TR.passphrase__title_source,
description=description,
br_code=ButtonRequestType.ProtectCall,
)
async def show_address( async def show_address(
address: str, address: str,
*, *,

View File

@ -303,7 +303,7 @@ def confirm_action(
reverse: bool = False, reverse: bool = False,
exc: ExceptionType = ActionCancelled, exc: ExceptionType = ActionCancelled,
br_code: ButtonRequestType = BR_CODE_OTHER, br_code: ButtonRequestType = BR_CODE_OTHER,
prompt_screen: bool = False, prompt_screen: bool = False, # unused on TT
prompt_title: str | None = None, prompt_title: str | None = None,
) -> Awaitable[None]: ) -> Awaitable[None]:
if description is not None and description_param is not None: if description is not None and description_param is not None:
@ -469,6 +469,44 @@ def confirm_homescreen(image: bytes) -> Awaitable[None]:
) )
def confirm_change_passphrase(use: bool) -> Awaitable[None]:
description = TR.passphrase__turn_on if use else TR.passphrase__turn_off
verb = TR.buttons__turn_on if use else TR.buttons__turn_off
return confirm_action(
"set_passphrase",
TR.passphrase__title_settings,
description=description,
verb=verb,
br_code=ButtonRequestType.ProtectCall,
)
def confirm_hide_passphrase_from_host() -> Awaitable[None]:
return confirm_action(
"set_hide_passphrase_from_host",
TR.passphrase__title_hide,
description=TR.passphrase__hide,
br_code=ButtonRequestType.ProtectCall,
)
def confirm_change_passphrase_source(
passphrase_always_on_device: bool,
) -> Awaitable[None]:
description = (
TR.passphrase__always_on_device
if passphrase_always_on_device
else TR.passphrase__revoke_on_device
)
return confirm_action(
"set_passphrase_source",
TR.passphrase__title_source,
description=description,
br_code=ButtonRequestType.ProtectCall,
)
async def show_address( async def show_address(
address: str, address: str,
*, *,

View File

@ -1,8 +1,8 @@
{ {
"current": { "current": {
"merkle_root": "14c1d561c00b83c685a89d37be68d94dae0fb8b88835d346c877e6246fe022e3", "merkle_root": "14c1d561c00b83c685a89d37be68d94dae0fb8b88835d346c877e6246fe022e3",
"datetime": "2024-08-07T21:19:23.594799", "datetime": "2024-08-09T07:44:08.162423",
"commit": "0a6b0baa2790360902f9a451f595325f9c8c1fb0" "commit": "89a3ce360514eff165fe0fcb0c2a218b88d85e07"
}, },
"history": [ "history": [
{ {