From 647622b7688eac5736aae987b677aadd147090c9 Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Thu, 20 Mar 2025 10:50:41 +0100 Subject: [PATCH] chore(eckhart): add missing button requests --- .../ui/layout_eckhart/flow/confirm_reset.rs | 18 +++++++++++++----- .../src/ui/layout_eckhart/flow/get_address.rs | 10 ++++++---- .../ui/layout_eckhart/flow/show_share_words.rs | 8 ++++++-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs index 55857af9d0..33f263fc9a 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs @@ -2,7 +2,8 @@ use crate::{ error, translations::TR, ui::{ - component::{text::op::OpTextLayout, ComponentExt, FormattedText}, + button_request::ButtonRequestCode, + component::{text::op::OpTextLayout, ButtonRequestExt, ComponentExt, FormattedText}, flow::{ base::{Decision, DecisionBuilder as _}, FlowController, FlowMsg, SwipeFlow, @@ -48,10 +49,16 @@ impl FlowController for ConfirmReset { } pub fn new_confirm_reset(recovery: bool) -> Result { - let title = if recovery { - TR::recovery__title_recover.into() + let (title, br) = if recovery { + ( + TR::recovery__title_recover.into(), + ButtonRequestCode::ProtectCall.with_name("recover_device"), + ) } else { - TR::reset__title_create_wallet.into() + ( + TR::reset__title_create_wallet.into(), + ButtonRequestCode::ResetDevice.with_name("setup_device"), + ) }; let op = OpTextLayout::new(theme::TEXT_REGULAR) @@ -73,7 +80,8 @@ pub fn new_confirm_reset(recovery: bool) -> Result { TextScreenMsg::Menu => Some(FlowMsg::Info), TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), _ => None, - }); + }) + .one_button_request(br); let content_menu = VerticalMenuScreen::new( VerticalMenu::empty().item( diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/get_address.rs b/core/embed/rust/src/ui/layout_eckhart/flow/get_address.rs index 8c4edad363..81e8647af7 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/get_address.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/get_address.rs @@ -4,9 +4,10 @@ use crate::{ strutil::TString, translations::TR, ui::{ + button_request::ButtonRequest, component::{ text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt}, - ComponentExt, Qr, + ButtonRequestExt, ComponentExt, Qr, }, flow::{ base::{Decision, DecisionBuilder as _}, @@ -81,8 +82,8 @@ pub fn new_get_address( path: Option>, _xpubs: Obj, // TODO: get rid of Obj title_success: TString<'static>, - _br_code: u16, - _br_name: TString<'static>, + br_code: u16, + br_name: TString<'static>, ) -> Result { // Address let flow_title: TString = TR::words__receive.into(); @@ -114,7 +115,8 @@ pub fn new_get_address( TextScreenMsg::Cancelled => Some(FlowMsg::Cancelled), TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), TextScreenMsg::Menu => Some(FlowMsg::Info), - }); + }) + .one_button_request(ButtonRequest::from_num(br_code, br_name)); let content_confirmed = TextScreen::new(Paragraph::new(&theme::TEXT_REGULAR, title_success).into_paragraphs()) diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs b/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs index bac2984227..9a176c350e 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs @@ -3,9 +3,10 @@ use crate::{ strutil::TString, translations::TR, ui::{ + button_request::ButtonRequestCode, component::{ text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort}, - ComponentExt, + ButtonRequestExt, ComponentExt, }, flow::{ base::{Decision, DecisionBuilder as _}, @@ -63,6 +64,7 @@ pub fn new_show_share_words_flow( instructions_paragraphs: ParagraphVecShort<'static>, text_confirm: TString<'static>, ) -> Result { + let nwords = words.len(); let instruction = TextScreen::new( instructions_paragraphs .into_paragraphs() @@ -76,7 +78,9 @@ pub fn new_show_share_words_flow( TextScreenMsg::Cancelled => Some(FlowMsg::Cancelled), TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), _ => Some(FlowMsg::Cancelled), - }); + }) + .one_button_request(ButtonRequestCode::ResetDevice.with_name("share_words")) + .with_pages(move |_| nwords + 2); let share_words = ShareWordsScreen::new(words).map(|msg| match msg { ShareWordsScreenMsg::Cancelled => Some(FlowMsg::Cancelled),