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:
parent
79a80722d6
commit
f6294ceb37
@ -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;
|
||||
|
40
core/embed/rust/src/ui/layout_eckhart/flow/util.rs
Normal file
40
core/embed/rust/src/ui/layout_eckhart/flow/util.rs
Normal 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user