From 262747baa70bd750a8c9fa200cb129fd147636e6 Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Wed, 23 Oct 2024 16:45:32 +0200 Subject: [PATCH] fix(core/rust) Handle also touchStop event in brightess dialog --- core/.changelog.d/4261.fixed | 1 + .../component/number_input_slider.rs | 32 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 core/.changelog.d/4261.fixed diff --git a/core/.changelog.d/4261.fixed b/core/.changelog.d/4261.fixed new file mode 100644 index 0000000000..c06bb1a039 --- /dev/null +++ b/core/.changelog.d/4261.fixed @@ -0,0 +1 @@ +[T3T1] Add instruction to Swipe up after changing brightness. 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 2a7f36e790..3eac245f0d 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 @@ -76,24 +76,24 @@ impl Component for NumberInputSliderDialog { } fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option { - if let Some(value) = self.input.event(ctx, event) { - self.val = value; + let msg_opt = self.input.event(ctx, event); - if self.val == self.init_val || self.input.touching { - self.footer - .update_instruction(ctx, TR::instructions__swipe_horizontally); - self.footer.update_description(ctx, TR::setting__adjust); - ctx.request_paint(); - } else { - self.footer - .update_instruction(ctx, TR::instructions__swipe_up); - self.footer.update_description(ctx, TR::setting__apply); - ctx.request_paint(); - } - - return Some(Self::Msg::Changed(value)); + if self.val == self.init_val || self.input.touching { + self.footer + .update_instruction(ctx, TR::instructions__swipe_horizontally); + self.footer.update_description(ctx, TR::setting__adjust); + ctx.request_paint(); + } else { + self.footer + .update_instruction(ctx, TR::instructions__swipe_up); + self.footer.update_description(ctx, TR::setting__apply); + ctx.request_paint(); } - None + + msg_opt.map(|value| { + self.val = value; + Self::Msg::Changed(value) + }) } fn paint(&mut self) {