diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/mod.rs b/core/embed/rust/src/ui/layout_eckhart/flow/mod.rs index 1f050353ef..82d0dfc028 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/mod.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/mod.rs @@ -15,6 +15,7 @@ pub mod request_passphrase; pub mod show_danger; pub mod show_share_words; pub mod show_thp_pairing_code; +pub mod util; #[cfg(feature = "universal_fw")] pub use confirm_fido::new_confirm_fido; diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/util.rs b/core/embed/rust/src/ui/layout_eckhart/flow/util.rs new file mode 100644 index 0000000000..0bd90f032a --- /dev/null +++ b/core/embed/rust/src/ui/layout_eckhart/flow/util.rs @@ -0,0 +1,40 @@ +use crate::{ + error::Error, + maybe_trace::MaybeTrace, + ui::{ + component::Component, + flow::{ + base::{Decision, DecisionBuilder}, + FlowController, FlowMsg, Swipable, SwipeFlow, + }, + geometry::Direction, + }, +}; + +enum SinglePage { + Show, +} + +impl FlowController for SinglePage { + #[inline] + fn index(&'static self) -> usize { + 0 + } + + fn handle_swipe(&'static self, _direction: Direction) -> Decision { + self.do_nothing() + } + + fn handle_event(&'static self, msg: FlowMsg) -> Decision { + self.return_msg(msg) + } +} + +pub fn single_page(layout: T) -> Result +where + T: Component + Swipable + MaybeTrace + 'static, +{ + let mut flow = SwipeFlow::new(&SinglePage::Show)?; + flow.add_page(&SinglePage::Show, layout)?; + Ok(flow) +}