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

feat(core/mercury): allow passphrase in FlowStore

[no changelog]
This commit is contained in:
obrusvit 2024-08-01 15:22:41 +02:00 committed by Vít Obrusník
parent 2203d9be1a
commit d99a94758b

View File

@ -3,8 +3,8 @@ use crate::{
translations::TR, translations::TR,
ui::{ ui::{
component::{ component::{
base::ComponentExt, text::common::TextBox, Component, Event, EventCtx, Label, Maybe, base::ComponentExt, swipe_detect::SwipeConfig, text::common::TextBox, Component, Event,
Never, Swipe, SwipeDirection, EventCtx, Label, Maybe, Never, Swipe, SwipeDirection,
}, },
display, display,
geometry::{Alignment, Grid, Insets, Offset, Rect}, geometry::{Alignment, Grid, Insets, Offset, Rect},
@ -85,6 +85,8 @@ pub struct PassphraseKeyboard {
keys: [Button; KEY_COUNT], keys: [Button; KEY_COUNT],
active_layout: KeyboardLayout, active_layout: KeyboardLayout,
fade: Cell<bool>, fade: Cell<bool>,
swipe_config: SwipeConfig, // FIXME: how about page_swipe
internal_page_cnt: usize,
} }
const PAGE_COUNT: usize = 4; const PAGE_COUNT: usize = 4;
@ -140,6 +142,8 @@ impl PassphraseKeyboard {
}), }),
active_layout, active_layout,
fade: Cell::new(false), fade: Cell::new(false),
swipe_config: SwipeConfig::new(),
internal_page_cnt: 1,
} }
} }
@ -447,6 +451,17 @@ impl Component for Input {
} }
} }
#[cfg(feature = "micropython")]
impl crate::ui::flow::Swipable for PassphraseKeyboard {
fn get_swipe_config(&self) -> SwipeConfig {
self.swipe_config
}
fn get_internal_page_count(&self) -> usize {
self.internal_page_cnt
}
}
#[cfg(feature = "ui_debug")] #[cfg(feature = "ui_debug")]
impl crate::trace::Trace for PassphraseKeyboard { impl crate::trace::Trace for PassphraseKeyboard {
fn trace(&self, t: &mut dyn crate::trace::Tracer) { fn trace(&self, t: &mut dyn crate::trace::Tracer) {