From 2e10d440faef59d870bdc8d0281f85080bbcd6b4 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Fri, 17 May 2024 15:38:51 +0200 Subject: [PATCH] fix(core): add subtitle to confirm action [no changelog] --- .../ui/model_mercury/flow/confirm_action.rs | 25 +++++++++++++------ core/embed/rust/src/ui/model_tr/layout.rs | 2 ++ core/embed/rust/src/ui/model_tt/layout.rs | 2 ++ core/mocks/generated/trezorui2.pyi | 4 +++ .../src/trezor/ui/layouts/mercury/__init__.py | 4 +++ core/src/trezor/ui/layouts/tr/__init__.py | 3 +++ core/src/trezor/ui/layouts/tt/__init__.py | 3 +++ 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/core/embed/rust/src/ui/model_mercury/flow/confirm_action.rs b/core/embed/rust/src/ui/model_mercury/flow/confirm_action.rs index a2e73c071..73f73b217 100644 --- a/core/embed/rust/src/ui/model_mercury/flow/confirm_action.rs +++ b/core/embed/rust/src/ui/model_mercury/flow/confirm_action.rs @@ -121,6 +121,10 @@ fn new_confirm_action_obj(_args: &[Obj], kwargs: &Map) -> Result = kwargs.get(Qstr::MP_QSTR_action)?.try_into_option()?; let description: Option = kwargs.get(Qstr::MP_QSTR_description)?.try_into_option()?; + let subtitle: Option = kwargs + .get(Qstr::MP_QSTR_subtitle) + .unwrap_or(Obj::const_none()) + .try_into_option()?; // let verb: Option = kwargs // .get(Qstr::MP_QSTR_verb) // .unwrap_or_else(|_| Obj::const_none()) @@ -150,10 +154,16 @@ fn new_confirm_action_obj(_args: &[Obj], kwargs: &Map) -> Result Result Some(FlowMsg::Confirmed), diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 55ee4ab8f..29f0f4b9b 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -1642,11 +1642,13 @@ pub static mp_module_trezorui2: Module = obj_module! { /// title: str, /// action: str | None, /// description: str | None, + /// subtitle: str | None = None, /// verb: str = "CONFIRM", /// verb_cancel: str | None = None, /// hold: bool = False, /// hold_danger: bool = False, # unused on TR /// reverse: bool = False, + /// prompt_screen: bool = False, /// ) -> LayoutObj[UiResult]: /// """Confirm action.""" Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(), diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index b0bcb0515..aeba4a33d 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -1708,11 +1708,13 @@ pub static mp_module_trezorui2: Module = obj_module! { /// title: str, /// action: str | None, /// description: str | None, + /// subtitle: str | None = None, /// verb: str | None = None, /// verb_cancel: str | None = None, /// hold: bool = False, /// hold_danger: bool = False, /// reverse: bool = False, + /// prompt_screen: bool = False, /// ) -> LayoutObj[UiResult]: /// """Confirm action.""" Qstr::MP_QSTR_confirm_action => obj_fn_kw!(0, new_confirm_action).as_obj(), diff --git a/core/mocks/generated/trezorui2.pyi b/core/mocks/generated/trezorui2.pyi index 52e099bd6..67604acc0 100644 --- a/core/mocks/generated/trezorui2.pyi +++ b/core/mocks/generated/trezorui2.pyi @@ -623,11 +623,13 @@ def confirm_action( title: str, action: str | None, description: str | None, + subtitle: str | None = None, verb: str = "CONFIRM", verb_cancel: str | None = None, hold: bool = False, hold_danger: bool = False, # unused on TR reverse: bool = False, + prompt_screen: bool = False, ) -> LayoutObj[UiResult]: """Confirm action.""" @@ -1147,11 +1149,13 @@ def confirm_action( title: str, action: str | None, description: str | None, + subtitle: str | None = None, verb: str | None = None, verb_cancel: str | None = None, hold: bool = False, hold_danger: bool = False, reverse: bool = False, + prompt_screen: bool = False, ) -> LayoutObj[UiResult]: """Confirm action.""" diff --git a/core/src/trezor/ui/layouts/mercury/__init__.py b/core/src/trezor/ui/layouts/mercury/__init__.py index 98775be17..51fdb01c0 100644 --- a/core/src/trezor/ui/layouts/mercury/__init__.py +++ b/core/src/trezor/ui/layouts/mercury/__init__.py @@ -283,6 +283,7 @@ async def confirm_action( action: str | None = None, description: str | None = None, description_param: str | None = None, + subtitle: str | None = None, verb: str | None = None, verb_cancel: str | None = None, hold: bool = False, @@ -290,6 +291,7 @@ async def confirm_action( reverse: bool = False, exc: ExceptionType = ActionCancelled, br_code: ButtonRequestType = BR_TYPE_OTHER, + prompt_screen: bool = False, ) -> None: if description is not None and description_param is not None: description = description.format(description_param) @@ -301,11 +303,13 @@ async def confirm_action( title=title, action=action, description=description, + subtitle=subtitle, verb=verb, verb_cancel=verb_cancel, hold=hold, hold_danger=hold_danger, reverse=reverse, + prompt_screen=prompt_screen, ) ), br_type, diff --git a/core/src/trezor/ui/layouts/tr/__init__.py b/core/src/trezor/ui/layouts/tr/__init__.py index 8101160d5..58288a78f 100644 --- a/core/src/trezor/ui/layouts/tr/__init__.py +++ b/core/src/trezor/ui/layouts/tr/__init__.py @@ -374,6 +374,7 @@ def confirm_action( action: str | None = None, description: str | None = None, description_param: str | None = None, + subtitle: str | None = None, verb: str | None = None, verb_cancel: str | None = "", hold: bool = False, @@ -381,6 +382,7 @@ def confirm_action( reverse: bool = False, exc: ExceptionType = ActionCancelled, br_code: ButtonRequestType = BR_TYPE_OTHER, + prompt_screen: bool = False, ) -> Awaitable[None]: verb = verb or TR.buttons__confirm # def_arg if description is not None and description_param is not None: @@ -393,6 +395,7 @@ def confirm_action( title=title, action=action, description=description, + subtitle=subtitle, verb=verb, verb_cancel=verb_cancel, hold=hold, diff --git a/core/src/trezor/ui/layouts/tt/__init__.py b/core/src/trezor/ui/layouts/tt/__init__.py index 4fe81b511..089926ac7 100644 --- a/core/src/trezor/ui/layouts/tt/__init__.py +++ b/core/src/trezor/ui/layouts/tt/__init__.py @@ -289,6 +289,7 @@ def confirm_action( action: str | None = None, description: str | None = None, description_param: str | None = None, + subtitle: str | None = None, verb: str | None = None, verb_cancel: str | None = None, hold: bool = False, @@ -296,6 +297,7 @@ def confirm_action( reverse: bool = False, exc: ExceptionType = ActionCancelled, br_code: ButtonRequestType = BR_TYPE_OTHER, + prompt_screen: bool = False, ) -> Awaitable[None]: if description is not None and description_param is not None: description = description.format(description_param) @@ -307,6 +309,7 @@ def confirm_action( title=title, action=action, description=description, + subtitle=subtitle, verb=verb, verb_cancel=verb_cancel, hold=hold,