From 1e260f797b502680aeffc041e5366a323716f4fd Mon Sep 17 00:00:00 2001 From: Panagiotis Karelis Date: Sun, 19 Oct 2025 22:24:42 +0300 Subject: [PATCH 1/4] remove unused events --- ui/src/engine/diamond.rs | 91 ------------------------------ ui/src/engine/mod.rs | 10 ---- ui/src/engine/pearl/self_serve.rs | 93 ------------------------------- 3 files changed, 194 deletions(-) diff --git a/ui/src/engine/diamond.rs b/ui/src/engine/diamond.rs index 72bce29f..a68be68f 100644 --- a/ui/src/engine/diamond.rs +++ b/ui/src/engine/diamond.rs @@ -694,97 +694,6 @@ impl EventHandler for Runner { } } } - Event::BiometricCaptureFakeProgressStart { - timeout, - min_fast_forward_duration, - max_fast_forward_duration, - } => { - self.set_center( - LEVEL_FOREGROUND, - animations::Static::::new( - Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, - None, - ), - ); - self.set_ring( - LEVEL_NOTICE, - animations::fake_progress_v2::FakeProgress::::new( - Argb::DIAMOND_RING_BIOMETRIC_CAPTURE_PROGRESS, - *timeout, - *min_fast_forward_duration, - *max_fast_forward_duration, - ), - ); - } - Event::BiometricCaputreSuccessAndFastForwardFakeProgress => { - let ring_completion_time = self - .ring_animations_stack - .stack - .get_mut(&LEVEL_NOTICE) - .and_then(|RunningAnimation { animation, .. }| { - animation - .as_any_mut() - .downcast_mut::>() - }) - .map(|fake_progress| fake_progress.set_completed()) - .unwrap_or_default() - .as_secs_f64(); - - let mut total_duration = 0.0; - while let Some(melody) = self.capture_sound.peekable().peek() { - let melody = sound::Type::Melody(*melody); - let melody_duration = - self.sound.get_duration(melody).unwrap().as_secs_f64(); - if total_duration + melody_duration < ring_completion_time { - self.sound.queue(melody, Duration::ZERO)?; - self.capture_sound.next(); - total_duration += melody_duration; - } else { - break; - } - } - - // Sync biometric capture success animation + sounds, with the fake progress. - // Since the ring is ON after the fake progress, we turn it off smoothly in `fade_out_duration`, - // and then we do a double blink after `success_delay`. - let fade_out_duration = 0.3; - let success_delay = 0.4; - self.sound.queue( - sound::Type::Melody(sound::Melody::IrisScanSuccess), - Duration::from_millis( - ((ring_completion_time + fade_out_duration + success_delay) - * 1000.0) as u64, - ), - )?; - self.set_center( - LEVEL_FOREGROUND, - animations::alert_v2::Alert::::new( - Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, - SquarePulseTrain::from(vec![ - (0.0, 0.0), - (fade_out_duration + success_delay + 1.1, 3.4), - ]), - )? - .with_delay(ring_completion_time), - ); - self.set_ring( - LEVEL_FOREGROUND, - animations::alert_v2::Alert::::new( - Argb::DIAMOND_RING_BIOMETRIC_CAPTURE_SUCCESS, - SquarePulseTrain::from(vec![ - (0.0, 0.0), - (0.0, fade_out_duration), - (fade_out_duration + success_delay, 0.1), - (fade_out_duration + success_delay + 0.5, 0.1), - (fade_out_duration + success_delay + 1.0, 0.1), - (fade_out_duration + success_delay + 1.1, 3.5), - ]), - )? - .with_delay(ring_completion_time), - ); - } Event::BiometricCaptureProgressWithNotch { progress } => { // set progress but wait for wave to finish breathing let breathing = self diff --git a/ui/src/engine/mod.rs b/ui/src/engine/mod.rs index 34df4caa..cba4fee6 100644 --- a/ui/src/engine/mod.rs +++ b/ui/src/engine/mod.rs @@ -275,13 +275,6 @@ event_enum! { BiometricCaptureProgress { progress: f64, }, - /// Biometric capture start fake progress. - #[event_enum(method = biometric_capture_fake_progress_start)] - BiometricCaptureFakeProgressStart { - timeout: Duration, - min_fast_forward_duration: Duration, - max_fast_forward_duration: Duration, - }, /// Biometric flow start. #[event_enum(method = biometric_flow_start)] BiometricFlowStart { @@ -297,9 +290,6 @@ event_enum! { BiometricFlowResult { is_success: bool, }, - /// Biometric capture has finished successfully, command fake-progress to fast-forward - #[event_enum(method = biometric_capture_success_and_fast_forward_fake_progress)] - BiometricCaputreSuccessAndFastForwardFakeProgress, #[event_enum(method = biometric_capture_progress_with_notch)] BiometricCaptureProgressWithNotch { progress: f64, diff --git a/ui/src/engine/pearl/self_serve.rs b/ui/src/engine/pearl/self_serve.rs index 6a485b03..4b91545a 100644 --- a/ui/src/engine/pearl/self_serve.rs +++ b/ui/src/engine/pearl/self_serve.rs @@ -385,21 +385,6 @@ impl Runner { } } } - Event::BiometricCaptureFakeProgressStart { - timeout, - min_fast_forward_duration, - max_fast_forward_duration, - } => { - self.set_ring( - LEVEL_NOTICE, - animations::fake_progress_v2::FakeProgress::::new( - Argb::PEARL_RING_USER_CAPTURE, - *timeout, - *min_fast_forward_duration, - *max_fast_forward_duration, - ), - ); - } Event::BiometricFlowStart { timeout, min_fast_forward_duration, @@ -488,84 +473,6 @@ impl Runner { } } - Event::BiometricCaputreSuccessAndFastForwardFakeProgress => { - let ring_completion_time = self - .ring_animations_stack - .stack - .get_mut(&LEVEL_NOTICE) - .and_then(|RunningAnimation { animation, .. }| { - animation - .as_any_mut() - .downcast_mut::>() - }) - .map(|fake_progress| fake_progress.set_completed()) - .unwrap_or_default() - .as_secs_f64(); - - let mut total_duration = 0.0; - while let Some(melody) = self.capture_sound.peekable().peek() { - let melody = sound::Type::Melody(*melody); - let melody_duration = - self.sound.get_duration(melody).unwrap().as_secs_f64(); - if total_duration + melody_duration < ring_completion_time { - self.sound.queue(melody, Duration::ZERO)?; - self.capture_sound.next(); - total_duration += melody_duration; - } else { - break; - } - } - // Sync biometric capture success animation + sounds, with the fake progress. - // Since the ring is ON after the fake progress, we turn it off smoothly in `fade_out_duration`, - // and then we do a double blink after `success_delay`. - let fade_out_duration = 0.3; - let success_delay = 0.4; - self.sound.queue( - sound::Type::Melody(sound::Melody::IrisScanSuccess), - Duration::from_millis( - ((ring_completion_time + fade_out_duration + success_delay) - * 1000.0) as u64, - ), - )?; - self.stop_center( - LEVEL_FOREGROUND, - Transition::FadeOut(ring_completion_time), - ); - // in case nothing is running on center, make sure we set the background to off - self.set_center( - LEVEL_BACKGROUND, - animations::Static::::new(Argb::OFF, None), - ); - self.set_center( - LEVEL_FOREGROUND, - animations::alert_v2::Alert::::new( - Argb::PEARL_CENTER_CAPTURE_SUCCESS, - SquarePulseTrain::from(vec![ - (fade_out_duration + success_delay, 1.1), - (fade_out_duration + success_delay + 1.1, 3.4), - ]), - )? - .with_delay(ring_completion_time), - ); - self.set_ring( - LEVEL_FOREGROUND, - animations::alert_v2::Alert::::new( - Argb::PEARL_RING_CAPTURE_SUCCESS, - SquarePulseTrain::from(vec![ - (0.0, 0.0), - (0.0, fade_out_duration), - (fade_out_duration + success_delay, 0.1), - (fade_out_duration + success_delay + 0.5, 0.1), - (fade_out_duration + success_delay + 1.0, 0.1), - (fade_out_duration + success_delay + 1.1, 3.5), - ]), - )? - .with_delay(ring_completion_time), - ); - self.operator_signup_phase.iris_scan_complete(); - } Event::BiometricCaptureProgressWithNotch { progress } => { // set progress but wait for wave to finish breathing let breathing = self From 5c3d84ec9ff88fb9bc922ab34b160ca3c6ae0604 Mon Sep 17 00:00:00 2001 From: Panagiotis Karelis Date: Sun, 19 Oct 2025 23:44:28 +0300 Subject: [PATCH 2/4] preflight check error notification --- ui/src/engine/mod.rs | 5 +++++ ui/src/engine/pearl/self_serve.rs | 32 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/ui/src/engine/mod.rs b/ui/src/engine/mod.rs index cba4fee6..af899904 100644 --- a/ui/src/engine/mod.rs +++ b/ui/src/engine/mod.rs @@ -290,6 +290,11 @@ event_enum! { BiometricFlowResult { is_success: bool, }, + /// Preflight check error notification. + #[event_enum(method = preflight_check_error_notification)] + PreflightCheckErrorNotification { + set: bool, + }, #[event_enum(method = biometric_capture_progress_with_notch)] BiometricCaptureProgressWithNotch { progress: f64, diff --git a/ui/src/engine/pearl/self_serve.rs b/ui/src/engine/pearl/self_serve.rs index 4b91545a..8ba4e3d3 100644 --- a/ui/src/engine/pearl/self_serve.rs +++ b/ui/src/engine/pearl/self_serve.rs @@ -405,6 +405,7 @@ impl Runner { ); self.stop_ring(LEVEL_FOREGROUND, Transition::ForceStop); self.stop_ring(LEVEL_BACKGROUND, Transition::ForceStop); + self.set_center(LEVEL_NOTICE, animations::Static::new(Argb::OFF, None)); } Event::BiometricFlowProgressFastForward => { if let Some(biometric_flow) = self @@ -432,6 +433,7 @@ impl Runner { } } } + self.stop_center(LEVEL_NOTICE, Transition::FadeOut(0.5)); } Event::BiometricFlowResult { is_success } => { if let Some(biometric_flow) = self @@ -473,6 +475,36 @@ impl Runner { } } + Event::PreflightCheckErrorNotification { set } => { + if let Some(animation) = self + .center_animations_stack + .stack + .get_mut(&LEVEL_NOTICE) + .and_then(|RunningAnimation { animation, .. }| { + animation + .as_any_mut() + .downcast_mut::>( + ) + }) + { + let is_on = animation.color() != Argb::OFF; + if is_on && !*set { + self.set_center( + LEVEL_NOTICE, + animations::Static::new(Argb::OFF, None).fade_in(0.5), + ); + } else if !is_on && *set { + self.set_center( + LEVEL_NOTICE, + animations::Static::new( + Argb::PEARL_RING_ERROR_SALMON, + None, + ) + .fade_in(0.5), + ); + } + } + } Event::BiometricCaptureProgressWithNotch { progress } => { // set progress but wait for wave to finish breathing let breathing = self From 8baf994c952a75990c99a75aeaf2e4c9dbf36c5b Mon Sep 17 00:00:00 2001 From: Panagiotis Karelis Date: Mon, 20 Oct 2025 13:14:23 +0300 Subject: [PATCH 3/4] diamond: preflight check error notification --- ui/rgb/src/lib.rs | 2 ++ ui/src/engine/diamond.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/ui/rgb/src/lib.rs b/ui/rgb/src/lib.rs index ef12574e..00b11add 100644 --- a/ui/rgb/src/lib.rs +++ b/ui/rgb/src/lib.rs @@ -136,6 +136,8 @@ impl Argb { pub const DIAMOND_CONE_AMBER: Argb = Argb(Some(Self::DIMMING_MAX_VALUE), 25, 18, 1); /// Error color for outer ring pub const DIAMOND_RING_ERROR_SALMON: Argb = Argb(Some(8), 127, 20, 0); + /// Error color for inner ring (shroud) + pub const DIAMOND_CENTER_ERROR_SALMON: Argb = Argb(Some(6), 127, 20, 0); /// QR Phase colors - diamond pub const DIAMOND_CENTER_WIFI_QR_SCAN: Argb = Self::DIAMOND_CENTER_USER_QR_SCAN; diff --git a/ui/src/engine/diamond.rs b/ui/src/engine/diamond.rs index a68be68f..01b79676 100644 --- a/ui/src/engine/diamond.rs +++ b/ui/src/engine/diamond.rs @@ -843,6 +843,8 @@ impl EventHandler for Runner { } } } + // clears any stale state from PreflightCheckErrorNotification + self.set_center(LEVEL_NOTICE, animations::Static::new(Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, None).fade_in(0.5)); } Event::BiometricFlowResult { is_success } => { if let Some(biometric_flow) = self @@ -884,6 +886,36 @@ impl EventHandler for Runner { } } + Event::PreflightCheckErrorNotification { set } => { + if let Some(animation) = self + .center_animations_stack + .stack + .get_mut(&LEVEL_NOTICE) + .and_then(|RunningAnimation { animation, .. }| { + animation + .as_any_mut() + .downcast_mut::>( + ) + }) + { + let is_on = animation.color() == Argb::DIAMOND_CENTER_ERROR_SALMON; + if is_on && !*set { + self.set_center( + LEVEL_NOTICE, + animations::Static::new(Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, None).fade_in(0.5), + ); + } else if !is_on && *set { + self.set_center( + LEVEL_NOTICE, + animations::Static::new( + Argb::DIAMOND_CENTER_ERROR_SALMON, + None, + ) + .fade_in(0.5), + ); + } + } + } Event::BiometricCaptureSuccess => { self.biometric_capture_success()?; } From 10327cc86297b122fe9c274b9cc976499ac9ac3c Mon Sep 17 00:00:00 2001 From: Anastasios Andronidis Date: Tue, 21 Oct 2025 23:38:34 -0700 Subject: [PATCH 4/4] tmp --- ui/rgb/src/lib.rs | 2 +- ui/src/engine/diamond.rs | 41 +++++++++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ui/rgb/src/lib.rs b/ui/rgb/src/lib.rs index 00b11add..d32ec261 100644 --- a/ui/rgb/src/lib.rs +++ b/ui/rgb/src/lib.rs @@ -137,7 +137,7 @@ impl Argb { /// Error color for outer ring pub const DIAMOND_RING_ERROR_SALMON: Argb = Argb(Some(8), 127, 20, 0); /// Error color for inner ring (shroud) - pub const DIAMOND_CENTER_ERROR_SALMON: Argb = Argb(Some(6), 127, 20, 0); + pub const DIAMOND_CENTER_ERROR_SALMON: Argb = Argb(Some(6), 255, 20, 0); /// QR Phase colors - diamond pub const DIAMOND_CENTER_WIFI_QR_SCAN: Argb = Self::DIAMOND_CENTER_USER_QR_SCAN; diff --git a/ui/src/engine/diamond.rs b/ui/src/engine/diamond.rs index 01b79676..59813c9f 100644 --- a/ui/src/engine/diamond.rs +++ b/ui/src/engine/diamond.rs @@ -844,7 +844,14 @@ impl EventHandler for Runner { } } // clears any stale state from PreflightCheckErrorNotification - self.set_center(LEVEL_NOTICE, animations::Static::new(Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, None).fade_in(0.5)); + self.set_center( + LEVEL_NOTICE, + animations::Static::new( + Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, + None, + ) + .fade_in(0.5), + ); } Event::BiometricFlowResult { is_success } => { if let Some(biometric_flow) = self @@ -887,24 +894,29 @@ impl EventHandler for Runner { } } Event::PreflightCheckErrorNotification { set } => { - if let Some(animation) = self + if self .center_animations_stack .stack .get_mut(&LEVEL_NOTICE) .and_then(|RunningAnimation { animation, .. }| { animation - .as_any_mut() - .downcast_mut::>( - ) + .as_any_mut() + .downcast_mut::>() }) + .is_some() { - let is_on = animation.color() == Argb::DIAMOND_CENTER_ERROR_SALMON; - if is_on && !*set { + if !*set { self.set_center( LEVEL_NOTICE, - animations::Static::new(Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, None).fade_in(0.5), + animations::Static::new( + Argb::DIAMOND_CENTER_BIOMETRIC_CAPTURE_PROGRESS, + None, + ) + .fade_in(0.5), ); - } else if !is_on && *set { + } else if *set { self.set_center( LEVEL_NOTICE, animations::Static::new( @@ -914,6 +926,17 @@ impl EventHandler for Runner { .fade_in(0.5), ); } + } else { + if *set { + self.set_center( + LEVEL_NOTICE, + animations::sine_blend::SineBlend::::new( + Argb::DIAMOND_CENTER_USER_QR_SCAN_SUCCESS_BREATHING_LOW, + Argb::DIAMOND_CENTER_ERROR_SALMON, + 2.0, + 0.0, + )); + } } } Event::BiometricCaptureSuccess => {