1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-08-01 11:28:20 +00:00

feat(eckhart): implement single_page flow

[no changelog]
This commit is contained in:
Ioan Bizău 2025-07-21 13:26:20 +02:00 committed by Ioan Bizău
parent 79a80722d6
commit f6294ceb37
2 changed files with 41 additions and 0 deletions

View File

@ -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;

View File

@ -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<T>(layout: T) -> Result<SwipeFlow, Error>
where
T: Component<Msg = FlowMsg> + Swipable + MaybeTrace + 'static,
{
let mut flow = SwipeFlow::new(&SinglePage::Show)?;
flow.add_page(&SinglePage::Show, layout)?;
Ok(flow)
}