From dd3bf253f8823fc845aa4c4a8bc2d81cd98b0a7c 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 | 4 +++- 3 files changed, 9 insertions(+), 2 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 0000000000..bfd7224b1f --- /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 ed7d4ebca8..4d3463c980 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 7961bbb4de..464a89547f 100644 --- a/core/embed/rust/src/ui/layout_samson/component/page.rs +++ b/core/embed/rust/src/ui/layout_samson/component/page.rs @@ -179,9 +179,11 @@ where // Clicked BACK. Scroll up. self.go_to_previous_page(); self.change_page(ctx); - } else { + } else if self.cancel_btn_details.is_some() { // Clicked CANCEL. Send result. return Some(PageMsg::Cancelled); + } else { + return None; } } ButtonPos::Right => {