Skip to content

Commit 81f89e6

Browse files
committed
fixup! feat(core/bolt): hide chars in passphrase input
1 parent f65b949 commit 81f89e6

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

  • core/embed/rust/src/ui/layout_bolt/component/keyboard

core/embed/rust/src/ui/layout_bolt/component/keyboard/passphrase.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,19 @@ impl Component for PassphraseKeyboard {
233233
fn place(&mut self, bounds: Rect) -> Rect {
234234
let bounds = bounds.inset(theme::borders());
235235

236-
let (input_area, key_grid_area) =
236+
let (top_area, key_grid_area) =
237237
bounds.split_bottom(4 * theme::PIN_BUTTON_HEIGHT + 3 * theme::BUTTON_SPACING);
238238

239-
let (input_area, scroll_area) = input_area.split_bottom(INPUT_AREA_HEIGHT);
239+
let (input_area, scroll_area) = top_area.split_bottom(INPUT_AREA_HEIGHT);
240240
let (scroll_area, _) = scroll_area.split_top(ScrollBar::DOT_SIZE);
241241

242242
let key_grid = Grid::new(key_grid_area, 4, 3).with_spacing(theme::BUTTON_SPACING);
243243
let confirm_btn_area = key_grid.cell(11);
244244
let back_btn_area = key_grid.cell(9);
245245

246-
self.page_swipe.place(bounds);
246+
self.page_swipe.place(key_grid_area);
247247
self.input.place(input_area);
248+
self.input.inner().reveal_area.set(top_area);
248249
self.confirm.place(confirm_btn_area);
249250
self.back.place(back_btn_area);
250251
self.scrollbar.place(scroll_area);
@@ -288,7 +289,6 @@ impl Component for PassphraseKeyboard {
288289
return None;
289290
}
290291

291-
// Handle input touch events (reveal/hide passphrase)
292292
self.input.event(ctx, event);
293293

294294
// When passphrase is shown in full, disable all keypad interaction
@@ -395,6 +395,9 @@ struct Input {
395395
display_style: DisplayStyle,
396396
last_char_timer: Timer,
397397
pad: Pad,
398+
/// Area in which a touch start triggers the passphrase reveal
399+
reveal_area: Cell<Rect>,
400+
/// Area in which the passphrase reveal window appears
398401
shown_area: Rect,
399402
}
400403

@@ -408,6 +411,7 @@ impl Input {
408411
fn new(max_len: usize) -> Self {
409412
Self {
410413
area: Rect::zero(),
414+
reveal_area: Cell::new(Rect::zero()),
411415
textbox: TextBox::empty(max_len),
412416
multi_tap: MultiTapKeyboard::new(),
413417
display_style: DisplayStyle::Hidden,
@@ -524,6 +528,7 @@ impl Component for Input {
524528
fn place(&mut self, bounds: Rect) -> Rect {
525529
self.pad.place(bounds);
526530
self.area = bounds;
531+
self.reveal_area.set(bounds);
527532
self.area
528533
}
529534

@@ -533,8 +538,8 @@ impl Component for Input {
533538
}
534539

535540
match event {
536-
// Reveal on touch start within the input area
537-
Event::Touch(TouchEvent::TouchStart(pos)) if self.area.contains(pos) => {
541+
// Reveal on touch start within the extended input area
542+
Event::Touch(TouchEvent::TouchStart(pos)) if self.reveal_area.get().contains(pos) => {
538543
self.multi_tap.clear_pending_state(ctx);
539544
self.last_char_timer.stop();
540545
self.display_style = DisplayStyle::Shown;

0 commit comments

Comments
 (0)