From 018330f3c21d7e2b6a50c42b5b8c29f87ac25f02 Mon Sep 17 00:00:00 2001 From: obrusvit Date: Fri, 6 Jun 2025 19:45:16 +0200 Subject: [PATCH] chore(eckhart): remove hold to lock animation - hold to lock animation will not be used on the Homescreen - the locking functionality is kept for debug purposes and is increased to 3 seconds [no changelog] --- .../ui/layout_eckhart/firmware/homescreen.rs | 58 +++---------------- .../flow/confirm_value_intro.rs | 2 +- .../src/ui/layout_eckhart/theme/firmware.rs | 1 - tests/click_tests/test_lock.py | 2 +- 4 files changed, 9 insertions(+), 54 deletions(-) diff --git a/core/embed/rust/src/ui/layout_eckhart/firmware/homescreen.rs b/core/embed/rust/src/ui/layout_eckhart/firmware/homescreen.rs index 9da440f904..7407f01f95 100644 --- a/core/embed/rust/src/ui/layout_eckhart/firmware/homescreen.rs +++ b/core/embed/rust/src/ui/layout_eckhart/firmware/homescreen.rs @@ -2,6 +2,7 @@ use crate::{ error::Error, io::BinaryData, strutil::TString, + time::Duration, translations::TR, ui::{ component::{text::TextStyle, Component, Event, EventCtx, Label, Never}, @@ -10,7 +11,6 @@ use crate::{ layout::util::get_user_custom_image, lerp::Lerp, shape::{self, Renderer}, - util::animation_disabled, }, }; @@ -21,9 +21,11 @@ use super::{ }, constant::{HEIGHT, SCREEN, WIDTH}, theme::{self, firmware::button_homebar_style, TILES_GRID}, - ActionBar, ActionBarMsg, Hint, HoldToConfirmAnim, + ActionBar, ActionBarMsg, Hint, }; +const LOCK_HOLD_DURATION: Duration = Duration::from_millis(3000); + /// Full-screen component for the homescreen and lockscreen. pub struct Homescreen { /// Device name with shadow @@ -42,8 +44,6 @@ pub struct Homescreen { locked: bool, /// Hold to lock button placed everywhere except the `action_bar` virtual_locking_button: Button, - /// Hold to lock animation - htc_anim: Option, } pub enum HomescreenMsg { @@ -104,19 +104,6 @@ impl Homescreen { Button::with_homebar_content(None).styled(button_style) }; - let lock_duration = theme::LOCK_HOLD_DURATION; - - // Locking animation - let htc_anim = if lockable && !animation_disabled() { - Some( - HoldToConfirmAnim::new() - .with_color(theme::GREY_LIGHT) - .with_duration(lock_duration), - ) - } else { - None - }; - Ok(Self { label: HomeLabel::new(label, shadow), hint, @@ -125,43 +112,13 @@ impl Homescreen { led_color, lockable, locked, - virtual_locking_button: Button::empty().with_long_press(lock_duration), - htc_anim, + virtual_locking_button: Button::empty().with_long_press(LOCK_HOLD_DURATION), }) } fn event_hold(&mut self, ctx: &mut EventCtx, event: Event) -> bool { - self.htc_anim.event(ctx, event); - if let Some(msg) = self.virtual_locking_button.event(ctx, event) { - match msg { - ButtonMsg::Pressed => { - if let Some(htc_anim) = &mut self.htc_anim { - htc_anim.start(); - ctx.request_anim_frame(); - ctx.request_paint(); - ctx.disable_swipe(); - } - } - ButtonMsg::Clicked => { - if let Some(htc_anim) = &mut self.htc_anim { - htc_anim.stop(); - ctx.request_anim_frame(); - ctx.request_paint(); - ctx.enable_swipe(); - } - } - ButtonMsg::Released => { - if let Some(htc_anim) = &mut self.htc_anim { - htc_anim.stop(); - ctx.request_anim_frame(); - ctx.request_paint(); - ctx.enable_swipe(); - } - } - ButtonMsg::LongPressed => { - return true; - } - } + if let Some(ButtonMsg::LongPressed) = self.virtual_locking_button.event(ctx, event) { + return true; } false } @@ -221,7 +178,6 @@ impl Component for Homescreen { self.label.render(target); self.hint.render(target); self.action_bar.render(target); - self.htc_anim.render(target); } } diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_value_intro.rs b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_value_intro.rs index 760f5442a6..64205ad03a 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_value_intro.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_value_intro.rs @@ -76,7 +76,7 @@ pub fn new_confirm_value_intro( confirm_button_label.unwrap_or(TR::sign_message__confirm_without_review.into()), ); if hold { - confirm_button = confirm_button.with_long_press(theme::LOCK_HOLD_DURATION); + confirm_button = confirm_button.with_long_press(theme::CONFIRM_HOLD_DURATION); } let value = if value != Obj::const_none() { diff --git a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs index fe6503729b..8360cabb75 100644 --- a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs @@ -14,7 +14,6 @@ use super::{ *, }; -pub const LOCK_HOLD_DURATION: Duration = Duration::from_millis(1500); pub const CONFIRM_HOLD_DURATION: Duration = Duration::from_millis(1500); pub const ERASE_HOLD_DURATION: Duration = Duration::from_millis(1500); diff --git a/tests/click_tests/test_lock.py b/tests/click_tests/test_lock.py index b160062724..0f8eae2751 100644 --- a/tests/click_tests/test_lock.py +++ b/tests/click_tests/test_lock.py @@ -49,7 +49,7 @@ def test_hold_to_lock(device_handler: "BackgroundDeviceHandler"): models.T3B1: 1200, models.T2T1: 3500, models.T3T1: 3500, - models.T3W1: 2000, + models.T3W1: 3500, }[debug.model] def hold(duration: int) -> None: