From 8d1a9bc17fef4d266907d5ef2e3149ad03bbd324 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Fri, 13 Sep 2024 10:53:08 +0200 Subject: [PATCH] chore(core): remove duplicated FlowMsg conversion [no changelog] --- core/embed/rust/src/ui/component/base.rs | 6 +++++- core/embed/rust/src/ui/flow/swipe.rs | 12 +----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/core/embed/rust/src/ui/component/base.rs b/core/embed/rust/src/ui/component/base.rs index 0b96581c2e..02e70acc7f 100644 --- a/core/embed/rust/src/ui/component/base.rs +++ b/core/embed/rust/src/ui/component/base.rs @@ -605,7 +605,11 @@ impl TryFrom for crate::micropython::obj::Obj { FlowMsg::Choice(i) => { Ok((crate::ui::layout::result::CONFIRMED.as_obj(), i.try_into()?).try_into()?) } - FlowMsg::Text(_s) => panic!(), + FlowMsg::Text(s) => Ok(( + crate::ui::layout::result::CONFIRMED.as_obj(), + s.as_str().try_into()?, + ) + .try_into()?), } } } diff --git a/core/embed/rust/src/ui/flow/swipe.rs b/core/embed/rust/src/ui/flow/swipe.rs index b35f9ea065..37589f54a0 100644 --- a/core/embed/rust/src/ui/flow/swipe.rs +++ b/core/embed/rust/src/ui/flow/swipe.rs @@ -357,17 +357,7 @@ impl ObjComponent for SwipeFlow { fn obj_event(&mut self, ctx: &mut EventCtx, event: Event) -> Result { match self.event(ctx, event) { None => Ok(Obj::const_none()), - Some(FlowMsg::Confirmed) => Ok(crate::ui::layout::result::CONFIRMED.as_obj()), - Some(FlowMsg::Cancelled) => Ok(crate::ui::layout::result::CANCELLED.as_obj()), - Some(FlowMsg::Info) => Ok(crate::ui::layout::result::INFO.as_obj()), - Some(FlowMsg::Choice(i)) => { - Ok((crate::ui::layout::result::CONFIRMED.as_obj(), i.try_into()?).try_into()?) - } - Some(FlowMsg::Text(s)) => Ok(( - crate::ui::layout::result::CONFIRMED.as_obj(), - s.as_str().try_into()?, - ) - .try_into()?), + Some(msg) => msg.try_into(), } }