1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-17 13:38:46 +00:00

chore(eckhart): add missing button requests

This commit is contained in:
Lukas Bielesch 2025-03-20 10:50:41 +01:00 committed by obrusvit
parent d96ed728eb
commit 887d1be650
3 changed files with 25 additions and 11 deletions

View File

@ -2,7 +2,8 @@ use crate::{
error, error,
translations::TR, translations::TR,
ui::{ ui::{
component::{text::op::OpTextLayout, ComponentExt, FormattedText}, button_request::ButtonRequestCode,
component::{text::op::OpTextLayout, ButtonRequestExt, ComponentExt, FormattedText},
flow::{ flow::{
base::{Decision, DecisionBuilder as _}, base::{Decision, DecisionBuilder as _},
FlowController, FlowMsg, SwipeFlow, FlowController, FlowMsg, SwipeFlow,
@ -48,10 +49,16 @@ impl FlowController for ConfirmReset {
} }
pub fn new_confirm_reset(recovery: bool) -> Result<SwipeFlow, error::Error> { pub fn new_confirm_reset(recovery: bool) -> Result<SwipeFlow, error::Error> {
let title = if recovery { let (title, br) = if recovery {
TR::recovery__title_recover.into() (
TR::recovery__title_recover.into(),
ButtonRequestCode::ProtectCall.with_name("recover_device"),
)
} else { } 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) let op = OpTextLayout::new(theme::TEXT_REGULAR)
@ -73,7 +80,8 @@ pub fn new_confirm_reset(recovery: bool) -> Result<SwipeFlow, error::Error> {
TextScreenMsg::Menu => Some(FlowMsg::Info), TextScreenMsg::Menu => Some(FlowMsg::Info),
TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed),
_ => None, _ => None,
}); })
.one_button_request(br);
let content_menu = VerticalMenuScreen::new( let content_menu = VerticalMenuScreen::new(
VerticalMenu::empty().item( VerticalMenu::empty().item(

View File

@ -4,9 +4,10 @@ use crate::{
strutil::TString, strutil::TString,
translations::TR, translations::TR,
ui::{ ui::{
button_request::ButtonRequest,
component::{ component::{
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt}, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
ComponentExt, Qr, ButtonRequestExt, ComponentExt, Qr,
}, },
flow::{ flow::{
base::{Decision, DecisionBuilder as _}, base::{Decision, DecisionBuilder as _},
@ -81,8 +82,8 @@ pub fn new_get_address(
path: Option<TString<'static>>, path: Option<TString<'static>>,
_xpubs: Obj, // TODO: get rid of Obj _xpubs: Obj, // TODO: get rid of Obj
title_success: TString<'static>, title_success: TString<'static>,
_br_code: u16, br_code: u16,
_br_name: TString<'static>, br_name: TString<'static>,
) -> Result<SwipeFlow, error::Error> { ) -> Result<SwipeFlow, error::Error> {
// Address // Address
let flow_title: TString = TR::words__receive.into(); let flow_title: TString = TR::words__receive.into();
@ -114,7 +115,8 @@ pub fn new_get_address(
TextScreenMsg::Cancelled => Some(FlowMsg::Cancelled), TextScreenMsg::Cancelled => Some(FlowMsg::Cancelled),
TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed),
TextScreenMsg::Menu => Some(FlowMsg::Info), TextScreenMsg::Menu => Some(FlowMsg::Info),
}); })
.one_button_request(ButtonRequest::from_num(br_code, br_name));
let content_confirmed = let content_confirmed =
TextScreen::new(Paragraph::new(&theme::TEXT_REGULAR, title_success).into_paragraphs()) TextScreen::new(Paragraph::new(&theme::TEXT_REGULAR, title_success).into_paragraphs())

View File

@ -3,9 +3,10 @@ use crate::{
strutil::TString, strutil::TString,
translations::TR, translations::TR,
ui::{ ui::{
button_request::ButtonRequestCode,
component::{ component::{
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort}, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort},
ComponentExt, ButtonRequestExt, ComponentExt,
}, },
flow::{ flow::{
base::{Decision, DecisionBuilder as _}, base::{Decision, DecisionBuilder as _},
@ -63,6 +64,7 @@ pub fn new_show_share_words_flow(
instructions_paragraphs: ParagraphVecShort<'static>, instructions_paragraphs: ParagraphVecShort<'static>,
text_confirm: TString<'static>, text_confirm: TString<'static>,
) -> Result<SwipeFlow, error::Error> { ) -> Result<SwipeFlow, error::Error> {
let nwords = words.len();
let instruction = TextScreen::new( let instruction = TextScreen::new(
instructions_paragraphs instructions_paragraphs
.into_paragraphs() .into_paragraphs()
@ -76,7 +78,9 @@ pub fn new_show_share_words_flow(
TextScreenMsg::Cancelled => Some(FlowMsg::Cancelled), TextScreenMsg::Cancelled => Some(FlowMsg::Cancelled),
TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed),
_ => Some(FlowMsg::Cancelled), _ => 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 { let share_words = ShareWordsScreen::new(words).map(|msg| match msg {
ShareWordsScreenMsg::Cancelled => Some(FlowMsg::Cancelled), ShareWordsScreenMsg::Cancelled => Some(FlowMsg::Cancelled),