diff --git a/core/embed/rust/src/ui/model_tt/component/frame.rs b/core/embed/rust/src/ui/model_tt/component/frame.rs index c641f6efef..ebd5aae12e 100644 --- a/core/embed/rust/src/ui/model_tt/component/frame.rs +++ b/core/embed/rust/src/ui/model_tt/component/frame.rs @@ -3,7 +3,7 @@ use crate::ui::{ component::{ base::ComponentExt, label::Label, text::TextStyle, Child, Component, Event, EventCtx, }, - display::{self, Color, Font, Icon}, + display::Icon, geometry::{Alignment, Insets, Offset, Rect}, model_tt::component::{Button, ButtonMsg, CancelInfoConfirmMsg}, }; @@ -196,89 +196,3 @@ where } } } - -pub struct NotificationFrame<T, U> { - area: Rect, - title: U, - content: Child<T>, -} - -impl<T, U> NotificationFrame<T, U> -where - T: Component, - U: AsRef<str>, -{ - const HEIGHT: i16 = 36; - const COLOR: Color = theme::YELLOW; - const BORDER: i16 = 6; - - pub fn new(title: U, content: T) -> Self { - Self { - title, - area: Rect::zero(), - content: Child::new(content), - } - } - - pub fn inner(&self) -> &T { - self.content.inner() - } - - pub fn paint_notification(area: Rect, title: &str, color: Color) { - let (area, _) = area - .inset(Insets::uniform(Self::BORDER)) - .split_top(Self::HEIGHT); - let font = Font::BOLD; - display::rect_fill_rounded(area, color, theme::BG, 2); - display::text_center( - area.center() + Offset::y((font.text_max_height() - font.text_baseline()) / 2), - title, - font, - theme::FG, - color, - ); - } -} - -impl<T, U> Component for NotificationFrame<T, U> -where - T: Component, - U: AsRef<str>, -{ - type Msg = T::Msg; - - fn place(&mut self, bounds: Rect) -> Rect { - let content_area = bounds.inset(theme::borders_notification()); - self.area = bounds; - self.content.place(content_area); - bounds - } - - fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> { - self.content.event(ctx, event) - } - - fn paint(&mut self) { - Self::paint_notification(self.area, self.title.as_ref(), Self::COLOR); - self.content.paint(); - } - - #[cfg(feature = "ui_bounds")] - fn bounds(&self, sink: &mut dyn FnMut(Rect)) { - sink(self.area); - self.content.bounds(sink); - } -} - -#[cfg(feature = "ui_debug")] -impl<T, U> crate::trace::Trace for NotificationFrame<T, U> -where - T: crate::trace::Trace, - U: AsRef<str>, -{ - fn trace(&self, t: &mut dyn crate::trace::Tracer) { - t.component("NotificationFrame"); - t.string("title", self.title.as_ref()); - t.child("content", &self.content); - } -} diff --git a/core/embed/rust/src/ui/model_tt/component/mod.rs b/core/embed/rust/src/ui/model_tt/component/mod.rs index cccd165a12..21894eface 100644 --- a/core/embed/rust/src/ui/model_tt/component/mod.rs +++ b/core/embed/rust/src/ui/model_tt/component/mod.rs @@ -30,7 +30,7 @@ pub use coinjoin_progress::CoinJoinProgress; pub use dialog::{Dialog, DialogMsg, IconDialog}; pub use error::ErrorScreen; pub use fido::{FidoConfirm, FidoMsg}; -pub use frame::{Frame, FrameMsg, NotificationFrame}; +pub use frame::{Frame, FrameMsg}; pub use hold_to_confirm::{HoldToConfirm, HoldToConfirmMsg}; #[cfg(feature = "dma2d")] pub use homescreen::{Homescreen, HomescreenMsg, Lockscreen}; diff --git a/core/embed/rust/src/ui/model_tt/layout.rs b/core/embed/rust/src/ui/model_tt/layout.rs index 0610285248..e4b038f699 100644 --- a/core/embed/rust/src/ui/model_tt/layout.rs +++ b/core/embed/rust/src/ui/model_tt/layout.rs @@ -51,9 +51,9 @@ use super::{ CancelInfoConfirmMsg, CoinJoinProgress, Dialog, DialogMsg, FidoConfirm, FidoMsg, Frame, FrameMsg, HoldToConfirm, HoldToConfirmMsg, Homescreen, HomescreenMsg, HorizontalPage, IconDialog, Lockscreen, MnemonicInput, MnemonicKeyboard, MnemonicKeyboardMsg, - NotificationFrame, NumberInputDialog, NumberInputDialogMsg, PassphraseKeyboard, - PassphraseKeyboardMsg, PinKeyboard, PinKeyboardMsg, Progress, SelectWordCount, - SelectWordCountMsg, SelectWordMsg, Slip39Input, SwipeHoldPage, SwipePage, WelcomeScreen, + NumberInputDialog, NumberInputDialogMsg, PassphraseKeyboard, PassphraseKeyboardMsg, + PinKeyboard, PinKeyboardMsg, Progress, SelectWordCount, SelectWordCountMsg, SelectWordMsg, + Slip39Input, SwipeHoldPage, SwipePage, WelcomeScreen, }, constant, theme, }; @@ -208,16 +208,6 @@ where } } -impl<T, U> ComponentMsgObj for NotificationFrame<T, U> -where - T: ComponentMsgObj, - U: AsRef<str>, -{ - fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> { - self.inner().msg_try_into_obj(msg) - } -} - impl<T, U> ComponentMsgObj for SwipePage<T, U> where T: Component + Paginate,