mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-23 13:02:03 +00:00
refactor(core/rust): move ui::component::SwipeDirection to ui::geometry::Direction
it's a rather general thing, no reason to tie its existence to Swipe
This commit is contained in:
parent
48edb483a0
commit
e049efd171
@ -1,5 +1,3 @@
|
|||||||
use core::mem;
|
|
||||||
|
|
||||||
use heapless::Vec;
|
use heapless::Vec;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -18,11 +16,12 @@ use crate::{
|
|||||||
use crate::ui::event::ButtonEvent;
|
use crate::ui::event::ButtonEvent;
|
||||||
use crate::ui::event::USBEvent;
|
use crate::ui::event::USBEvent;
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
use crate::ui::event::{SwipeEvent, TouchEvent};
|
use crate::ui::{
|
||||||
|
event::{SwipeEvent, TouchEvent},
|
||||||
|
geometry::Direction,
|
||||||
|
};
|
||||||
|
|
||||||
use super::Paginate;
|
use super::Paginate;
|
||||||
#[cfg(feature = "touch")]
|
|
||||||
use super::SwipeDirection;
|
|
||||||
|
|
||||||
/// Type used by components that do not return any messages.
|
/// Type used by components that do not return any messages.
|
||||||
///
|
///
|
||||||
@ -101,7 +100,7 @@ impl<T> Child<T> {
|
|||||||
where
|
where
|
||||||
F: FnOnce(&mut EventCtx, &mut T) -> U,
|
F: FnOnce(&mut EventCtx, &mut T) -> U,
|
||||||
{
|
{
|
||||||
let prev_requested = mem::replace(&mut ctx.paint_requested, false);
|
let prev_requested = core::mem::replace(&mut ctx.paint_requested, false);
|
||||||
let result = component_func(ctx, &mut self.component);
|
let result = component_func(ctx, &mut self.component);
|
||||||
if ctx.paint_requested {
|
if ctx.paint_requested {
|
||||||
// If a paint was requested anywhere in the inner component tree, we need to
|
// If a paint was requested anywhere in the inner component tree, we need to
|
||||||
@ -355,7 +354,7 @@ pub enum AttachType {
|
|||||||
/// in the given component.
|
/// in the given component.
|
||||||
Resume,
|
Resume,
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
Swipe(SwipeDirection),
|
Swipe(Direction),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
|
@ -44,7 +44,7 @@ pub use paginated::{PageMsg, Paginate};
|
|||||||
pub use placed::{FixedHeightBar, Floating, GridPlaced, Split};
|
pub use placed::{FixedHeightBar, Floating, GridPlaced, Split};
|
||||||
pub use qr_code::Qr;
|
pub use qr_code::Qr;
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
pub use swipe::{Swipe, SwipeDirection};
|
pub use swipe::Swipe;
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
pub use swipe_detect::{SwipeDetect, SwipeDetectMsg};
|
pub use swipe_detect::{SwipeDetect, SwipeDetectMsg};
|
||||||
pub use text::{
|
pub use text::{
|
||||||
|
@ -1,62 +1,10 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx},
|
component::{Component, Event, EventCtx},
|
||||||
event::TouchEvent,
|
event::TouchEvent,
|
||||||
geometry::{Offset, Point, Rect},
|
geometry::{Direction, Point, Rect},
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, ToPrimitive, FromPrimitive)]
|
|
||||||
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
|
||||||
pub enum SwipeDirection {
|
|
||||||
Up,
|
|
||||||
Down,
|
|
||||||
Left,
|
|
||||||
Right,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SwipeDirection {
|
|
||||||
pub fn as_offset(self, size: Offset) -> Offset {
|
|
||||||
match self {
|
|
||||||
SwipeDirection::Up => Offset::y(-size.y),
|
|
||||||
SwipeDirection::Down => Offset::y(size.y),
|
|
||||||
SwipeDirection::Left => Offset::x(-size.x),
|
|
||||||
SwipeDirection::Right => Offset::x(size.x),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn iter() -> SwipeDirectionIterator {
|
|
||||||
SwipeDirectionIterator::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct SwipeDirectionIterator {
|
|
||||||
current: Option<SwipeDirection>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SwipeDirectionIterator {
|
|
||||||
pub fn new() -> Self {
|
|
||||||
SwipeDirectionIterator {
|
|
||||||
current: Some(SwipeDirection::Up),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Iterator for SwipeDirectionIterator {
|
|
||||||
type Item = SwipeDirection;
|
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
|
||||||
let next_state = match self.current {
|
|
||||||
Some(SwipeDirection::Up) => Some(SwipeDirection::Down),
|
|
||||||
Some(SwipeDirection::Down) => Some(SwipeDirection::Left),
|
|
||||||
Some(SwipeDirection::Left) => Some(SwipeDirection::Right),
|
|
||||||
Some(SwipeDirection::Right) => None,
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
core::mem::replace(&mut self.current, next_state)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Swipe {
|
pub struct Swipe {
|
||||||
pub allow_up: bool,
|
pub allow_up: bool,
|
||||||
@ -119,7 +67,7 @@ impl Swipe {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Component for Swipe {
|
impl Component for Swipe {
|
||||||
type Msg = SwipeDirection;
|
type Msg = Direction;
|
||||||
|
|
||||||
fn place(&mut self, bounds: Rect) -> Rect {
|
fn place(&mut self, bounds: Rect) -> Rect {
|
||||||
bounds
|
bounds
|
||||||
@ -163,18 +111,18 @@ impl Component for Swipe {
|
|||||||
// Horizontal direction.
|
// Horizontal direction.
|
||||||
if self.ratio(abs.x) >= Self::THRESHOLD {
|
if self.ratio(abs.x) >= Self::THRESHOLD {
|
||||||
if ofs.x < 0 && self.allow_left {
|
if ofs.x < 0 && self.allow_left {
|
||||||
return Some(SwipeDirection::Left);
|
return Some(Direction::Left);
|
||||||
} else if ofs.x > 0 && self.allow_right {
|
} else if ofs.x > 0 && self.allow_right {
|
||||||
return Some(SwipeDirection::Right);
|
return Some(Direction::Right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if abs.x < abs.y && (self.allow_up || self.allow_down) {
|
} else if abs.x < abs.y && (self.allow_up || self.allow_down) {
|
||||||
// Vertical direction.
|
// Vertical direction.
|
||||||
if self.ratio(abs.y) >= Self::THRESHOLD {
|
if self.ratio(abs.y) >= Self::THRESHOLD {
|
||||||
if ofs.y < 0 && self.allow_up {
|
if ofs.y < 0 && self.allow_up {
|
||||||
return Some(SwipeDirection::Up);
|
return Some(Direction::Up);
|
||||||
} else if ofs.y > 0 && self.allow_down {
|
} else if ofs.y > 0 && self.allow_down {
|
||||||
return Some(SwipeDirection::Down);
|
return Some(Direction::Down);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,10 +2,10 @@ use crate::{
|
|||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
ui::{
|
ui::{
|
||||||
animation::Animation,
|
animation::Animation,
|
||||||
component::{Event, EventCtx, SwipeDirection},
|
component::{Event, EventCtx},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
event::TouchEvent,
|
event::TouchEvent,
|
||||||
geometry::{Axis, Offset, Point},
|
geometry::{Axis, Direction, Offset, Point},
|
||||||
util::animation_disabled,
|
util::animation_disabled,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -53,12 +53,12 @@ impl SwipeConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_swipe(mut self, dir: SwipeDirection, settings: SwipeSettings) -> Self {
|
pub fn with_swipe(mut self, dir: Direction, settings: SwipeSettings) -> Self {
|
||||||
self[dir] = Some(settings);
|
self[dir] = Some(settings);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_allowed(&self, dir: SwipeDirection) -> bool {
|
pub fn is_allowed(&self, dir: Direction) -> bool {
|
||||||
self[dir].is_some()
|
self[dir].is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,16 +66,16 @@ impl SwipeConfig {
|
|||||||
/// direction.
|
/// direction.
|
||||||
///
|
///
|
||||||
/// If the swipe direction is not allowed, this will return 0.
|
/// If the swipe direction is not allowed, this will return 0.
|
||||||
pub fn progress(&self, dir: SwipeDirection, movement: Offset, threshold: u16) -> u16 {
|
pub fn progress(&self, dir: Direction, movement: Offset, threshold: u16) -> u16 {
|
||||||
if !self.is_allowed(dir) {
|
if !self.is_allowed(dir) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let correct_movement = match dir {
|
let correct_movement = match dir {
|
||||||
SwipeDirection::Right => movement.x > 0,
|
Direction::Right => movement.x > 0,
|
||||||
SwipeDirection::Left => movement.x < 0,
|
Direction::Left => movement.x < 0,
|
||||||
SwipeDirection::Down => movement.y > 0,
|
Direction::Down => movement.y > 0,
|
||||||
SwipeDirection::Up => movement.y < 0,
|
Direction::Up => movement.y < 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if !correct_movement {
|
if !correct_movement {
|
||||||
@ -85,14 +85,14 @@ impl SwipeConfig {
|
|||||||
let movement = movement.abs();
|
let movement = movement.abs();
|
||||||
|
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Right => (movement.x as u16).saturating_sub(threshold),
|
Direction::Right => (movement.x as u16).saturating_sub(threshold),
|
||||||
SwipeDirection::Left => (movement.x as u16).saturating_sub(threshold),
|
Direction::Left => (movement.x as u16).saturating_sub(threshold),
|
||||||
SwipeDirection::Down => (movement.y as u16).saturating_sub(threshold),
|
Direction::Down => (movement.y as u16).saturating_sub(threshold),
|
||||||
SwipeDirection::Up => (movement.y as u16).saturating_sub(threshold),
|
Direction::Up => (movement.y as u16).saturating_sub(threshold),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn duration(&self, dir: SwipeDirection) -> Option<Duration> {
|
pub fn duration(&self, dir: Direction) -> Option<Duration> {
|
||||||
self[dir].as_ref().map(|s| s.duration)
|
self[dir].as_ref().map(|s| s.duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,53 +131,53 @@ impl SwipeConfig {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn paging_event(&self, dir: SwipeDirection, current_page: u16, total_pages: u16) -> u16 {
|
pub fn paging_event(&self, dir: Direction, current_page: u16, total_pages: u16) -> u16 {
|
||||||
let prev_page = current_page.saturating_sub(1);
|
let prev_page = current_page.saturating_sub(1);
|
||||||
let next_page = (current_page + 1).min(total_pages.saturating_sub(1));
|
let next_page = (current_page + 1).min(total_pages.saturating_sub(1));
|
||||||
match (self.page_axis, dir) {
|
match (self.page_axis, dir) {
|
||||||
(Some(Axis::Horizontal), SwipeDirection::Right) => prev_page,
|
(Some(Axis::Horizontal), Direction::Right) => prev_page,
|
||||||
(Some(Axis::Horizontal), SwipeDirection::Left) => next_page,
|
(Some(Axis::Horizontal), Direction::Left) => next_page,
|
||||||
(Some(Axis::Vertical), SwipeDirection::Down) => prev_page,
|
(Some(Axis::Vertical), Direction::Down) => prev_page,
|
||||||
(Some(Axis::Vertical), SwipeDirection::Up) => next_page,
|
(Some(Axis::Vertical), Direction::Up) => next_page,
|
||||||
_ => current_page,
|
_ => current_page,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::ops::Index<SwipeDirection> for SwipeConfig {
|
impl core::ops::Index<Direction> for SwipeConfig {
|
||||||
type Output = Option<SwipeSettings>;
|
type Output = Option<SwipeSettings>;
|
||||||
|
|
||||||
fn index(&self, index: SwipeDirection) -> &Self::Output {
|
fn index(&self, index: Direction) -> &Self::Output {
|
||||||
match index {
|
match index {
|
||||||
SwipeDirection::Up => &self.up,
|
Direction::Up => &self.up,
|
||||||
SwipeDirection::Down => &self.down,
|
Direction::Down => &self.down,
|
||||||
SwipeDirection::Left => &self.left,
|
Direction::Left => &self.left,
|
||||||
SwipeDirection::Right => &self.right,
|
Direction::Right => &self.right,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl core::ops::IndexMut<SwipeDirection> for SwipeConfig {
|
impl core::ops::IndexMut<Direction> for SwipeConfig {
|
||||||
fn index_mut(&mut self, index: SwipeDirection) -> &mut Self::Output {
|
fn index_mut(&mut self, index: Direction) -> &mut Self::Output {
|
||||||
match index {
|
match index {
|
||||||
SwipeDirection::Up => &mut self.up,
|
Direction::Up => &mut self.up,
|
||||||
SwipeDirection::Down => &mut self.down,
|
Direction::Down => &mut self.down,
|
||||||
SwipeDirection::Left => &mut self.left,
|
Direction::Left => &mut self.left,
|
||||||
SwipeDirection::Right => &mut self.right,
|
Direction::Right => &mut self.right,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
pub enum SwipeDetectMsg {
|
pub enum SwipeDetectMsg {
|
||||||
Start(SwipeDirection),
|
Start(Direction),
|
||||||
Move(SwipeDirection, u16),
|
Move(Direction, u16),
|
||||||
Trigger(SwipeDirection),
|
Trigger(Direction),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SwipeDetect {
|
pub struct SwipeDetect {
|
||||||
origin: Option<Point>,
|
origin: Option<Point>,
|
||||||
locked: Option<SwipeDirection>,
|
locked: Option<Direction>,
|
||||||
final_animation: Option<Animation<i16>>,
|
final_animation: Option<Animation<i16>>,
|
||||||
moved: u16,
|
moved: u16,
|
||||||
}
|
}
|
||||||
@ -204,25 +204,25 @@ impl SwipeDetect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn min_lock(&self, dir: SwipeDirection) -> u16 {
|
fn min_lock(&self, dir: Direction) -> u16 {
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Up | SwipeDirection::Down => Self::MIN_LOCK as u16,
|
Direction::Up | Direction::Down => Self::MIN_LOCK as u16,
|
||||||
SwipeDirection::Left | SwipeDirection::Right => {
|
Direction::Left | Direction::Right => {
|
||||||
(Self::MIN_LOCK * Self::VERTICAL_PREFERENCE) as u16
|
(Self::MIN_LOCK * Self::VERTICAL_PREFERENCE) as u16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn min_trigger(&self, dir: SwipeDirection) -> u16 {
|
fn min_trigger(&self, dir: Direction) -> u16 {
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Up | SwipeDirection::Down => Self::MIN_TRIGGER as u16,
|
Direction::Up | Direction::Down => Self::MIN_TRIGGER as u16,
|
||||||
SwipeDirection::Left | SwipeDirection::Right => {
|
Direction::Left | Direction::Right => {
|
||||||
(Self::MIN_TRIGGER * Self::VERTICAL_PREFERENCE) as u16
|
(Self::MIN_TRIGGER * Self::VERTICAL_PREFERENCE) as u16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_lockable(&self, dir: SwipeDirection) -> bool {
|
fn is_lockable(&self, dir: Direction) -> bool {
|
||||||
let Some(origin) = self.origin else {
|
let Some(origin) = self.origin else {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@ -230,10 +230,10 @@ impl SwipeDetect {
|
|||||||
let min_distance = self.min_trigger(dir) as i16;
|
let min_distance = self.min_trigger(dir) as i16;
|
||||||
|
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Up => origin.y > min_distance,
|
Direction::Up => origin.y > min_distance,
|
||||||
SwipeDirection::Down => origin.y < (screen().height() - min_distance),
|
Direction::Down => origin.y < (screen().height() - min_distance),
|
||||||
SwipeDirection::Left => origin.x > min_distance,
|
Direction::Left => origin.x > min_distance,
|
||||||
SwipeDirection::Right => origin.x < (screen().width() - min_distance),
|
Direction::Right => origin.x < (screen().width() - min_distance),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ impl SwipeDetect {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trigger(&mut self, ctx: &mut EventCtx, dir: SwipeDirection, config: SwipeConfig) {
|
pub fn trigger(&mut self, ctx: &mut EventCtx, dir: Direction, config: SwipeConfig) {
|
||||||
ctx.request_anim_frame();
|
ctx.request_anim_frame();
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ impl SwipeDetect {
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let mut res = None;
|
let mut res = None;
|
||||||
for dir in SwipeDirection::iter() {
|
for dir in Direction::iter() {
|
||||||
let progress = config.progress(dir, ofs, self.min_lock(dir));
|
let progress = config.progress(dir, ofs, self.min_lock(dir));
|
||||||
if progress > 0 && self.is_lockable(dir) {
|
if progress > 0 && self.is_lockable(dir) {
|
||||||
self.locked = Some(dir);
|
self.locked = Some(dir);
|
||||||
|
@ -2,7 +2,7 @@ use crate::{error, ui::geometry::Point};
|
|||||||
use core::convert::TryInto;
|
use core::convert::TryInto;
|
||||||
|
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
use crate::ui::component::SwipeDirection;
|
use crate::ui::geometry::Direction;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
||||||
@ -79,6 +79,6 @@ pub enum USBEvent {
|
|||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
||||||
pub enum SwipeEvent {
|
pub enum SwipeEvent {
|
||||||
Move(SwipeDirection, i16),
|
Move(Direction, i16),
|
||||||
End(SwipeDirection),
|
End(Direction),
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
use crate::ui::component::{base::AttachType, swipe_detect::SwipeConfig, SwipeDirection};
|
use crate::ui::{
|
||||||
|
component::{base::AttachType, swipe_detect::SwipeConfig},
|
||||||
|
geometry::Direction,
|
||||||
|
};
|
||||||
|
|
||||||
pub use crate::ui::component::FlowMsg;
|
pub use crate::ui::component::FlowMsg;
|
||||||
|
|
||||||
@ -34,11 +37,12 @@ impl Decision {
|
|||||||
|
|
||||||
/// Flow state type
|
/// Flow state type
|
||||||
///
|
///
|
||||||
/// It is a static dyn reference to a FlowController, which, due to this, is required to
|
/// It is a static dyn reference to a FlowController, which, due to this, is
|
||||||
/// be a plain enum type. Its concrete values then are individual states.
|
/// required to be a plain enum type. Its concrete values then are individual
|
||||||
|
/// states.
|
||||||
///
|
///
|
||||||
/// By convention, a Decision emitted by a controller must embed a reference to the same
|
/// By convention, a Decision emitted by a controller must embed a reference to
|
||||||
/// type of controller.
|
/// the same type of controller.
|
||||||
pub type FlowState = &'static dyn FlowController;
|
pub type FlowState = &'static dyn FlowController;
|
||||||
|
|
||||||
/// Encodes the flow logic as a set of states, and transitions between them
|
/// Encodes the flow logic as a set of states, and transitions between them
|
||||||
@ -50,7 +54,7 @@ pub trait FlowController {
|
|||||||
/// By convention, the type of the new state inside the state change must be
|
/// By convention, the type of the new state inside the state change must be
|
||||||
/// Self. This can't be enforced by the type system unfortunately, because
|
/// Self. This can't be enforced by the type system unfortunately, because
|
||||||
/// this trait must remain object-safe and so can't refer to Self.
|
/// this trait must remain object-safe and so can't refer to Self.
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision;
|
fn handle_swipe(&'static self, direction: Direction) -> Decision;
|
||||||
|
|
||||||
/// What to do when the current component emits a message in response to an
|
/// What to do when the current component emits a message in response to an
|
||||||
/// event.
|
/// event.
|
||||||
@ -67,28 +71,28 @@ pub trait FlowController {
|
|||||||
/// Helper trait for writing nicer flow logic.
|
/// Helper trait for writing nicer flow logic.
|
||||||
pub trait DecisionBuilder: FlowController + Sized {
|
pub trait DecisionBuilder: FlowController + Sized {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn swipe(&'static self, direction: Direction) -> Decision {
|
||||||
Decision::Transition(self, AttachType::Swipe(direction))
|
Decision::Transition(self, AttachType::Swipe(direction))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn swipe_left(&'static self) -> Decision {
|
fn swipe_left(&'static self) -> Decision {
|
||||||
self.swipe(SwipeDirection::Left)
|
self.swipe(Direction::Left)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn swipe_right(&'static self) -> Decision {
|
fn swipe_right(&'static self) -> Decision {
|
||||||
self.swipe(SwipeDirection::Right)
|
self.swipe(Direction::Right)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn swipe_up(&'static self) -> Decision {
|
fn swipe_up(&'static self) -> Decision {
|
||||||
self.swipe(SwipeDirection::Up)
|
self.swipe(Direction::Up)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn swipe_down(&'static self) -> Decision {
|
fn swipe_down(&'static self) -> Decision {
|
||||||
self.swipe(SwipeDirection::Down)
|
self.swipe(Direction::Down)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::ui::{
|
use crate::ui::{
|
||||||
component::{Component, Event, EventCtx, Paginate, SwipeDirection},
|
component::{Component, Event, EventCtx, Paginate},
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Axis, Rect},
|
geometry::{Axis, Direction, Rect},
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -55,22 +55,22 @@ impl<T: Component + Paginate> Component for SwipePage<T> {
|
|||||||
|
|
||||||
if let Event::Swipe(SwipeEvent::End(direction)) = event {
|
if let Event::Swipe(SwipeEvent::End(direction)) = event {
|
||||||
match (self.axis, direction) {
|
match (self.axis, direction) {
|
||||||
(Axis::Vertical, SwipeDirection::Up) => {
|
(Axis::Vertical, Direction::Up) => {
|
||||||
self.current = (self.current + 1).min(self.pages - 1);
|
self.current = (self.current + 1).min(self.pages - 1);
|
||||||
self.inner.change_page(self.current);
|
self.inner.change_page(self.current);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
(Axis::Vertical, SwipeDirection::Down) => {
|
(Axis::Vertical, Direction::Down) => {
|
||||||
self.current = self.current.saturating_sub(1);
|
self.current = self.current.saturating_sub(1);
|
||||||
self.inner.change_page(self.current);
|
self.inner.change_page(self.current);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
(Axis::Horizontal, SwipeDirection::Left) => {
|
(Axis::Horizontal, Direction::Left) => {
|
||||||
self.current = (self.current + 1).min(self.pages - 1);
|
self.current = (self.current + 1).min(self.pages - 1);
|
||||||
self.inner.change_page(self.current);
|
self.inner.change_page(self.current);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
(Axis::Horizontal, SwipeDirection::Right) => {
|
(Axis::Horizontal, Direction::Right) => {
|
||||||
self.current = self.current.saturating_sub(1);
|
self.current = self.current.saturating_sub(1);
|
||||||
self.inner.change_page(self.current);
|
self.inner.change_page(self.current);
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
|
@ -8,12 +8,12 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
base::AttachType::{self, Swipe},
|
base::AttachType::{self, Swipe},
|
||||||
Component, Event, EventCtx, FlowMsg, SwipeDetect, SwipeDetectMsg, SwipeDirection,
|
Component, Event, EventCtx, FlowMsg, SwipeDetect, SwipeDetectMsg,
|
||||||
},
|
},
|
||||||
display::Color,
|
display::Color,
|
||||||
event::{SwipeEvent, TouchEvent},
|
event::{SwipeEvent, TouchEvent},
|
||||||
flow::{base::Decision, FlowController},
|
flow::{base::Decision, FlowController},
|
||||||
geometry::Rect,
|
geometry::{Direction, Rect},
|
||||||
layout::obj::ObjComponent,
|
layout::obj::ObjComponent,
|
||||||
shape::{render_on_display, ConcreteRenderer, Renderer, ScopedRenderer},
|
shape::{render_on_display, ConcreteRenderer, Renderer, ScopedRenderer},
|
||||||
util::animation_disabled,
|
util::animation_disabled,
|
||||||
@ -157,10 +157,10 @@ impl SwipeFlow {
|
|||||||
self.internal_pages = self.current_page_mut().get_internal_page_count() as u16;
|
self.internal_pages = self.current_page_mut().get_internal_page_count() as u16;
|
||||||
|
|
||||||
match attach_type {
|
match attach_type {
|
||||||
Swipe(SwipeDirection::Up) => {
|
Swipe(Direction::Up) => {
|
||||||
self.internal_state = 0;
|
self.internal_state = 0;
|
||||||
}
|
}
|
||||||
Swipe(SwipeDirection::Down) => {
|
Swipe(Direction::Down) => {
|
||||||
self.internal_state = self.internal_pages.saturating_sub(1);
|
self.internal_state = self.internal_pages.saturating_sub(1);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@ -173,7 +173,7 @@ impl SwipeFlow {
|
|||||||
self.store[state].render(target);
|
self.store[state].render(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe_child(&mut self, _ctx: &mut EventCtx, direction: SwipeDirection) -> Decision {
|
fn handle_swipe_child(&mut self, _ctx: &mut EventCtx, direction: Direction) -> Decision {
|
||||||
self.state.handle_swipe(direction)
|
self.state.handle_swipe(direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -804,3 +804,55 @@ pub trait Dimensions {
|
|||||||
fn fit(&mut self, bounds: Rect);
|
fn fit(&mut self, bounds: Rect);
|
||||||
fn area(&self) -> Rect;
|
fn area(&self) -> Rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, Eq, PartialEq, ToPrimitive, FromPrimitive)]
|
||||||
|
#[cfg_attr(feature = "debug", derive(ufmt::derive::uDebug))]
|
||||||
|
pub enum Direction {
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Direction {
|
||||||
|
pub fn as_offset(self, size: Offset) -> Offset {
|
||||||
|
match self {
|
||||||
|
Direction::Up => Offset::y(-size.y),
|
||||||
|
Direction::Down => Offset::y(size.y),
|
||||||
|
Direction::Left => Offset::x(-size.x),
|
||||||
|
Direction::Right => Offset::x(size.x),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn iter() -> DirectionIterator {
|
||||||
|
DirectionIterator::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DirectionIterator {
|
||||||
|
current: Option<Direction>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl DirectionIterator {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
DirectionIterator {
|
||||||
|
current: Some(Direction::Up),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Iterator for DirectionIterator {
|
||||||
|
type Item = Direction;
|
||||||
|
|
||||||
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
|
let next_state = match self.current {
|
||||||
|
Some(Direction::Up) => Some(Direction::Down),
|
||||||
|
Some(Direction::Down) => Some(Direction::Left),
|
||||||
|
Some(Direction::Left) => Some(Direction::Right),
|
||||||
|
Some(Direction::Right) => None,
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
|
core::mem::replace(&mut self.current, next_state)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,10 +7,10 @@ use num_traits::{FromPrimitive, ToPrimitive};
|
|||||||
|
|
||||||
#[cfg(feature = "button")]
|
#[cfg(feature = "button")]
|
||||||
use crate::ui::event::ButtonEvent;
|
use crate::ui::event::ButtonEvent;
|
||||||
#[cfg(feature = "touch")]
|
|
||||||
use crate::ui::{component::SwipeDirection, event::TouchEvent};
|
|
||||||
#[cfg(feature = "new_rendering")]
|
#[cfg(feature = "new_rendering")]
|
||||||
use crate::ui::{display::Color, shape::render_on_display};
|
use crate::ui::{display::Color, shape::render_on_display};
|
||||||
|
#[cfg(feature = "touch")]
|
||||||
|
use crate::ui::{event::TouchEvent, geometry::Direction};
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Error,
|
error::Error,
|
||||||
maybe_trace::MaybeTrace,
|
maybe_trace::MaybeTrace,
|
||||||
@ -55,7 +55,7 @@ impl AttachType {
|
|||||||
1 => Ok(Self::Resume),
|
1 => Ok(Self::Resume),
|
||||||
#[cfg(feature = "touch")]
|
#[cfg(feature = "touch")]
|
||||||
2..=5 => Ok(Self::Swipe(
|
2..=5 => Ok(Self::Swipe(
|
||||||
SwipeDirection::from_u8(val - 2).ok_or(Error::TypeError)?,
|
Direction::from_u8(val - 2).ok_or(Error::TypeError)?,
|
||||||
)),
|
)),
|
||||||
_ => Err(Error::TypeError),
|
_ => Err(Error::TypeError),
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::{SwipeConfig, SwipeSettings},
|
swipe_detect::{SwipeConfig, SwipeSettings},
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
|
||||||
Component, Event, EventCtx, Paginate, SwipeDirection,
|
Component, Event, EventCtx, Paginate,
|
||||||
},
|
},
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
flow::Swipable,
|
flow::Swipable,
|
||||||
geometry::Rect,
|
geometry::{Direction, Rect},
|
||||||
shape::Renderer,
|
shape::Renderer,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ impl AddressDetails {
|
|||||||
let result = Self {
|
let result = Self {
|
||||||
details: Frame::left_aligned(details_title, para.into_paragraphs())
|
details: Frame::left_aligned(details_title, para.into_paragraphs())
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.with_horizontal_pages(),
|
.with_horizontal_pages(),
|
||||||
xpub_view: Frame::left_aligned(
|
xpub_view: Frame::left_aligned(
|
||||||
" \n ".into(),
|
" \n ".into(),
|
||||||
@ -151,11 +151,11 @@ impl Component for AddressDetails {
|
|||||||
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
|
||||||
ctx.set_page_count(self.page_count());
|
ctx.set_page_count(self.page_count());
|
||||||
match event {
|
match event {
|
||||||
Event::Swipe(SwipeEvent::End(SwipeDirection::Right)) => {
|
Event::Swipe(SwipeEvent::End(Direction::Right)) => {
|
||||||
let to_page = self.current_page.saturating_sub(1);
|
let to_page = self.current_page.saturating_sub(1);
|
||||||
self.change_page(to_page);
|
self.change_page(to_page);
|
||||||
}
|
}
|
||||||
Event::Swipe(SwipeEvent::End(SwipeDirection::Left)) => {
|
Event::Swipe(SwipeEvent::End(Direction::Left)) => {
|
||||||
let to_page = self
|
let to_page = self
|
||||||
.current_page
|
.current_page
|
||||||
.saturating_add(1)
|
.saturating_add(1)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
ui::{
|
ui::{
|
||||||
component::{text::TextStyle, Component, Event, EventCtx, Never, SwipeDirection},
|
component::{text::TextStyle, Component, Event, EventCtx, Never},
|
||||||
display::{Color, Font},
|
display::{Color, Font},
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Alignment, Alignment2D, Offset, Point, Rect},
|
geometry::{Alignment, Alignment2D, Direction, Offset, Point, Rect},
|
||||||
lerp::Lerp,
|
lerp::Lerp,
|
||||||
model_mercury::theme,
|
model_mercury::theme,
|
||||||
shape,
|
shape,
|
||||||
@ -26,7 +26,7 @@ pub struct Footer<'a> {
|
|||||||
swipe_allow_up: bool,
|
swipe_allow_up: bool,
|
||||||
swipe_allow_down: bool,
|
swipe_allow_down: bool,
|
||||||
progress: i16,
|
progress: i16,
|
||||||
dir: SwipeDirection,
|
dir: Direction,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -53,7 +53,7 @@ impl<'a> Footer<'a> {
|
|||||||
swipe_allow_down: false,
|
swipe_allow_down: false,
|
||||||
swipe_allow_up: false,
|
swipe_allow_up: false,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
dir: SwipeDirection::Up,
|
dir: Direction::Up,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,13 +140,13 @@ impl<'a> Footer<'a> {
|
|||||||
self.content.height()
|
self.content.height()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_swipe(self, swipe_direction: SwipeDirection) -> Self {
|
pub fn with_swipe(self, swipe_direction: Direction) -> Self {
|
||||||
match swipe_direction {
|
match swipe_direction {
|
||||||
SwipeDirection::Up => Self {
|
Direction::Up => Self {
|
||||||
swipe_allow_up: true,
|
swipe_allow_up: true,
|
||||||
..self
|
..self
|
||||||
},
|
},
|
||||||
SwipeDirection::Down => Self {
|
Direction::Down => Self {
|
||||||
swipe_allow_down: true,
|
swipe_allow_down: true,
|
||||||
..self
|
..self
|
||||||
},
|
},
|
||||||
@ -170,13 +170,13 @@ impl<'a> Component for Footer<'a> {
|
|||||||
self.progress = 0;
|
self.progress = 0;
|
||||||
}
|
}
|
||||||
Event::Swipe(SwipeEvent::Move(dir, progress)) => match dir {
|
Event::Swipe(SwipeEvent::Move(dir, progress)) => match dir {
|
||||||
SwipeDirection::Up => {
|
Direction::Up => {
|
||||||
if self.swipe_allow_up {
|
if self.swipe_allow_up {
|
||||||
self.progress = progress;
|
self.progress = progress;
|
||||||
self.dir = dir;
|
self.dir = dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SwipeDirection::Down => {
|
Direction::Down => {
|
||||||
if self.swipe_allow_down {
|
if self.swipe_allow_down {
|
||||||
self.progress = progress;
|
self.progress = progress;
|
||||||
self.dir = dir;
|
self.dir = dir;
|
||||||
@ -209,8 +209,8 @@ impl<'a> Component for Footer<'a> {
|
|||||||
let mask = u8::lerp(0, 255, shift.eval(progress));
|
let mask = u8::lerp(0, 255, shift.eval(progress));
|
||||||
|
|
||||||
let offset = match self.dir {
|
let offset = match self.dir {
|
||||||
SwipeDirection::Up => Offset::y(-offset),
|
Direction::Up => Offset::y(-offset),
|
||||||
SwipeDirection::Down => Offset::y(3 * offset),
|
Direction::Down => Offset::y(3 * offset),
|
||||||
_ => Offset::zero(),
|
_ => Offset::zero(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@ use crate::{
|
|||||||
text::TextStyle,
|
text::TextStyle,
|
||||||
Component,
|
Component,
|
||||||
Event::{self, Swipe},
|
Event::{self, Swipe},
|
||||||
EventCtx, FlowMsg, SwipeDetect, SwipeDirection,
|
EventCtx, FlowMsg, SwipeDetect,
|
||||||
},
|
},
|
||||||
display::{Color, Icon},
|
display::{Color, Icon},
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Alignment, Insets, Point, Rect},
|
geometry::{Alignment, Direction, Insets, Point, Rect},
|
||||||
lerp::Lerp,
|
lerp::Lerp,
|
||||||
model_mercury::theme::TITLE_HEIGHT,
|
model_mercury::theme::TITLE_HEIGHT,
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
@ -21,14 +21,14 @@ use crate::{
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct HorizontalSwipe {
|
pub struct HorizontalSwipe {
|
||||||
progress: i16,
|
progress: i16,
|
||||||
dir: SwipeDirection,
|
dir: Direction,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HorizontalSwipe {
|
impl HorizontalSwipe {
|
||||||
const fn new() -> Self {
|
const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
progress: 0,
|
progress: 0,
|
||||||
dir: SwipeDirection::Up,
|
dir: Direction::Up,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ impl HorizontalSwipe {
|
|||||||
if let Swipe(SwipeEvent::Move(dir, progress)) = event {
|
if let Swipe(SwipeEvent::Move(dir, progress)) = event {
|
||||||
if swipe.is_allowed(dir) {
|
if swipe.is_allowed(dir) {
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Left | SwipeDirection::Right => {
|
Direction::Left | Direction::Right => {
|
||||||
self.progress = progress;
|
self.progress = progress;
|
||||||
self.dir = dir;
|
self.dir = dir;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ impl HorizontalSwipe {
|
|||||||
fn render_swipe_cover<'s>(&self, target: &mut impl Renderer<'s>, bounds: Rect) {
|
fn render_swipe_cover<'s>(&self, target: &mut impl Renderer<'s>, bounds: Rect) {
|
||||||
if self.progress > 0 {
|
if self.progress > 0 {
|
||||||
match self.dir {
|
match self.dir {
|
||||||
SwipeDirection::Left => {
|
Direction::Left => {
|
||||||
let shift = pareen::constant(0.0).seq_ease_out(
|
let shift = pareen::constant(0.0).seq_ease_out(
|
||||||
0.0,
|
0.0,
|
||||||
easer::functions::Circ,
|
easer::functions::Circ,
|
||||||
@ -72,7 +72,7 @@ impl HorizontalSwipe {
|
|||||||
.with_bg(theme::BLACK)
|
.with_bg(theme::BLACK)
|
||||||
.render(target);
|
.render(target);
|
||||||
}
|
}
|
||||||
SwipeDirection::Right => {}
|
Direction::Right => {}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn with_swipe(mut self, dir: SwipeDirection, settings: SwipeSettings) -> Self {
|
pub fn with_swipe(mut self, dir: Direction, settings: SwipeSettings) -> Self {
|
||||||
self.footer = self.footer.map(|f| f.with_swipe(dir));
|
self.footer = self.footer.map(|f| f.with_swipe(dir));
|
||||||
self.swipe = self.swipe.with_swipe(dir, settings);
|
self.swipe = self.swipe.with_swipe(dir, settings);
|
||||||
self
|
self
|
||||||
|
@ -4,10 +4,10 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
base::ComponentExt, swipe_detect::SwipeConfig, text::common::TextBox, Component, Event,
|
base::ComponentExt, swipe_detect::SwipeConfig, text::common::TextBox, Component, Event,
|
||||||
EventCtx, Label, Maybe, Never, Swipe, SwipeDirection,
|
EventCtx, Label, Maybe, Never, Swipe,
|
||||||
},
|
},
|
||||||
display,
|
display,
|
||||||
geometry::{Alignment, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Direction, Grid, Insets, Offset, Rect},
|
||||||
model_mercury::{
|
model_mercury::{
|
||||||
component::{
|
component::{
|
||||||
button::{Button, ButtonContent, ButtonMsg},
|
button::{Button, ButtonContent, ButtonMsg},
|
||||||
@ -179,11 +179,11 @@ impl PassphraseKeyboard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_page_change(&mut self, ctx: &mut EventCtx, swipe: SwipeDirection) {
|
fn on_page_change(&mut self, ctx: &mut EventCtx, swipe: Direction) {
|
||||||
// Change the keyboard layout.
|
// Change the keyboard layout.
|
||||||
self.active_layout = match swipe {
|
self.active_layout = match swipe {
|
||||||
SwipeDirection::Left => self.active_layout.next(),
|
Direction::Left => self.active_layout.next(),
|
||||||
SwipeDirection::Right => self.active_layout.prev(),
|
Direction::Right => self.active_layout.prev(),
|
||||||
_ => self.active_layout,
|
_ => self.active_layout,
|
||||||
};
|
};
|
||||||
// Clear the pending state.
|
// Clear the pending state.
|
||||||
@ -331,7 +331,7 @@ impl Component for PassphraseKeyboard {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if let Some(ButtonMsg::Clicked) = self.next_btn.event(ctx, event) {
|
if let Some(ButtonMsg::Clicked) = self.next_btn.event(ctx, event) {
|
||||||
self.on_page_change(ctx, SwipeDirection::Left);
|
self.on_page_change(ctx, Direction::Left);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm button was clicked, we're done.
|
// Confirm button was clicked, we're done.
|
||||||
|
@ -8,11 +8,11 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
base::{AttachType, ComponentExt},
|
base::{AttachType, ComponentExt},
|
||||||
text::TextStyle,
|
text::TextStyle,
|
||||||
Component, Event, EventCtx, Label, Never, Pad, SwipeDirection, TimerToken,
|
Component, Event, EventCtx, Label, Never, Pad, TimerToken,
|
||||||
},
|
},
|
||||||
display::Font,
|
display::Font,
|
||||||
event::TouchEvent,
|
event::TouchEvent,
|
||||||
geometry::{Alignment, Alignment2D, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Direction, Grid, Insets, Offset, Rect},
|
||||||
model_mercury::{
|
model_mercury::{
|
||||||
component::{
|
component::{
|
||||||
button::{
|
button::{
|
||||||
@ -124,8 +124,8 @@ impl AttachAnimation {
|
|||||||
|
|
||||||
fn lazy_start(&mut self, ctx: &mut EventCtx, event: Event) {
|
fn lazy_start(&mut self, ctx: &mut EventCtx, event: Event) {
|
||||||
if let Event::Attach(_) = event {
|
if let Event::Attach(_) = event {
|
||||||
if let Event::Attach(AttachType::Swipe(SwipeDirection::Up))
|
if let Event::Attach(AttachType::Swipe(Direction::Up))
|
||||||
| Event::Attach(AttachType::Swipe(SwipeDirection::Down))
|
| Event::Attach(AttachType::Swipe(Direction::Down))
|
||||||
| Event::Attach(AttachType::Initial) = event
|
| Event::Attach(AttachType::Initial) = event
|
||||||
{
|
{
|
||||||
self.attach_top = true;
|
self.attach_top = true;
|
||||||
|
@ -4,11 +4,11 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
Component, Event, EventCtx, Pad, SwipeDirection,
|
Component, Event, EventCtx, Pad,
|
||||||
},
|
},
|
||||||
display::Font,
|
display::Font,
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Alignment, Grid, Insets, Offset, Rect},
|
geometry::{Alignment, Direction, Grid, Insets, Offset, Rect},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -66,7 +66,7 @@ impl Component for NumberInputDialog {
|
|||||||
return Some(NumberInputDialogMsg::Changed(i));
|
return Some(NumberInputDialogMsg::Changed(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Event::Swipe(SwipeEvent::End(SwipeDirection::Up)) = event {
|
if let Event::Swipe(SwipeEvent::End(Direction::Up)) = event {
|
||||||
return Some(NumberInputDialogMsg::Confirmed(self.input.value));
|
return Some(NumberInputDialogMsg::Confirmed(self.input.value));
|
||||||
}
|
}
|
||||||
self.paragraphs.event(ctx, event);
|
self.paragraphs.event(ctx, event);
|
||||||
|
@ -3,11 +3,9 @@ use crate::{
|
|||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{base::AttachType, text::TextStyle, Component, Event, EventCtx, Never},
|
||||||
base::AttachType, text::TextStyle, Component, Event, EventCtx, Never, SwipeDirection,
|
|
||||||
},
|
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Alignment, Alignment2D, Insets, Offset, Rect},
|
geometry::{Alignment, Alignment2D, Direction, Insets, Offset, Rect},
|
||||||
model_mercury::component::{swipe_content::SwipeAttachAnimation, InternallySwipable},
|
model_mercury::component::{swipe_content::SwipeAttachAnimation, InternallySwipable},
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
},
|
},
|
||||||
@ -99,24 +97,24 @@ impl<'a> ShareWords<'a> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_animate_progress(&self) -> (SwipeDirection, bool) {
|
fn should_animate_progress(&self) -> (Direction, bool) {
|
||||||
let (dir, should_animate) = if self.page_index < self.next_index {
|
let (dir, should_animate) = if self.page_index < self.next_index {
|
||||||
(SwipeDirection::Up, !self.is_final_page())
|
(Direction::Up, !self.is_final_page())
|
||||||
} else {
|
} else {
|
||||||
(SwipeDirection::Down, !self.is_first_page())
|
(Direction::Down, !self.is_first_page())
|
||||||
};
|
};
|
||||||
(dir, should_animate)
|
(dir, should_animate)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_animate_attach(&self, event: Event) -> (SwipeDirection, bool) {
|
fn should_animate_attach(&self, event: Event) -> (Direction, bool) {
|
||||||
match event {
|
match event {
|
||||||
Event::Attach(AttachType::Swipe(SwipeDirection::Up)) => {
|
Event::Attach(AttachType::Swipe(Direction::Up)) => {
|
||||||
(SwipeDirection::Up, !self.is_first_page())
|
(Direction::Up, !self.is_first_page())
|
||||||
}
|
}
|
||||||
Event::Attach(AttachType::Swipe(SwipeDirection::Down)) => {
|
Event::Attach(AttachType::Swipe(Direction::Down)) => {
|
||||||
(SwipeDirection::Down, !self.is_final_page())
|
(Direction::Down, !self.is_final_page())
|
||||||
}
|
}
|
||||||
_ => (SwipeDirection::Up, false),
|
_ => (Direction::Up, false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,13 +152,13 @@ impl<'a> Component for ShareWords<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Swipe(SwipeEvent::End(dir)) => match dir {
|
Event::Swipe(SwipeEvent::End(dir)) => match dir {
|
||||||
SwipeDirection::Up if !self.is_final_page() => {
|
Direction::Up if !self.is_final_page() => {
|
||||||
self.progress = 0;
|
self.progress = 0;
|
||||||
self.page_index = (self.page_index + 1).min(self.share_words.len() as i16 - 1);
|
self.page_index = (self.page_index + 1).min(self.share_words.len() as i16 - 1);
|
||||||
self.wait_for_attach = true;
|
self.wait_for_attach = true;
|
||||||
ctx.request_paint();
|
ctx.request_paint();
|
||||||
}
|
}
|
||||||
SwipeDirection::Down if !self.is_first_page() => {
|
Direction::Down if !self.is_first_page() => {
|
||||||
self.progress = 0;
|
self.progress = 0;
|
||||||
self.page_index = self.page_index.saturating_sub(1);
|
self.page_index = self.page_index.saturating_sub(1);
|
||||||
self.wait_for_attach = true;
|
self.wait_for_attach = true;
|
||||||
@ -170,11 +168,11 @@ impl<'a> Component for ShareWords<'a> {
|
|||||||
},
|
},
|
||||||
Event::Swipe(SwipeEvent::Move(dir, progress)) => {
|
Event::Swipe(SwipeEvent::Move(dir, progress)) => {
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Up => {
|
Direction::Up => {
|
||||||
self.next_index = self.page_index + 1;
|
self.next_index = self.page_index + 1;
|
||||||
self.progress = progress;
|
self.progress = progress;
|
||||||
}
|
}
|
||||||
SwipeDirection::Down => {
|
Direction::Down => {
|
||||||
self.next_index = self.page_index - 1;
|
self.next_index = self.page_index - 1;
|
||||||
self.progress = progress;
|
self.progress = progress;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
time::{Duration, Stopwatch},
|
time::{Duration, Stopwatch},
|
||||||
ui::{
|
ui::{
|
||||||
component::{base::AttachType, Component, Event, EventCtx, SwipeDirection},
|
component::{base::AttachType, Component, Event, EventCtx},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::Color,
|
display::Color,
|
||||||
event::SwipeEvent,
|
event::SwipeEvent,
|
||||||
geometry::{Offset, Rect},
|
geometry::{Direction, Offset, Rect},
|
||||||
lerp::Lerp,
|
lerp::Lerp,
|
||||||
shape::{self, Renderer},
|
shape::{self, Renderer},
|
||||||
util::animation_disabled,
|
util::animation_disabled,
|
||||||
@ -60,10 +60,10 @@ impl SwipeAttachAnimation {
|
|||||||
Offset::lerp(Offset::new(0, -max_offset), Offset::zero(), value.eval(t))
|
Offset::lerp(Offset::new(0, -max_offset), Offset::zero(), value.eval(t))
|
||||||
}
|
}
|
||||||
Some(AttachType::Swipe(dir)) => match dir {
|
Some(AttachType::Swipe(dir)) => match dir {
|
||||||
SwipeDirection::Up => {
|
Direction::Up => {
|
||||||
Offset::lerp(Offset::new(0, max_offset), Offset::zero(), value.eval(t))
|
Offset::lerp(Offset::new(0, max_offset), Offset::zero(), value.eval(t))
|
||||||
}
|
}
|
||||||
SwipeDirection::Down => {
|
Direction::Down => {
|
||||||
Offset::lerp(Offset::new(0, -max_offset), Offset::zero(), value.eval(t))
|
Offset::lerp(Offset::new(0, -max_offset), Offset::zero(), value.eval(t))
|
||||||
}
|
}
|
||||||
_ => Offset::zero(),
|
_ => Offset::zero(),
|
||||||
@ -81,8 +81,8 @@ impl SwipeAttachAnimation {
|
|||||||
);
|
);
|
||||||
match self.attach_type {
|
match self.attach_type {
|
||||||
Some(AttachType::Initial)
|
Some(AttachType::Initial)
|
||||||
| Some(AttachType::Swipe(SwipeDirection::Up))
|
| Some(AttachType::Swipe(Direction::Up))
|
||||||
| Some(AttachType::Swipe(SwipeDirection::Down)) => {}
|
| Some(AttachType::Swipe(Direction::Down)) => {}
|
||||||
_ => {
|
_ => {
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ impl SwipeAttachAnimation {
|
|||||||
|
|
||||||
struct SwipeContext {
|
struct SwipeContext {
|
||||||
progress: i16,
|
progress: i16,
|
||||||
dir: SwipeDirection,
|
dir: Direction,
|
||||||
attach_animation: SwipeAttachAnimation,
|
attach_animation: SwipeAttachAnimation,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ impl SwipeContext {
|
|||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
progress: 0,
|
progress: 0,
|
||||||
dir: SwipeDirection::Up,
|
dir: Direction::Up,
|
||||||
attach_animation: SwipeAttachAnimation::new(),
|
attach_animation: SwipeAttachAnimation::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,11 +159,11 @@ impl SwipeContext {
|
|||||||
|
|
||||||
if self.progress > 0 {
|
if self.progress > 0 {
|
||||||
match self.dir {
|
match self.dir {
|
||||||
SwipeDirection::Up => {
|
Direction::Up => {
|
||||||
offset = Offset::y(-y_offset);
|
offset = Offset::y(-y_offset);
|
||||||
mask = u8::lerp(0, 255, shift.eval(progress));
|
mask = u8::lerp(0, 255, shift.eval(progress));
|
||||||
}
|
}
|
||||||
SwipeDirection::Down => {
|
Direction::Down => {
|
||||||
offset = Offset::y(y_offset);
|
offset = Offset::y(y_offset);
|
||||||
clip = screen();
|
clip = screen();
|
||||||
mask = u8::lerp(0, 255, shift.eval(progress));
|
mask = u8::lerp(0, 255, shift.eval(progress));
|
||||||
@ -193,7 +193,7 @@ impl SwipeContext {
|
|||||||
|
|
||||||
if let Event::Swipe(SwipeEvent::Move(dir, progress)) = event {
|
if let Event::Swipe(SwipeEvent::Move(dir, progress)) = event {
|
||||||
match dir {
|
match dir {
|
||||||
SwipeDirection::Up | SwipeDirection::Down => {
|
Direction::Up | Direction::Down => {
|
||||||
if animate {
|
if animate {
|
||||||
self.dir = dir;
|
self.dir = dir;
|
||||||
self.progress = progress;
|
self.progress = progress;
|
||||||
@ -320,8 +320,8 @@ where
|
|||||||
let is_last_page =
|
let is_last_page =
|
||||||
self.content.inner.current_page() == (self.content.inner.num_pages() - 1);
|
self.content.inner.current_page() == (self.content.inner.num_pages() - 1);
|
||||||
|
|
||||||
let is_swipe_up = matches!(attach_type, AttachType::Swipe(SwipeDirection::Up));
|
let is_swipe_up = matches!(attach_type, AttachType::Swipe(Direction::Up));
|
||||||
let is_swipe_down = matches!(attach_type, AttachType::Swipe(SwipeDirection::Down));
|
let is_swipe_down = matches!(attach_type, AttachType::Swipe(Direction::Down));
|
||||||
|
|
||||||
if !self.content.swipe_context.attach_animation.show_attach_anim {
|
if !self.content.swipe_context.attach_animation.show_attach_anim {
|
||||||
return false;
|
return false;
|
||||||
@ -338,13 +338,13 @@ where
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn should_animate_swipe(&self, swipe_direction: SwipeDirection) -> bool {
|
fn should_animate_swipe(&self, swipe_direction: Direction) -> bool {
|
||||||
let is_first_page = self.content.inner.current_page() == 0;
|
let is_first_page = self.content.inner.current_page() == 0;
|
||||||
let is_last_page =
|
let is_last_page =
|
||||||
self.content.inner.current_page() == (self.content.inner.num_pages() - 1);
|
self.content.inner.current_page() == (self.content.inner.num_pages() - 1);
|
||||||
|
|
||||||
let is_swipe_up = matches!(swipe_direction, SwipeDirection::Up);
|
let is_swipe_up = matches!(swipe_direction, Direction::Up);
|
||||||
let is_swipe_down = matches!(swipe_direction, SwipeDirection::Down);
|
let is_swipe_down = matches!(swipe_direction, Direction::Down);
|
||||||
|
|
||||||
if is_last_page && is_swipe_up {
|
if is_last_page && is_swipe_up {
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,11 +7,11 @@ use crate::{
|
|||||||
ui::{
|
ui::{
|
||||||
component::{
|
component::{
|
||||||
base::{AttachType, Component},
|
base::{AttachType, Component},
|
||||||
Event, EventCtx, Paginate, SwipeDirection,
|
Event, EventCtx, Paginate,
|
||||||
},
|
},
|
||||||
constant::screen,
|
constant::screen,
|
||||||
display::{Color, Icon},
|
display::{Color, Icon},
|
||||||
geometry::{Offset, Rect},
|
geometry::{Direction, Offset, Rect},
|
||||||
lerp::Lerp,
|
lerp::Lerp,
|
||||||
model_mercury::component::button::{Button, ButtonContent, ButtonMsg, IconText},
|
model_mercury::component::button::{Button, ButtonContent, ButtonMsg, IconText},
|
||||||
shape::{Bar, Renderer},
|
shape::{Bar, Renderer},
|
||||||
@ -138,8 +138,8 @@ impl AttachAnimation {
|
|||||||
|
|
||||||
fn lazy_start(&mut self, ctx: &mut EventCtx, event: Event) {
|
fn lazy_start(&mut self, ctx: &mut EventCtx, event: Event) {
|
||||||
if let Event::Attach(_) = event {
|
if let Event::Attach(_) = event {
|
||||||
if let Event::Attach(AttachType::Swipe(SwipeDirection::Up))
|
if let Event::Attach(AttachType::Swipe(Direction::Up))
|
||||||
| Event::Attach(AttachType::Swipe(SwipeDirection::Down))
|
| Event::Attach(AttachType::Swipe(Direction::Down))
|
||||||
| Event::Attach(AttachType::Initial) = event
|
| Event::Attach(AttachType::Initial) = event
|
||||||
{
|
{
|
||||||
self.attach_top = true;
|
self.attach_top = true;
|
||||||
|
@ -8,12 +8,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
|
||||||
Component, ComponentExt, Paginate, SwipeDirection,
|
Component, ComponentExt, Paginate,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -37,13 +38,13 @@ impl FlowController for ConfirmAction {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => Self::Confirm.swipe(direction),
|
(Self::Intro, Direction::Up) => Self::Confirm.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Down) => Self::Intro.swipe(direction),
|
(Self::Confirm, Direction::Down) => Self::Intro.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Confirm, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,11 +76,11 @@ impl FlowController for ConfirmActionSimple {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Intro, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,8 +165,8 @@ pub fn new_confirm_action_uni<T: Component + MaybeTrace + 'static>(
|
|||||||
let mut content_intro = Frame::left_aligned(title, content)
|
let mut content_intro = Frame::left_aligned(title, content)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.with_vertical_pages();
|
.with_vertical_pages();
|
||||||
|
|
||||||
if let Some(subtitle) = subtitle {
|
if let Some(subtitle) = subtitle {
|
||||||
@ -245,7 +246,7 @@ fn create_menu(
|
|||||||
}
|
}
|
||||||
let content_menu = Frame::left_aligned("".into(), menu_choices)
|
let content_menu = Frame::left_aligned("".into(), menu_choices)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate());
|
.with_swipe(Direction::Right, SwipeSettings::immediate());
|
||||||
|
|
||||||
let content_menu = content_menu.map(move |msg| match msg {
|
let content_menu = content_menu.map(move |msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
@ -281,8 +282,8 @@ fn create_confirm(
|
|||||||
let mut content_confirm = Frame::left_aligned(prompt_title, SwipeContent::new(prompt))
|
let mut content_confirm = Frame::left_aligned(prompt_title, SwipeContent::new(prompt))
|
||||||
.with_footer(prompt_action, None)
|
.with_footer(prompt_action, None)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default());
|
.with_swipe(Direction::Left, SwipeSettings::default());
|
||||||
|
|
||||||
if let Some(subtitle) = subtitle {
|
if let Some(subtitle) = subtitle {
|
||||||
content_confirm = content_confirm.with_subtitle(subtitle);
|
content_confirm = content_confirm.with_subtitle(subtitle);
|
||||||
|
@ -7,12 +7,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
ComponentExt, EventCtx, SwipeDirection,
|
ComponentExt, EventCtx,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -45,13 +46,13 @@ impl FlowController for ConfirmFido {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => Self::ChooseCredential.swipe(direction),
|
(Self::Intro, Direction::Up) => Self::ChooseCredential.swipe(direction),
|
||||||
(Self::ChooseCredential, SwipeDirection::Down) => Self::Intro.swipe(direction),
|
(Self::ChooseCredential, Direction::Down) => Self::Intro.swipe(direction),
|
||||||
(Self::Details, SwipeDirection::Up) => Self::Tap.swipe(direction),
|
(Self::Details, Direction::Up) => Self::Tap.swipe(direction),
|
||||||
(Self::Tap, SwipeDirection::Down) => Self::Details.swipe(direction),
|
(Self::Tap, Direction::Down) => Self::Details.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,8 +121,8 @@ impl ConfirmFido {
|
|||||||
)
|
)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info));
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info));
|
||||||
|
|
||||||
// Closure to lazy-load the information on given page index.
|
// Closure to lazy-load the information on given page index.
|
||||||
@ -150,8 +151,8 @@ impl ConfirmFido {
|
|||||||
TR::instructions__swipe_down.into(),
|
TR::instructions__swipe_down.into(),
|
||||||
)
|
)
|
||||||
.register_footer_update_fn(footer_update_fn)
|
.register_footer_update_fn(footer_update_fn)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.with_vertical_pages()
|
.with_vertical_pages()
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
@ -168,8 +169,8 @@ impl ConfirmFido {
|
|||||||
SwipeContent::new(FidoCredential::new(icon_name, app_name, get_account)),
|
SwipeContent::new(FidoCredential::new(icon_name, app_name, get_account)),
|
||||||
)
|
)
|
||||||
.with_footer(TR::instructions__swipe_up.into(), Some(title))
|
.with_footer(TR::instructions__swipe_up.into(), Some(title))
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate());
|
.with_swipe(Direction::Right, SwipeSettings::immediate());
|
||||||
let content_details = if Self::single_cred() {
|
let content_details = if Self::single_cred() {
|
||||||
content_details.with_menu_button()
|
content_details.with_menu_button()
|
||||||
} else {
|
} else {
|
||||||
@ -183,8 +184,8 @@ impl ConfirmFido {
|
|||||||
let content_tap = Frame::left_aligned(title, PromptScreen::new_tap_to_confirm())
|
let content_tap = Frame::left_aligned(title, PromptScreen::new_tap_to_confirm())
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
@ -196,7 +197,7 @@ impl ConfirmFido {
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
|
@ -7,12 +7,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
ComponentExt, SwipeDirection,
|
ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -38,14 +39,14 @@ impl FlowController for ConfirmFirmwareUpdate {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => Self::Confirm.swipe(direction),
|
(Self::Intro, Direction::Up) => Self::Confirm.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::Fingerprint, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::Fingerprint, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Down) => Self::Intro.swipe(direction),
|
(Self::Confirm, Direction::Down) => Self::Intro.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Confirm, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,8 +86,8 @@ impl ConfirmFirmwareUpdate {
|
|||||||
)
|
)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(FlowMsg::Info)).then_some(FlowMsg::Info));
|
.map(|msg| matches!(msg, FrameMsg::Button(FlowMsg::Info)).then_some(FlowMsg::Info));
|
||||||
|
|
||||||
let content_menu = Frame::left_aligned(
|
let content_menu = Frame::left_aligned(
|
||||||
@ -99,7 +100,7 @@ impl ConfirmFirmwareUpdate {
|
|||||||
.danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
|
.danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -112,7 +113,7 @@ impl ConfirmFirmwareUpdate {
|
|||||||
SwipeContent::new(paragraphs_fingerprint),
|
SwipeContent::new(paragraphs_fingerprint),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::default())
|
.with_swipe(Direction::Right, SwipeSettings::default())
|
||||||
.map(|msg| {
|
.map(|msg| {
|
||||||
matches!(msg, FrameMsg::Button(FlowMsg::Cancelled)).then_some(FlowMsg::Cancelled)
|
matches!(msg, FrameMsg::Button(FlowMsg::Cancelled)).then_some(FlowMsg::Cancelled)
|
||||||
});
|
});
|
||||||
@ -123,8 +124,8 @@ impl ConfirmFirmwareUpdate {
|
|||||||
)
|
)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__hold_to_confirm.into(), None)
|
.with_footer(TR::instructions__hold_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
|
@ -7,13 +7,12 @@ use crate::{
|
|||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
button_request::ButtonRequest,
|
button_request::ButtonRequest,
|
||||||
component::{
|
component::{swipe_detect::SwipeSettings, ButtonRequestExt, ComponentExt, MsgMap},
|
||||||
swipe_detect::SwipeSettings, ButtonRequestExt, ComponentExt, MsgMap, SwipeDirection,
|
|
||||||
},
|
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -48,15 +47,13 @@ impl FlowController for ConfirmOutput {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Address, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Address, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Address, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Address, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Address.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Address.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Left) => Self::AccountInfo.swipe(direction),
|
(Self::Menu, Direction::Left) => Self::AccountInfo.swipe(direction),
|
||||||
(Self::AccountInfo | Self::CancelTap, SwipeDirection::Right) => {
|
(Self::AccountInfo | Self::CancelTap, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
Self::Menu.swipe(direction)
|
|
||||||
}
|
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,16 +86,14 @@ impl FlowController for ConfirmOutputWithAmount {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Address | Self::Amount, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Address | Self::Amount, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Address, SwipeDirection::Up) => Self::Amount.swipe(direction),
|
(Self::Address, Direction::Up) => Self::Amount.swipe(direction),
|
||||||
(Self::Amount, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Amount, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
(Self::Amount, SwipeDirection::Down) => Self::Address.swipe(direction),
|
(Self::Amount, Direction::Down) => Self::Address.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Address.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Address.swipe(direction),
|
||||||
(Self::AccountInfo | Self::CancelTap, SwipeDirection::Right) => {
|
(Self::AccountInfo | Self::CancelTap, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
Self::Menu.swipe(direction)
|
|
||||||
}
|
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,21 +133,21 @@ impl FlowController for ConfirmOutputWithSummary {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Main, SwipeDirection::Left) => Self::MainMenu.swipe(direction),
|
(Self::Main, Direction::Left) => Self::MainMenu.swipe(direction),
|
||||||
(Self::Main, SwipeDirection::Up) => Self::Summary.swipe(direction),
|
(Self::Main, Direction::Up) => Self::Summary.swipe(direction),
|
||||||
(Self::MainMenu, SwipeDirection::Right) => Self::Main.swipe(direction),
|
(Self::MainMenu, Direction::Right) => Self::Main.swipe(direction),
|
||||||
(Self::AddressInfo, SwipeDirection::Right) => Self::MainMenu.swipe(direction),
|
(Self::AddressInfo, Direction::Right) => Self::MainMenu.swipe(direction),
|
||||||
(Self::AccountInfo, SwipeDirection::Right) => Self::MainMenu.swipe(direction),
|
(Self::AccountInfo, Direction::Right) => Self::MainMenu.swipe(direction),
|
||||||
(Self::Summary, SwipeDirection::Left) => Self::SummaryMenu.swipe(direction),
|
(Self::Summary, Direction::Left) => Self::SummaryMenu.swipe(direction),
|
||||||
(Self::Summary, SwipeDirection::Up) => Self::Hold.swipe(direction),
|
(Self::Summary, Direction::Up) => Self::Hold.swipe(direction),
|
||||||
(Self::Summary, SwipeDirection::Down) => Self::Main.swipe(direction),
|
(Self::Summary, Direction::Down) => Self::Main.swipe(direction),
|
||||||
(Self::SummaryMenu, SwipeDirection::Right) => Self::Summary.swipe(direction),
|
(Self::SummaryMenu, Direction::Right) => Self::Summary.swipe(direction),
|
||||||
(Self::FeeInfo, SwipeDirection::Right) => Self::SummaryMenu.swipe(direction),
|
(Self::FeeInfo, Direction::Right) => Self::SummaryMenu.swipe(direction),
|
||||||
(Self::Hold, SwipeDirection::Left) => Self::HoldMenu.swipe(direction),
|
(Self::Hold, Direction::Left) => Self::HoldMenu.swipe(direction),
|
||||||
(Self::Hold, SwipeDirection::Down) => Self::Summary.swipe(direction),
|
(Self::Hold, Direction::Down) => Self::Summary.swipe(direction),
|
||||||
(Self::HoldMenu, SwipeDirection::Right) => Self::Hold.swipe(direction),
|
(Self::HoldMenu, Direction::Right) => Self::Hold.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,8 +203,8 @@ fn get_cancel_page(
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -292,7 +287,7 @@ fn new_confirm_output_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Err
|
|||||||
unwrap!(main_menu_items.push(MENU_ITEM_CANCEL));
|
unwrap!(main_menu_items.push(MENU_ITEM_CANCEL));
|
||||||
let content_main_menu = Frame::left_aligned(TString::empty(), main_menu)
|
let content_main_menu = Frame::left_aligned(TString::empty(), main_menu)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(move |msg| match msg {
|
.map(move |msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => {
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => {
|
||||||
let selected_item = main_menu_items[i];
|
let selected_item = main_menu_items[i];
|
||||||
@ -350,8 +345,8 @@ fn new_confirm_output_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Err
|
|||||||
)
|
)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__hold_to_sign.into(), None)
|
.with_footer(TR::instructions__hold_to_sign.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
@ -387,7 +382,7 @@ fn new_confirm_output_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Err
|
|||||||
unwrap!(summary_menu_items.push(MENU_ITEM_CANCEL));
|
unwrap!(summary_menu_items.push(MENU_ITEM_CANCEL));
|
||||||
let content_summary_menu = Frame::left_aligned(TString::empty(), summary_menu)
|
let content_summary_menu = Frame::left_aligned(TString::empty(), summary_menu)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(move |msg| match msg {
|
.map(move |msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => {
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => {
|
||||||
let selected_item = summary_menu_items[i];
|
let selected_item = summary_menu_items[i];
|
||||||
@ -403,7 +398,7 @@ fn new_confirm_output_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Err
|
|||||||
);
|
);
|
||||||
let content_hold_menu = Frame::left_aligned(TString::empty(), hold_menu)
|
let content_hold_menu = Frame::left_aligned(TString::empty(), hold_menu)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(move |msg| match msg {
|
.map(move |msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(_)) => {
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(_)) => {
|
||||||
Some(FlowMsg::Choice(MENU_ITEM_CANCEL))
|
Some(FlowMsg::Choice(MENU_ITEM_CANCEL))
|
||||||
|
@ -8,12 +8,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort},
|
||||||
ButtonRequestExt, ComponentExt, SwipeDirection,
|
ButtonRequestExt, ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -38,13 +39,13 @@ impl FlowController for ConfirmResetCreate {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => Self::Confirm.swipe(direction),
|
(Self::Intro, Direction::Up) => Self::Confirm.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Down) => Self::Intro.swipe(direction),
|
(Self::Confirm, Direction::Down) => Self::Intro.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Confirm, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,11 +74,11 @@ impl FlowController for ConfirmResetRecover {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Intro, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,8 +127,8 @@ fn new_confirm_reset_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Erro
|
|||||||
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info))
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info))
|
||||||
.one_button_request(br);
|
.one_button_request(br);
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ fn new_confirm_reset_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Erro
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, cancel_btn_text),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, cancel_btn_text),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -153,8 +154,8 @@ fn new_confirm_reset_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Erro
|
|||||||
)
|
)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__hold_to_confirm.into(), None)
|
.with_footer(TR::instructions__hold_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
|
@ -7,12 +7,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
|
||||||
ComponentExt, SwipeDirection,
|
ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
model_mercury::component::SwipeContent,
|
model_mercury::component::SwipeContent,
|
||||||
},
|
},
|
||||||
@ -37,15 +38,15 @@ impl FlowController for SetNewPin {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Intro, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::CancelPinIntro, SwipeDirection::Up) => Self::CancelPinConfirm.swipe(direction),
|
(Self::CancelPinIntro, Direction::Up) => Self::CancelPinConfirm.swipe(direction),
|
||||||
(Self::CancelPinIntro, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::CancelPinIntro, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::CancelPinConfirm, SwipeDirection::Down) => Self::CancelPinIntro.swipe(direction),
|
(Self::CancelPinConfirm, Direction::Down) => Self::CancelPinIntro.swipe(direction),
|
||||||
(Self::CancelPinConfirm, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::CancelPinConfirm, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,8 +79,8 @@ impl SetNewPin {
|
|||||||
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(bm) => Some(bm),
|
FrameMsg::Button(bm) => Some(bm),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -90,7 +91,7 @@ impl SetNewPin {
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::pin__cancel_setup.into()),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::pin__cancel_setup.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
@ -111,8 +112,8 @@ impl SetNewPin {
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::pin__cancel_description.into()),
|
Some(TR::pin__cancel_description.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(bm) => Some(bm),
|
FrameMsg::Button(bm) => Some(bm),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -124,8 +125,8 @@ impl SetNewPin {
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
|
@ -7,11 +7,12 @@ use crate::{
|
|||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
button_request::ButtonRequest,
|
button_request::ButtonRequest,
|
||||||
component::{swipe_detect::SwipeSettings, ButtonRequestExt, ComponentExt, SwipeDirection},
|
component::{swipe_detect::SwipeSettings, ButtonRequestExt, ComponentExt},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
model_mercury::component::SwipeContent,
|
model_mercury::component::SwipeContent,
|
||||||
},
|
},
|
||||||
@ -47,13 +48,13 @@ impl FlowController for ConfirmSummary {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Summary | Self::Hold, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Summary | Self::Hold, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Summary, SwipeDirection::Up) => Self::Hold.swipe(direction),
|
(Self::Summary, Direction::Up) => Self::Hold.swipe(direction),
|
||||||
(Self::Hold, SwipeDirection::Down) => Self::Summary.swipe(direction),
|
(Self::Hold, Direction::Down) => Self::Summary.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Summary.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Summary.swipe(direction),
|
||||||
(Self::AccountInfo | Self::FeeInfo | Self::CancelTap, SwipeDirection::Right) => {
|
(Self::AccountInfo | Self::FeeInfo | Self::CancelTap, Direction::Right) => {
|
||||||
Self::Menu.swipe(direction)
|
Self::Menu.swipe(direction)
|
||||||
}
|
}
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
@ -113,8 +114,8 @@ impl ConfirmSummary {
|
|||||||
)
|
)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__hold_to_sign.into(), None)
|
.with_footer(TR::instructions__hold_to_sign.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
@ -165,7 +166,7 @@ impl ConfirmSummary {
|
|||||||
unwrap!(menu_items.push(MENU_ITEM_CANCEL));
|
unwrap!(menu_items.push(MENU_ITEM_CANCEL));
|
||||||
let content_menu = Frame::left_aligned(TString::empty(), menu)
|
let content_menu = Frame::left_aligned(TString::empty(), menu)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(move |msg| match msg {
|
.map(move |msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => {
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => {
|
||||||
let selected_item = menu_items[i];
|
let selected_item = menu_items[i];
|
||||||
@ -181,7 +182,7 @@ impl ConfirmSummary {
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
|
@ -11,12 +11,13 @@ use crate::{
|
|||||||
text::paragraphs::{
|
text::paragraphs::{
|
||||||
Paragraph, ParagraphSource, ParagraphVecLong, ParagraphVecShort, Paragraphs, VecExt,
|
Paragraph, ParagraphSource, ParagraphVecLong, ParagraphVecShort, Paragraphs, VecExt,
|
||||||
},
|
},
|
||||||
ComponentExt, EventCtx, SwipeDirection,
|
ComponentExt, EventCtx,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::{obj::LayoutObj, util::RecoveryType},
|
layout::{obj::LayoutObj, util::RecoveryType},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -58,11 +59,11 @@ impl FlowController for ContinueRecoveryBeforeShares {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Main, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Main, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Main.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Main.swipe(direction),
|
||||||
(Self::Main, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Main, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,14 +84,14 @@ impl FlowController for ContinueRecoveryBetweenShares {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Main, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Main, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Main.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Main.swipe(direction),
|
||||||
(Self::Main, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Main, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
(Self::CancelIntro, SwipeDirection::Up) => Self::CancelConfirm.swipe(direction),
|
(Self::CancelIntro, Direction::Up) => Self::CancelConfirm.swipe(direction),
|
||||||
(Self::CancelIntro, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::CancelIntro, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
(Self::CancelConfirm, SwipeDirection::Down) => Self::CancelIntro.swipe(direction),
|
(Self::CancelConfirm, Direction::Down) => Self::CancelIntro.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,15 +115,15 @@ impl FlowController for ContinueRecoveryBetweenSharesAdvanced {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Main, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Main, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Main.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Main.swipe(direction),
|
||||||
(Self::Main, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Main, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
(Self::CancelIntro, SwipeDirection::Up) => Self::CancelConfirm.swipe(direction),
|
(Self::CancelIntro, Direction::Up) => Self::CancelConfirm.swipe(direction),
|
||||||
(Self::CancelIntro, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::CancelIntro, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
(Self::CancelConfirm, SwipeDirection::Down) => Self::CancelIntro.swipe(direction),
|
(Self::CancelConfirm, Direction::Down) => Self::CancelIntro.swipe(direction),
|
||||||
(Self::RemainingShares, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::RemainingShares, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,8 +216,8 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
.with_subtitle(TR::words__instructions.into())
|
.with_subtitle(TR::words__instructions.into())
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(footer_instruction, footer_description)
|
.with_footer(footer_instruction, footer_description)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info))
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info))
|
||||||
.repeated_button_request(ButtonRequest::new(
|
.repeated_button_request(ButtonRequest::new(
|
||||||
ButtonRequestCode::RecoveryHomepage,
|
ButtonRequestCode::RecoveryHomepage,
|
||||||
@ -236,8 +237,8 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::words__continue_anyway.into()),
|
Some(TR::words__continue_anyway.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -253,8 +254,8 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
@ -267,7 +268,7 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, cancel_btn.into()),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, cancel_btn.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -282,7 +283,7 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, cancel_btn.into()),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, cancel_btn.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -310,7 +311,7 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
.danger(theme::ICON_CANCEL, cancel_btn.into()),
|
.danger(theme::ICON_CANCEL, cancel_btn.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -333,8 +334,8 @@ fn new_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Error> {
|
|||||||
TR::instructions__swipe_down.into(),
|
TR::instructions__swipe_down.into(),
|
||||||
)
|
)
|
||||||
.register_footer_update_fn(footer_update_fn)
|
.register_footer_update_fn(footer_update_fn)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.with_vertical_pages()
|
.with_vertical_pages()
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled))
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled))
|
||||||
.repeated_button_request(ButtonRequest::new(
|
.repeated_button_request(ButtonRequest::new(
|
||||||
|
@ -8,12 +8,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, Paragraphs},
|
text::paragraphs::{Paragraph, ParagraphSource, Paragraphs},
|
||||||
ButtonRequestExt, ComponentExt, Qr, SwipeDirection,
|
ButtonRequestExt, ComponentExt, Qr,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
FlowController, FlowMsg, SwipeFlow, SwipePage,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::{obj::LayoutObj, util::ConfirmBlob},
|
layout::{obj::LayoutObj, util::ConfirmBlob},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -46,19 +47,19 @@ impl FlowController for GetAddress {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Address, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Address, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Address, SwipeDirection::Up) => Self::Tap.swipe(direction),
|
(Self::Address, Direction::Up) => Self::Tap.swipe(direction),
|
||||||
(Self::Tap, SwipeDirection::Down) => Self::Address.swipe(direction),
|
(Self::Tap, Direction::Down) => Self::Address.swipe(direction),
|
||||||
(Self::Tap, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Tap, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Address.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Address.swipe(direction),
|
||||||
(Self::QrCode, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::QrCode, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
(Self::AccountInfo, SwipeDirection::Right) => Self::Menu.swipe_right(),
|
(Self::AccountInfo, Direction::Right) => Self::Menu.swipe_right(),
|
||||||
(Self::Cancel, SwipeDirection::Up) => Self::CancelTap.swipe(direction),
|
(Self::Cancel, Direction::Up) => Self::CancelTap.swipe(direction),
|
||||||
(Self::Cancel, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::Cancel, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
(Self::CancelTap, SwipeDirection::Down) => Self::Cancel.swipe(direction),
|
(Self::CancelTap, Direction::Down) => Self::Cancel.swipe(direction),
|
||||||
(Self::CancelTap, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::CancelTap, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,8 +128,8 @@ impl GetAddress {
|
|||||||
Frame::left_aligned(title, SwipeContent::new(SwipePage::vertical(paragraphs)))
|
Frame::left_aligned(title, SwipeContent::new(SwipePage::vertical(paragraphs)))
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.with_vertical_pages()
|
.with_vertical_pages()
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info))
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info))
|
||||||
.one_button_request(ButtonRequest::from_num(br_code, br_name))
|
.one_button_request(ButtonRequest::from_num(br_code, br_name))
|
||||||
@ -139,8 +140,8 @@ impl GetAddress {
|
|||||||
let content_tap =
|
let content_tap =
|
||||||
Frame::left_aligned(title, SwipeContent::new(PromptScreen::new_tap_to_confirm()))
|
Frame::left_aligned(title, SwipeContent::new(PromptScreen::new_tap_to_confirm()))
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
@ -167,7 +168,7 @@ impl GetAddress {
|
|||||||
.danger(theme::ICON_CANCEL, TR::address__cancel_receive.into()),
|
.danger(theme::ICON_CANCEL, TR::address__cancel_receive.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -181,7 +182,7 @@ impl GetAddress {
|
|||||||
.with_border(QR_BORDER),
|
.with_border(QR_BORDER),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled));
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled));
|
||||||
|
|
||||||
// AccountInfo
|
// AccountInfo
|
||||||
@ -202,8 +203,8 @@ impl GetAddress {
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled));
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled));
|
||||||
|
|
||||||
// CancelTap
|
// CancelTap
|
||||||
@ -213,8 +214,8 @@ impl GetAddress {
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
|
@ -7,12 +7,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
|
||||||
ComponentExt, SwipeDirection,
|
ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -38,17 +39,15 @@ impl FlowController for PromptBackup {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Intro, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Intro, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Intro, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Intro, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::SkipBackupIntro, SwipeDirection::Up) => Self::SkipBackupConfirm.swipe(direction),
|
(Self::SkipBackupIntro, Direction::Up) => Self::SkipBackupConfirm.swipe(direction),
|
||||||
(Self::SkipBackupIntro, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
(Self::SkipBackupIntro, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
(Self::SkipBackupConfirm, SwipeDirection::Down) => {
|
(Self::SkipBackupConfirm, Direction::Down) => Self::SkipBackupIntro.swipe(direction),
|
||||||
Self::SkipBackupIntro.swipe(direction)
|
(Self::SkipBackupConfirm, Direction::Right) => Self::Intro.swipe(direction),
|
||||||
}
|
|
||||||
(Self::SkipBackupConfirm, SwipeDirection::Right) => Self::Intro.swipe(direction),
|
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,8 +79,8 @@ impl PromptBackup {
|
|||||||
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(bm) => Some(bm),
|
FrameMsg::Button(bm) => Some(bm),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -92,7 +91,7 @@ impl PromptBackup {
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::backup__title_skip.into()),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::backup__title_skip.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
@ -116,8 +115,8 @@ impl PromptBackup {
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::words__continue_anyway.into()),
|
Some(TR::words__continue_anyway.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
_ => None,
|
_ => None,
|
||||||
@ -129,8 +128,8 @@ impl PromptBackup {
|
|||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
FrameMsg::Content(PromptMsg::Confirmed) => Some(FlowMsg::Confirmed),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
|
@ -5,11 +5,12 @@ use crate::{
|
|||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
button_request::ButtonRequest,
|
button_request::ButtonRequest,
|
||||||
component::{swipe_detect::SwipeSettings, ButtonRequestExt, ComponentExt, SwipeDirection},
|
component::{swipe_detect::SwipeSettings, ButtonRequestExt, ComponentExt},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -37,11 +38,11 @@ impl FlowController for RequestNumber {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Number, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Number, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Number.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Number.swipe(direction),
|
||||||
(Self::Info, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::Info, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,8 +92,8 @@ impl RequestNumber {
|
|||||||
Frame::left_aligned(title, SwipeContent::new(number_input_dialog))
|
Frame::left_aligned(title, SwipeContent::new(number_input_dialog))
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
FrameMsg::Button(_) => Some(FlowMsg::Info),
|
||||||
FrameMsg::Content(NumberInputDialogMsg::Changed(n)) => {
|
FrameMsg::Content(NumberInputDialogMsg::Changed(n)) => {
|
||||||
@ -111,7 +112,7 @@ impl RequestNumber {
|
|||||||
VerticalMenu::empty().item(theme::ICON_CHEVRON_RIGHT, TR::buttons__more_info.into()),
|
VerticalMenu::empty().item(theme::ICON_CHEVRON_RIGHT, TR::buttons__more_info.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
@ -121,7 +122,7 @@ impl RequestNumber {
|
|||||||
let updatable_info = UpdatableMoreInfo::new(info_cb);
|
let updatable_info = UpdatableMoreInfo::new(info_cb);
|
||||||
let content_info = Frame::left_aligned(TString::empty(), SwipeContent::new(updatable_info))
|
let content_info = Frame::left_aligned(TString::empty(), SwipeContent::new(updatable_info))
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(FlowMsg::Cancelled) => Some(FlowMsg::Cancelled),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -4,11 +4,12 @@ use crate::{
|
|||||||
strutil::{ShortString, TString},
|
strutil::{ShortString, TString},
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
component::{ComponentExt, SwipeDirection},
|
component::ComponentExt,
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -29,7 +30,7 @@ impl FlowController for RequestPassphrase {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, _direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, _direction: Direction) -> Decision {
|
||||||
self.do_nothing()
|
self.do_nothing()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,12 @@ use crate::{
|
|||||||
translations::TR,
|
translations::TR,
|
||||||
trezorhal::display,
|
trezorhal::display,
|
||||||
ui::{
|
ui::{
|
||||||
component::{base::ComponentExt, swipe_detect::SwipeSettings, FlowMsg, SwipeDirection},
|
component::{base::ComponentExt, swipe_detect::SwipeSettings, FlowMsg},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, SwipeFlow,
|
FlowController, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -39,13 +40,13 @@ impl FlowController for SetBrightness {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Slider.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Slider.swipe(direction),
|
||||||
(Self::Slider, SwipeDirection::Up) => Self::Confirm.swipe(direction),
|
(Self::Slider, Direction::Up) => Self::Confirm.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Down) => Self::Slider.swipe(direction),
|
(Self::Confirm, Direction::Down) => Self::Slider.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Confirm, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Confirmed, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::Confirmed, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +84,7 @@ impl SetBrightness {
|
|||||||
)
|
)
|
||||||
.with_subtitle(TR::homescreen__settings_subtitle.into())
|
.with_subtitle(TR::homescreen__settings_subtitle.into())
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(NumberInputSliderDialogMsg::Changed(n)) => {
|
FrameMsg::Content(NumberInputSliderDialogMsg::Changed(n)) => {
|
||||||
display::backlight(n as _);
|
display::backlight(n as _);
|
||||||
@ -98,7 +99,7 @@ impl SetBrightness {
|
|||||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
|
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(move |msg| match msg {
|
.map(move |msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -110,8 +111,8 @@ impl SetBrightness {
|
|||||||
)
|
)
|
||||||
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
.with_footer(TR::instructions__tap_to_confirm.into(), None)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(move |msg| match msg {
|
.map(move |msg| match msg {
|
||||||
FrameMsg::Content(PromptMsg::Confirmed) => {
|
FrameMsg::Content(PromptMsg::Confirmed) => {
|
||||||
let _ = storage::set_brightness(BRIGHTNESS.load(Ordering::Relaxed));
|
let _ = storage::set_brightness(BRIGHTNESS.load(Ordering::Relaxed));
|
||||||
@ -129,7 +130,7 @@ impl SetBrightness {
|
|||||||
.with_no_attach_anim(),
|
.with_no_attach_anim(),
|
||||||
)
|
)
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.map(move |_msg| Some(FlowMsg::Confirmed));
|
.map(move |_msg| Some(FlowMsg::Confirmed));
|
||||||
|
|
||||||
let res = SwipeFlow::new(&SetBrightness::Slider)?
|
let res = SwipeFlow::new(&SetBrightness::Slider)?
|
||||||
|
@ -8,12 +8,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
|
||||||
ButtonRequestExt, ComponentExt, EventCtx, SwipeDirection,
|
ButtonRequestExt, ComponentExt, EventCtx,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
model_mercury::component::{InternallySwipable, InternallySwipableContent, SwipeContent},
|
model_mercury::component::{InternallySwipable, InternallySwipableContent, SwipeContent},
|
||||||
},
|
},
|
||||||
@ -39,13 +40,13 @@ impl FlowController for ShowShareWords {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Instruction, SwipeDirection::Up) => Self::Words.swipe(direction),
|
(Self::Instruction, Direction::Up) => Self::Words.swipe(direction),
|
||||||
(Self::Confirm, SwipeDirection::Down) => Self::Words.swipe(direction),
|
(Self::Confirm, Direction::Down) => Self::Words.swipe(direction),
|
||||||
(Self::Words, SwipeDirection::Up) => Self::Confirm.swipe(direction),
|
(Self::Words, Direction::Up) => Self::Confirm.swipe(direction),
|
||||||
(Self::Words, SwipeDirection::Down) => Self::Instruction.swipe(direction),
|
(Self::Words, Direction::Down) => Self::Instruction.swipe(direction),
|
||||||
(Self::CheckBackupIntro, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::CheckBackupIntro, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +114,7 @@ impl ShowShareWords {
|
|||||||
)
|
)
|
||||||
.with_subtitle(TR::words__instructions.into())
|
.with_subtitle(TR::words__instructions.into())
|
||||||
.with_footer(TR::instructions__swipe_up.into(), description)
|
.with_footer(TR::instructions__swipe_up.into(), description)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Content(_)).then_some(FlowMsg::Confirmed))
|
.map(|msg| matches!(msg, FrameMsg::Content(_)).then_some(FlowMsg::Confirmed))
|
||||||
.one_button_request(ButtonRequestCode::ResetDevice.with_name("share_words"))
|
.one_button_request(ButtonRequestCode::ResetDevice.with_name("share_words"))
|
||||||
.with_pages(move |_| nwords + 2);
|
.with_pages(move |_| nwords + 2);
|
||||||
@ -123,8 +124,8 @@ impl ShowShareWords {
|
|||||||
title,
|
title,
|
||||||
InternallySwipableContent::new(ShareWords::new(share_words_vec, subtitle)),
|
InternallySwipableContent::new(ShareWords::new(share_words_vec, subtitle)),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.with_vertical_pages()
|
.with_vertical_pages()
|
||||||
.with_subtitle(subtitle)
|
.with_subtitle(subtitle)
|
||||||
.register_header_update_fn(header_updating_func)
|
.register_header_update_fn(header_updating_func)
|
||||||
@ -137,7 +138,7 @@ impl ShowShareWords {
|
|||||||
SwipeContent::new(PromptScreen::new_hold_to_confirm()),
|
SwipeContent::new(PromptScreen::new_hold_to_confirm()),
|
||||||
)
|
)
|
||||||
.with_footer(TR::instructions__hold_to_confirm.into(), None)
|
.with_footer(TR::instructions__hold_to_confirm.into(), None)
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.map(|_| Some(FlowMsg::Confirmed));
|
.map(|_| Some(FlowMsg::Confirmed));
|
||||||
|
|
||||||
let content_check_backup_intro = Frame::left_aligned(
|
let content_check_backup_intro = Frame::left_aligned(
|
||||||
@ -148,7 +149,7 @@ impl ShowShareWords {
|
|||||||
))),
|
))),
|
||||||
)
|
)
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.map(|_| Some(FlowMsg::Confirmed));
|
.map(|_| Some(FlowMsg::Confirmed));
|
||||||
|
|
||||||
let res = SwipeFlow::new(&ShowShareWords::Instruction)?
|
let res = SwipeFlow::new(&ShowShareWords::Instruction)?
|
||||||
|
@ -6,12 +6,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, Paragraphs},
|
text::paragraphs::{Paragraph, Paragraphs},
|
||||||
ComponentExt, SwipeDirection,
|
ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -42,18 +43,18 @@ impl FlowController for ShowTutorial {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::StepBegin, SwipeDirection::Up) => Self::StepNavigation.swipe(direction),
|
(Self::StepBegin, Direction::Up) => Self::StepNavigation.swipe(direction),
|
||||||
(Self::StepNavigation, SwipeDirection::Up) => Self::StepMenu.swipe(direction),
|
(Self::StepNavigation, Direction::Up) => Self::StepMenu.swipe(direction),
|
||||||
(Self::StepNavigation, SwipeDirection::Down) => Self::StepBegin.swipe(direction),
|
(Self::StepNavigation, Direction::Down) => Self::StepBegin.swipe(direction),
|
||||||
(Self::StepMenu, SwipeDirection::Up) => Self::StepHold.swipe(direction),
|
(Self::StepMenu, Direction::Up) => Self::StepHold.swipe(direction),
|
||||||
(Self::StepMenu, SwipeDirection::Down) => Self::StepNavigation.swipe(direction),
|
(Self::StepMenu, Direction::Down) => Self::StepNavigation.swipe(direction),
|
||||||
(Self::StepMenu, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::StepMenu, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Left) => Self::DidYouKnow.swipe(direction),
|
(Self::Menu, Direction::Left) => Self::DidYouKnow.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::StepBegin.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::StepBegin.swipe(direction),
|
||||||
(Self::DidYouKnow, SwipeDirection::Right) => Self::Menu.swipe(direction),
|
(Self::DidYouKnow, Direction::Right) => Self::Menu.swipe(direction),
|
||||||
(Self::StepDone, SwipeDirection::Up) => self.return_msg(FlowMsg::Confirmed),
|
(Self::StepDone, Direction::Up) => self.return_msg(FlowMsg::Confirmed),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +102,7 @@ impl ShowTutorial {
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::tutorial__get_started.into()),
|
Some(TR::tutorial__get_started.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.map(|_| None);
|
.map(|_| None);
|
||||||
|
|
||||||
let content_step_navigation = Frame::left_aligned(
|
let content_step_navigation = Frame::left_aligned(
|
||||||
@ -115,8 +116,8 @@ impl ShowTutorial {
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::tutorial__continue.into()),
|
Some(TR::tutorial__continue.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.map(|_| None);
|
.map(|_| None);
|
||||||
|
|
||||||
let content_step_menu = Frame::left_aligned(
|
let content_step_menu = Frame::left_aligned(
|
||||||
@ -132,8 +133,8 @@ impl ShowTutorial {
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::buttons__continue.into()),
|
Some(TR::buttons__continue.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Down, SwipeSettings::default())
|
.with_swipe(Direction::Down, SwipeSettings::default())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info));
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info));
|
||||||
|
|
||||||
let content_step_hold = Frame::left_aligned(
|
let content_step_hold = Frame::left_aligned(
|
||||||
@ -153,7 +154,7 @@ impl ShowTutorial {
|
|||||||
))),
|
))),
|
||||||
)
|
)
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.map(|_| None);
|
.map(|_| None);
|
||||||
|
|
||||||
let content_menu = Frame::left_aligned(
|
let content_menu = Frame::left_aligned(
|
||||||
@ -164,8 +165,8 @@ impl ShowTutorial {
|
|||||||
.danger(theme::ICON_CANCEL, TR::tutorial__exit.into()),
|
.danger(theme::ICON_CANCEL, TR::tutorial__exit.into()),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::immediate())
|
.with_swipe(Direction::Left, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
@ -179,7 +180,7 @@ impl ShowTutorial {
|
|||||||
))),
|
))),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled));
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Cancelled));
|
||||||
|
|
||||||
let content_hold_to_exit = Frame::left_aligned(
|
let content_hold_to_exit = Frame::left_aligned(
|
||||||
|
@ -12,9 +12,10 @@ use crate::{
|
|||||||
base::ComponentExt,
|
base::ComponentExt,
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
|
||||||
Component, SwipeDirection,
|
Component,
|
||||||
},
|
},
|
||||||
flow::{FlowMsg, Swipable, SwipePage},
|
flow::{FlowMsg, Swipable, SwipePage},
|
||||||
|
geometry::Direction,
|
||||||
layout::util::{ConfirmBlob, StrOrBytes},
|
layout::util::{ConfirmBlob, StrOrBytes},
|
||||||
model_mercury::component::SwipeContent,
|
model_mercury::component::SwipeContent,
|
||||||
},
|
},
|
||||||
@ -154,19 +155,19 @@ impl ConfirmBlobParams {
|
|||||||
}
|
}
|
||||||
if let Some(instruction) = self.footer_instruction {
|
if let Some(instruction) = self.footer_instruction {
|
||||||
frame = frame.with_footer(instruction, self.footer_description);
|
frame = frame.with_footer(instruction, self.footer_description);
|
||||||
frame = frame.with_swipe(SwipeDirection::Left, SwipeSettings::default());
|
frame = frame.with_swipe(Direction::Left, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.swipe_up {
|
if self.swipe_up {
|
||||||
frame = frame.with_swipe(SwipeDirection::Up, SwipeSettings::default());
|
frame = frame.with_swipe(Direction::Up, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.swipe_down {
|
if self.swipe_down {
|
||||||
frame = frame.with_swipe(SwipeDirection::Down, SwipeSettings::default());
|
frame = frame.with_swipe(Direction::Down, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.swipe_right {
|
if self.swipe_right {
|
||||||
frame = frame.with_swipe(SwipeDirection::Right, SwipeSettings::default());
|
frame = frame.with_swipe(Direction::Right, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = frame.with_vertical_pages();
|
frame = frame.with_vertical_pages();
|
||||||
@ -292,22 +293,22 @@ impl ShowInfoParams {
|
|||||||
if self.cancel_button {
|
if self.cancel_button {
|
||||||
frame = frame
|
frame = frame
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate());
|
.with_swipe(Direction::Right, SwipeSettings::immediate());
|
||||||
} else if self.menu_button {
|
} else if self.menu_button {
|
||||||
frame = frame
|
frame = frame
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default());
|
.with_swipe(Direction::Left, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
if let Some(instruction) = self.footer_instruction {
|
if let Some(instruction) = self.footer_instruction {
|
||||||
frame = frame.with_footer(instruction, self.footer_description);
|
frame = frame.with_footer(instruction, self.footer_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.swipe_up {
|
if self.swipe_up {
|
||||||
frame = frame.with_swipe(SwipeDirection::Up, SwipeSettings::default());
|
frame = frame.with_swipe(Direction::Up, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.swipe_down {
|
if self.swipe_down {
|
||||||
frame = frame.with_swipe(SwipeDirection::Down, SwipeSettings::default());
|
frame = frame.with_swipe(Direction::Down, SwipeSettings::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = frame.with_vertical_pages();
|
frame = frame.with_vertical_pages();
|
||||||
|
@ -7,12 +7,13 @@ use crate::{
|
|||||||
component::{
|
component::{
|
||||||
swipe_detect::SwipeSettings,
|
swipe_detect::SwipeSettings,
|
||||||
text::paragraphs::{Paragraph, ParagraphSource},
|
text::paragraphs::{Paragraph, ParagraphSource},
|
||||||
ComponentExt, SwipeDirection,
|
ComponentExt,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
base::{Decision, DecisionBuilder as _},
|
base::{Decision, DecisionBuilder as _},
|
||||||
FlowController, FlowMsg, SwipeFlow,
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
},
|
},
|
||||||
|
geometry::Direction,
|
||||||
layout::obj::LayoutObj,
|
layout::obj::LayoutObj,
|
||||||
model_mercury::component::SwipeContent,
|
model_mercury::component::SwipeContent,
|
||||||
},
|
},
|
||||||
@ -36,11 +37,11 @@ impl FlowController for WarningHiPrio {
|
|||||||
*self as usize
|
*self as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_swipe(&'static self, direction: SwipeDirection) -> Decision {
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
match (self, direction) {
|
match (self, direction) {
|
||||||
(Self::Message, SwipeDirection::Left) => Self::Menu.swipe(direction),
|
(Self::Message, Direction::Left) => Self::Menu.swipe(direction),
|
||||||
(Self::Message, SwipeDirection::Up) => Self::Cancelled.swipe(direction),
|
(Self::Message, Direction::Up) => Self::Cancelled.swipe(direction),
|
||||||
(Self::Menu, SwipeDirection::Right) => Self::Message.swipe(direction),
|
(Self::Menu, Direction::Right) => Self::Message.swipe(direction),
|
||||||
_ => self.do_nothing(),
|
_ => self.do_nothing(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,8 +85,8 @@ impl WarningHiPrio {
|
|||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), Some(cancel))
|
.with_footer(TR::instructions__swipe_up.into(), Some(cancel))
|
||||||
.with_danger()
|
.with_danger()
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
.with_swipe(SwipeDirection::Left, SwipeSettings::default())
|
.with_swipe(Direction::Left, SwipeSettings::default())
|
||||||
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info));
|
.map(|msg| matches!(msg, FrameMsg::Button(_)).then_some(FlowMsg::Info));
|
||||||
// .one_button_request(ButtonRequestCode::Warning, br_name);
|
// .one_button_request(ButtonRequestCode::Warning, br_name);
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ impl WarningHiPrio {
|
|||||||
.danger(theme::ICON_CHEVRON_RIGHT, confirm),
|
.danger(theme::ICON_CHEVRON_RIGHT, confirm),
|
||||||
)
|
)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
|
.with_swipe(Direction::Right, SwipeSettings::immediate())
|
||||||
.map(|msg| match msg {
|
.map(|msg| match msg {
|
||||||
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
|
||||||
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
|
||||||
|
@ -38,10 +38,10 @@ use crate::{
|
|||||||
},
|
},
|
||||||
TextStyle,
|
TextStyle,
|
||||||
},
|
},
|
||||||
Border, CachedJpeg, Component, FormattedText, Never, SwipeDirection, Timeout,
|
Border, CachedJpeg, Component, FormattedText, Never, Timeout,
|
||||||
},
|
},
|
||||||
flow::Swipable,
|
flow::Swipable,
|
||||||
geometry,
|
geometry::{self, Direction},
|
||||||
layout::{
|
layout::{
|
||||||
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
|
obj::{ComponentMsgObj, LayoutObj, ATTACH_TYPE_OBJ},
|
||||||
result::{CANCELLED, CONFIRMED, INFO},
|
result::{CANCELLED, CONFIRMED, INFO},
|
||||||
@ -475,7 +475,7 @@ extern "C" fn new_confirm_homescreen(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
TR::instructions__swipe_up.into(),
|
TR::instructions__swipe_up.into(),
|
||||||
Some(TR::buttons__change.into()),
|
Some(TR::buttons__change.into()),
|
||||||
)
|
)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
));
|
));
|
||||||
Ok(obj?.into())
|
Ok(obj?.into())
|
||||||
};
|
};
|
||||||
@ -599,7 +599,7 @@ extern "C" fn new_confirm_modify_output(n_args: usize, args: *const Obj, kwargs:
|
|||||||
Frame::left_aligned(TR::modify_amount__title.into(), paragraphs)
|
Frame::left_aligned(TR::modify_amount__title.into(), paragraphs)
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -643,7 +643,7 @@ extern "C" fn new_confirm_modify_fee(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
Frame::left_aligned(title, paragraphs)
|
Frame::left_aligned(title, paragraphs)
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -662,12 +662,12 @@ extern "C" fn new_show_error(n_args: usize, args: *const Obj, kwargs: *mut Map)
|
|||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_danger()
|
.with_danger()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
} else {
|
} else {
|
||||||
Frame::left_aligned(title, SwipeContent::new(content))
|
Frame::left_aligned(title, SwipeContent::new(content))
|
||||||
.with_danger()
|
.with_danger()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default())
|
.with_swipe(Direction::Up, SwipeSettings::default())
|
||||||
};
|
};
|
||||||
|
|
||||||
let frame = SwipeUpScreen::new(frame);
|
let frame = SwipeUpScreen::new(frame);
|
||||||
@ -693,7 +693,7 @@ extern "C" fn new_show_warning(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|||||||
|
|
||||||
let frame = Frame::left_aligned(title, SwipeContent::new(content))
|
let frame = Frame::left_aligned(title, SwipeContent::new(content))
|
||||||
.with_footer(TR::instructions__swipe_up.into(), action)
|
.with_footer(TR::instructions__swipe_up.into(), action)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default());
|
.with_swipe(Direction::Up, SwipeSettings::default());
|
||||||
|
|
||||||
let frame_with_icon = if danger {
|
let frame_with_icon = if danger {
|
||||||
frame.with_danger_icon()
|
frame.with_danger_icon()
|
||||||
@ -723,7 +723,7 @@ extern "C" fn new_show_success(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|||||||
)
|
)
|
||||||
.with_footer(TR::instructions__swipe_up.into(), description)
|
.with_footer(TR::instructions__swipe_up.into(), description)
|
||||||
.with_result_icon(ICON_BULLET_CHECKMARK, theme::GREEN_LIGHT)
|
.with_result_icon(ICON_BULLET_CHECKMARK, theme::GREEN_LIGHT)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -738,7 +738,7 @@ extern "C" fn new_show_info(n_args: usize, args: *const Obj, kwargs: *mut Map) -
|
|||||||
let obj = LayoutObj::new(SwipeUpScreen::new(
|
let obj = LayoutObj::new(SwipeUpScreen::new(
|
||||||
Frame::left_aligned(title, SwipeContent::new(content))
|
Frame::left_aligned(title, SwipeContent::new(content))
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -762,7 +762,7 @@ extern "C" fn new_show_mismatch(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|||||||
Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
Frame::left_aligned(title, SwipeContent::new(paragraphs))
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), Some(button))
|
.with_footer(TR::instructions__swipe_up.into(), Some(button))
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
@ -806,7 +806,7 @@ extern "C" fn new_confirm_with_info(n_args: usize, args: *const Obj, kwargs: *mu
|
|||||||
Frame::left_aligned(title, SwipeContent::new(paragraphs.into_paragraphs()))
|
Frame::left_aligned(title, SwipeContent::new(paragraphs.into_paragraphs()))
|
||||||
.with_menu_button()
|
.with_menu_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), Some(button))
|
.with_footer(TR::instructions__swipe_up.into(), Some(button))
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -831,7 +831,7 @@ extern "C" fn new_confirm_more(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|||||||
Frame::left_aligned(title, SwipeContent::new(paragraphs.into_paragraphs()))
|
Frame::left_aligned(title, SwipeContent::new(paragraphs.into_paragraphs()))
|
||||||
.with_cancel_button()
|
.with_cancel_button()
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -960,7 +960,7 @@ extern "C" fn new_show_checklist(n_args: usize, args: *const Obj, kwargs: *mut M
|
|||||||
let obj = LayoutObj::new(SwipeUpScreen::new(
|
let obj = LayoutObj::new(SwipeUpScreen::new(
|
||||||
Frame::left_aligned(title, SwipeContent::new(checklist_content))
|
Frame::left_aligned(title, SwipeContent::new(checklist_content))
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
};
|
};
|
||||||
@ -1005,7 +1005,7 @@ extern "C" fn new_show_group_share_success(
|
|||||||
let obj = LayoutObj::new(SwipeUpScreen::new(
|
let obj = LayoutObj::new(SwipeUpScreen::new(
|
||||||
Frame::left_aligned("".into(), SwipeContent::new(paragraphs))
|
Frame::left_aligned("".into(), SwipeContent::new(paragraphs))
|
||||||
.with_footer(TR::instructions__swipe_up.into(), None)
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
||||||
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
|
.with_swipe(Direction::Up, SwipeSettings::default()),
|
||||||
))?;
|
))?;
|
||||||
|
|
||||||
Ok(obj.into())
|
Ok(obj.into())
|
||||||
|
Loading…
Reference in New Issue
Block a user