Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mmilata committed Aug 26, 2024
1 parent c754ee7 commit 80efd33
Show file tree
Hide file tree
Showing 24 changed files with 464 additions and 236 deletions.
33 changes: 33 additions & 0 deletions core/embed/rust/src/translations/generated/translated_string.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions core/embed/rust/src/ui/component/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use core::mem;
use heapless::Vec;

use crate::{
strutil::TString,
strutil::{ShortString, TString},
time::Duration,
ui::{
button_request::{ButtonRequest, ButtonRequestCode},
Expand Down Expand Up @@ -584,12 +584,13 @@ impl EventCtx {
///
/// Also currently the type for message emitted by Flow::event to
/// micropython. They don't need to be the same.
#[derive(Copy, Clone)]
#[derive(Clone)]
pub enum FlowMsg {
Confirmed,
Cancelled,
Info,
Choice(usize),
Text(ShortString),
}

#[cfg(feature = "micropython")]
Expand All @@ -604,6 +605,7 @@ 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) => todo!(),
}
}
}
17 changes: 2 additions & 15 deletions core/embed/rust/src/ui/flow/base.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
use crate::{
strutil::ShortString,
ui::component::{base::AttachType, swipe_detect::SwipeConfig, SwipeDirection},
};

pub use crate::ui::component::FlowMsg;

pub trait Swipable {
fn get_swipe_config(&self) -> SwipeConfig;

fn get_internal_page_count(&self) -> usize;
}

/// Component::Msg for component parts of a flow. Converting results of
/// different screens to a shared type makes things easier to work with.
///
/// Also currently the type for message emitted by Flow::event to
/// micropython. They don't need to be the same.
#[derive(Clone)]
pub enum FlowMsg {
Confirmed,
Cancelled,
Info,
Choice(usize),
Text(ShortString),
}

/// Composable event handler result.
#[derive(Clone)]
pub enum Decision {
Expand Down
4 changes: 4 additions & 0 deletions core/embed/rust/src/ui/flow/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ impl<T: Component + Paginate> SwipePage<T> {
current: 0,
}
}

pub fn inner(&self) -> &T {
&self.inner
}
}

impl<T: Component + Paginate> Component for SwipePage<T> {
Expand Down
Loading

0 comments on commit 80efd33

Please sign in to comment.