From 7404436305c35615bb04cd21e378876233d38edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Tue, 2 Jul 2024 18:43:13 +0200 Subject: [PATCH] refactor(core/ui): optimize brightness settings for Mercury --- core/.changelog.d/3969.fixed | 1 + .../generated/translated_string.rs | 4 +- .../src/ui/model_mercury/component/mod.rs | 4 - .../component/number_input_slider.rs | 33 +---- .../model_mercury/component/set_brightness.rs | 69 --------- .../rust/src/ui/model_mercury/flow/mod.rs | 2 + .../ui/model_mercury/flow/set_brightness.rs | 138 ++++++++++++++++++ .../embed/rust/src/ui/model_mercury/layout.rs | 23 +-- core/mocks/trezortranslate_keys.pyi | 2 +- core/translations/en.json | 2 +- 10 files changed, 149 insertions(+), 129 deletions(-) create mode 100644 core/.changelog.d/3969.fixed delete mode 100644 core/embed/rust/src/ui/model_mercury/component/set_brightness.rs create mode 100644 core/embed/rust/src/ui/model_mercury/flow/set_brightness.rs diff --git a/core/.changelog.d/3969.fixed b/core/.changelog.d/3969.fixed new file mode 100644 index 0000000000..3b19dbfe27 --- /dev/null +++ b/core/.changelog.d/3969.fixed @@ -0,0 +1 @@ +[T3T1] Improved screen brightness settings. diff --git a/core/embed/rust/src/translations/generated/translated_string.rs b/core/embed/rust/src/translations/generated/translated_string.rs index 1be0d1f0f0..49c9c54481 100644 --- a/core/embed/rust/src/translations/generated/translated_string.rs +++ b/core/embed/rust/src/translations/generated/translated_string.rs @@ -1330,7 +1330,7 @@ pub enum TranslatedString { words__settings = 929, // "Settings" words__try_again = 930, // "Try again." reset__slip39_checklist_num_groups_x_template = 931, // "Number of groups: {0}" - brightness__title = 932, // "Set brightness" + brightness__title = 932, // "Change display brightness" recovery__title_unlock_repeated_backup = 933, // "Multi-share backup" recovery__unlock_repeated_backup = 934, // "Create additional backup?" recovery__unlock_repeated_backup_verb = 935, // "Create backup" @@ -2673,7 +2673,7 @@ impl TranslatedString { Self::words__settings => "Settings", Self::words__try_again => "Try again.", Self::reset__slip39_checklist_num_groups_x_template => "Number of groups: {0}", - Self::brightness__title => "Set brightness", + Self::brightness__title => "Change display brightness", Self::recovery__title_unlock_repeated_backup => "Multi-share backup", Self::recovery__unlock_repeated_backup => "Create additional backup?", Self::recovery__unlock_repeated_backup_verb => "Create backup", diff --git a/core/embed/rust/src/ui/model_mercury/component/mod.rs b/core/embed/rust/src/ui/model_mercury/component/mod.rs index c20c79b654..b51299c331 100644 --- a/core/embed/rust/src/ui/model_mercury/component/mod.rs +++ b/core/embed/rust/src/ui/model_mercury/component/mod.rs @@ -27,8 +27,6 @@ mod prompt_screen; mod result; mod scroll; #[cfg(feature = "translations")] -mod set_brightness; -#[cfg(feature = "translations")] mod share_words; mod status_screen; mod swipe_content; @@ -74,8 +72,6 @@ pub use prompt_screen::PromptScreen; pub use result::{ResultFooter, ResultScreen, ResultStyle}; pub use scroll::ScrollBar; #[cfg(feature = "translations")] -pub use set_brightness::SetBrightnessDialog; -#[cfg(feature = "translations")] pub use share_words::ShareWords; pub use status_screen::StatusScreen; pub use swipe_content::{InternallySwipable, InternallySwipableContent, SwipeContent}; diff --git a/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs b/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs index 996d0ae59c..3f8b71999e 100644 --- a/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs +++ b/core/embed/rust/src/ui/model_mercury/component/number_input_slider.rs @@ -5,25 +5,21 @@ use crate::{ constant::screen, display, event::TouchEvent, - geometry::{Alignment, Grid, Insets, Point, Rect}, + geometry::{Alignment, Insets, Point, Rect}, shape::{self, Renderer}, }, }; -use super::{theme, Button, ButtonMsg}; +use super::theme; pub enum NumberInputSliderDialogMsg { Changed(u16), - Confirmed, - Cancelled, } pub struct NumberInputSliderDialog { area: Rect, text_area: Rect, input: Child, - cancel_button: Child