diff --git a/core/embed/rust/src/ui/model_mercury/component/swipe_content.rs b/core/embed/rust/src/ui/model_mercury/component/swipe_content.rs index 1c7adc8687..e3456fb362 100644 --- a/core/embed/rust/src/ui/model_mercury/component/swipe_content.rs +++ b/core/embed/rust/src/ui/model_mercury/component/swipe_content.rs @@ -113,6 +113,10 @@ impl SwipeContent { ..self } } + + pub fn inner(&self) -> &T { + &self.inner + } } impl Component for SwipeContent { diff --git a/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs b/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs index 33c9ebfa44..8011837b56 100644 --- a/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs +++ b/core/embed/rust/src/ui/model_mercury/component/swipe_up_screen.rs @@ -30,6 +30,10 @@ where swipe: SwipeDetect::new(), } } + + pub fn inner(&self) -> &T { + &self.content + } } impl Component for SwipeUpScreen { diff --git a/core/embed/rust/src/ui/model_mercury/layout.rs b/core/embed/rust/src/ui/model_mercury/layout.rs index 7ea0b5d2a0..b75fcf4782 100644 --- a/core/embed/rust/src/ui/model_mercury/layout.rs +++ b/core/embed/rust/src/ui/model_mercury/layout.rs @@ -181,10 +181,16 @@ impl ComponentMsgObj for PromptScreen { } } -impl ComponentMsgObj for SwipeUpScreen { +impl ComponentMsgObj for SwipeContent { + fn msg_try_into_obj(&self, msg: Self::Msg) -> Result { + self.inner().msg_try_into_obj(msg) + } +} + +impl ComponentMsgObj for SwipeUpScreen { fn msg_try_into_obj(&self, msg: Self::Msg) -> Result { match msg { - SwipeUpScreenMsg::Content(_) => Err(Error::TypeError), + SwipeUpScreenMsg::Content(c) => self.inner().msg_try_into_obj(c), SwipeUpScreenMsg::Swiped => Ok(CONFIRMED.as_obj()), } } @@ -1083,6 +1089,7 @@ extern "C" fn new_confirm_recovery(n_args: usize, args: *const Obj, kwargs: *mut let obj = LayoutObj::new(SwipeUpScreen::new( Frame::left_aligned(notification, SwipeContent::new(paragraphs)) + .with_cancel_button() .with_footer(TR::instructions__swipe_up.into(), None) .with_subtitle(TR::words__instructions.into()) .with_swipe(SwipeDirection::Up, SwipeSettings::default()),