Skip to content

Commit

Permalink
chore(core): remove some unused assets and code
Browse files Browse the repository at this point in the history
Removing model_t leftovers from mercury code.

[no changelog]
  • Loading branch information
obrusvit committed Jul 3, 2024
1 parent ff653f0 commit 4fe4bb0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 104 deletions.
62 changes: 0 additions & 62 deletions core/embed/rust/src/ui/model_mercury/component/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,65 +520,6 @@ impl Button {
}),
))
}

pub fn cancel_confirm_text(
left: Option<TString<'static>>,
right: Option<TString<'static>>,
) -> CancelConfirm<
impl Fn(ButtonMsg) -> Option<CancelConfirmMsg>,
impl Fn(ButtonMsg) -> Option<CancelConfirmMsg>,
> {
let left_is_small: bool;

let left = if let Some(verb) = left {
left_is_small = verb.len() <= 4;
if verb == "^".into() {
Button::with_icon(theme::ICON_UP)
} else {
Button::with_text(verb)
}
} else {
left_is_small = right.is_some();
Button::with_icon(theme::ICON_CANCEL)
};
let right = if let Some(verb) = right {
Button::with_text(verb).styled(theme::button_confirm())
} else {
Button::with_icon(theme::ICON_CONFIRM).styled(theme::button_confirm())
};
Self::cancel_confirm(left, right, left_is_small)
}

pub fn cancel_info_confirm(
confirm: TString<'static>,
info: TString<'static>,
) -> CancelInfoConfirm<
impl Fn(ButtonMsg) -> Option<CancelInfoConfirmMsg>,
impl Fn(ButtonMsg) -> Option<CancelInfoConfirmMsg>,
impl Fn(ButtonMsg) -> Option<CancelInfoConfirmMsg>,
> {
let right = Button::with_text(confirm)
.styled(theme::button_confirm())
.map(|msg| {
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelInfoConfirmMsg::Confirmed)
});
let top = Button::with_text(info)
.styled(theme::button_default())
.map(|msg| (matches!(msg, ButtonMsg::Clicked)).then(|| CancelInfoConfirmMsg::Info));
let left = Button::with_icon(theme::ICON_CANCEL).map(|msg| {
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelInfoConfirmMsg::Cancelled)
});
let total_height = theme::BUTTON_HEIGHT + theme::BUTTON_SPACING + theme::INFO_BUTTON_HEIGHT;
FixedHeightBar::bottom(
Split::top(
theme::INFO_BUTTON_HEIGHT,
theme::BUTTON_SPACING,
top,
Split::left(theme::BUTTON_WIDTH, theme::BUTTON_SPACING, left, right),
),
total_height,
)
}
}

#[derive(Copy, Clone)]
Expand All @@ -587,9 +528,6 @@ pub enum CancelConfirmMsg {
Confirmed,
}

type CancelInfoConfirm<F0, F1, F2> =
FixedHeightBar<Split<MsgMap<Button, F0>, Split<MsgMap<Button, F1>, MsgMap<Button, F2>>>>;

type CancelConfirm<F0, F1> = FixedHeightBar<Split<MsgMap<Button, F0>, MsgMap<Button, F1>>>;

#[derive(Clone, Copy)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl PassphraseKeyboard {
pub fn new() -> Self {
let active_layout = KeyboardLayout::LettersLower;

let confirm_btn = Button::with_icon(theme::ICON_CONFIRM)
let confirm_btn = Button::with_icon(theme::ICON_SIMPLE_CHECKMARK24)
.styled(theme::button_passphrase_confirm())
.with_radius(15)
.into_child();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl<'a> PinKeyboard<'a> {
textbox_pad: Pad::with_background(theme::label_default().background_color),
erase_btn,
cancel_btn,
confirm_btn: Button::with_icon(theme::ICON_CONFIRM)
confirm_btn: Button::with_icon(theme::ICON_SIMPLE_CHECKMARK24)
.styled(theme::button_pin_confirm())
.initially_enabled(false)
.into_child(),
Expand Down
43 changes: 3 additions & 40 deletions core/embed/rust/src/ui/model_mercury/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,13 @@ pub const ORANGE_DARK: Color = Color::rgb(0x18, 0x0C, 0x0A);
pub const ORANGE_DIMMED: Color = Color::rgb(0x9E, 0x57, 0x42);
pub const ORANGE_LIGHT: Color = Color::rgb(0xFF, 0x8D, 0x6A); // cancel button

// TODO: delete colors below when ui-t3t1 done
pub const RED: Color = Color::rgb(0xE7, 0x0E, 0x0E); // button
pub const RED_DARK: Color = Color::rgb(0xAE, 0x09, 0x09); // button pressed
pub const YELLOW: Color = Color::rgb(0xD9, 0x9E, 0x00); // button
pub const BLUE: Color = Color::rgb(0x06, 0x1E, 0xAD); // button
pub const VIOLET: Color = Color::rgb(0x95, 0x00, 0xCA);

pub const FATAL_ERROR_COLOR: Color = Color::rgb(0xE7, 0x0E, 0x0E);
pub const FATAL_ERROR_HIGHLIGHT_COLOR: Color = Color::rgb(0xFF, 0x41, 0x41);

// Commonly used corner radius (i.e. for buttons).
pub const RADIUS: u8 = 0;

// Full-size QR code.
pub const QR_SIDE_MAX: u32 = 140;

// UI icons (white color).

// 12x12
include_icon!(ICON_FORESLASH, "model_mercury/res/foreslash12.toif");

Expand Down Expand Up @@ -133,30 +122,8 @@ include_icon!(ICON_ASTERISK, "model_mercury/res/asterisk16.toif");
// Welcome screen.
include_icon!(ICON_LOGO, "model_mercury/res/lock_full.toif");

// TODO remove TT icons:

// Button icons.
include_icon!(ICON_CONFIRM, "model_tt/res/check24.toif");
include_icon!(ICON_SPACE, "model_tt/res/space.toif");
include_icon!(ICON_BACK, "model_tt/res/caret-left24.toif");
include_icon!(ICON_FORWARD, "model_tt/res/caret-right24.toif");
include_icon!(ICON_UP, "model_tt/res/caret-up24.toif");
include_icon!(ICON_DOWN, "model_tt/res/caret-down24.toif");
include_icon!(ICON_CLICK, "model_tt/res/finger24.toif");

// Homescreen notifications.
include_icon!(ICON_WARN, "model_tt/res/warning16.toif");
include_icon!(ICON_WARNING40, "model_tt/res/warning40.toif");
include_icon!(ICON_LOCK, "model_tt/res/lock16.toif");
include_icon!(ICON_LOCK_BIG, "model_tt/res/lock24.toif");
include_icon!(ICON_COINJOIN, "model_tt/res/coinjoin16.toif");
include_icon!(ICON_MAGIC, "model_tt/res/magic.toif");

// Non-square button backgrounds.
include_icon!(IMAGE_BG_BACK_BTN, "model_tt/res/bg-back40.toif");
include_icon!(IMAGE_BG_BACK_BTN_TALL, "model_tt/res/bg-back52.toif");

include_icon!(ICON_LOGO_EMPTY, "model_tt/res/lock_empty.toif");
include_icon!(ICON_WARNING40, "model_mercury/res/warning40.toif");

// Default homescreen
include_icon!(HOMESCREEN_ICON, "model_mercury/res/hs_lock.toif");
Expand Down Expand Up @@ -226,7 +193,7 @@ pub const fn label_title_sub() -> TextStyle {
}

pub const fn label_coinjoin_progress() -> TextStyle {
TextStyle::new(Font::BOLD, FG, YELLOW, FG, FG)
TextStyle::new(Font::BOLD, FG, ORANGE_DIMMED, FG, FG)
}

pub const fn button_default() -> ButtonStyleSheet {
Expand Down Expand Up @@ -702,7 +669,7 @@ pub const fn loader_default() -> LoaderStyleSheet {
pub const fn loader_lock_icon() -> LoaderStyleSheet {
LoaderStyleSheet {
active: &LoaderStyle {
icon: Some((ICON_LOCK_BIG, FG)),
icon: Some((ICON_KEY, FG)),
active: GREEN_LIGHT,
inactive: GREY_EXTRA_DARK,
background_color: BG,
Expand Down Expand Up @@ -821,10 +788,6 @@ pub const fn borders() -> Insets {
Insets::new(0, 0, 0, 0)
}

pub const fn borders_horizontal_scroll() -> Insets {
Insets::new(0, 0, 0, 0)
}

pub const fn borders_notification() -> Insets {
Insets::new(42, 0, 0, 0)
}
Expand Down

0 comments on commit 4fe4bb0

Please sign in to comment.