From f6294ceb37b6e505fea439aad9e213c3ce5b8e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Mon, 21 Jul 2025 13:26:20 +0200 Subject: [PATCH] feat(eckhart): implement `single_page` flow [no changelog] --- .../rust/src/ui/layout_eckhart/flow/mod.rs | 1 + .../rust/src/ui/layout_eckhart/flow/util.rs | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 core/embed/rust/src/ui/layout_eckhart/flow/util.rs 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) +}