From cb66277dc1fcfd170a1dcaf3cd4b099c419f9299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Wed, 15 Jan 2025 15:58:44 +0100 Subject: [PATCH] fix(core): disallow canceling on uncancelable pages --- core/.changelog.d/4500.fixed | 1 + .../src/ui/layout_samson/component/button_controller.rs | 6 +++++- core/embed/rust/src/ui/layout_samson/component/page.rs | 8 ++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 core/.changelog.d/4500.fixed diff --git a/core/.changelog.d/4500.fixed b/core/.changelog.d/4500.fixed new file mode 100644 index 00000000000..bfd7224b1f2 --- /dev/null +++ b/core/.changelog.d/4500.fixed @@ -0,0 +1 @@ +[T3B1] Fix backup failing if middle button is pressed during confirmation. diff --git a/core/embed/rust/src/ui/layout_samson/component/button_controller.rs b/core/embed/rust/src/ui/layout_samson/component/button_controller.rs index ed7d4ebca89..4d3463c980e 100644 --- a/core/embed/rust/src/ui/layout_samson/component/button_controller.rs +++ b/core/embed/rust/src/ui/layout_samson/component/button_controller.rs @@ -489,7 +489,11 @@ impl Component for ButtonController { } else { ( ButtonState::OneReleased(b), - Some(ButtonControllerMsg::Triggered(b.into(), false)), + match b { + PhysicalButton::Left => self.left_btn.maybe_trigger(ctx), + PhysicalButton::Right => self.right_btn.maybe_trigger(ctx), + _ => None, + }, ) } } diff --git a/core/embed/rust/src/ui/layout_samson/component/page.rs b/core/embed/rust/src/ui/layout_samson/component/page.rs index 7961bbb4de3..43ddc4f3f4f 100644 --- a/core/embed/rust/src/ui/layout_samson/component/page.rs +++ b/core/embed/rust/src/ui/layout_samson/component/page.rs @@ -180,8 +180,12 @@ where self.go_to_previous_page(); self.change_page(ctx); } else { - // Clicked CANCEL. Send result. - return Some(PageMsg::Cancelled); + if self.cancel_btn_details.is_some() { + // Clicked CANCEL. Send result. + return Some(PageMsg::Cancelled); + } else { + return None; + } } } ButtonPos::Right => {