1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

chore(core): remove duplicated FlowMsg conversion

[no changelog]
This commit is contained in:
obrusvit 2024-09-13 10:53:08 +02:00 committed by Vít Obrusník
parent 598039434c
commit 8d1a9bc17f
2 changed files with 6 additions and 12 deletions

View File

@ -605,7 +605,11 @@ impl TryFrom<FlowMsg> 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()?),
}
}
}

View File

@ -357,17 +357,7 @@ impl ObjComponent for SwipeFlow {
fn obj_event(&mut self, ctx: &mut EventCtx, event: Event) -> Result<Obj, Error> {
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(),
}
}