From b0dd1544b1cd816969ea8219d98c70e8883ca22e Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Thu, 6 Apr 2023 12:47:04 +0200 Subject: [PATCH] TEST: Homescreen notification --- .../ui/model_tt/component/homescreen/mod.rs | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs b/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs index 9366b8d7d3..28ea17aa3c 100644 --- a/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs +++ b/core/embed/rust/src/ui/model_tt/component/homescreen/mod.rs @@ -2,7 +2,10 @@ mod render; use crate::{ time::{Duration, Instant}, - trezorhal::{ble::start_advertising, usb::usb_configured}, + trezorhal::{ + ble::{ble_connected, start_advertising}, + usb::usb_configured, + }, ui::{ component::{Component, Event, EventCtx, Pad, TimerToken}, display::{self, tjpgd::jpeg_info, toif::Icon, Color, Font}, @@ -21,10 +24,10 @@ use crate::{ tjpgd::{jpeg_test, BufferInput}, toif::Toif, }, - display::{tjpgd::BufferInput, toif::Toif}, event::{ButtonEvent, PhysicalButton}, - model_tt::component::homescreen::render::{ - HomescreenJpeg, HomescreenToif, HOMESCREEN_TOIF_SIZE, + model_tt::{ + component::homescreen::render::{HomescreenJpeg, HomescreenToif, HOMESCREEN_TOIF_SIZE}, + theme::{BLUE, ICON_MAGIC}, }, }, }; @@ -86,13 +89,19 @@ where } fn get_notification(&self) -> Option { - if !usb_configured() { + if !usb_configured() && !ble_connected() { let (color, icon) = Self::level_to_style(0); Some(HomescreenNotification { - text: "NO USB CONNECTION", + text: "NO CONNECTION", icon, color, }) + } else if ble_connected() { + Some(HomescreenNotification { + text: "BLE CONNECTED", + icon: ICON_MAGIC, + color: BLUE, + }) } else if let Some((notification, level)) = &self.notification { let (color, icon) = Self::level_to_style(*level); Some(HomescreenNotification { @@ -188,7 +197,7 @@ where Self::event_usb(self, ctx, event); if self.hold_to_lock { if Self::event_hold(self, ctx, event) { - return Some(HomescreenMsg::Dismissed) + return Some(HomescreenMsg::Dismissed); } } @@ -199,7 +208,6 @@ where } else { None } - } fn paint(&mut self) {