From 47a2661736a682dcf8e882a8e73d614959487599 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Wed, 29 May 2024 12:08:30 +0200 Subject: [PATCH] feat(core): respect disable animations in hold to confirm [no changelog] --- .../src/ui/model_mercury/component/hold_to_confirm.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs b/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs index fc271db6ce..6ea0b1556f 100644 --- a/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs +++ b/core/embed/rust/src/ui/model_mercury/component/hold_to_confirm.rs @@ -8,6 +8,7 @@ use crate::{ lerp::Lerp, shape, shape::Renderer, + util::animation_disabled, }, }; @@ -40,6 +41,10 @@ impl HoldToConfirmAnim { } pub fn eval(&self) -> f32 { + if animation_disabled() { + return 0.0; + } + self.timer.elapsed().to_millis() as f32 / 1000.0 } @@ -210,6 +215,11 @@ impl Component for HoldToConfirm { ctx.request_paint(); } Some(ButtonMsg::Clicked) => { + if animation_disabled() { + #[cfg(feature = "haptic")] + haptic::play(HapticEffect::HoldToConfirm); + return Some(()); + } self.anim.reset(); ctx.request_anim_frame(); ctx.request_paint();