1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-22 10:09:04 +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 14d15741f6
commit 3dad73479a
3 changed files with 25 additions and 11 deletions

View File

@ -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<SwipeFlow, error::Error> {
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<SwipeFlow, error::Error> {
TextScreenMsg::Menu => Some(FlowMsg::Info),
TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed),
_ => None,
});
})
.one_button_request(br);
let content_menu = VerticalMenuScreen::new(
VerticalMenu::empty().item(

View File

@ -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<TString<'static>>,
_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<SwipeFlow, error::Error> {
// 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())

View File

@ -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<SwipeFlow, error::Error> {
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),