1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-21 16:28:46 +00:00

chore(eckhart): update get address flow

This commit is contained in:
Lukas Bielesch 2025-03-28 12:39:16 +01:00 committed by M1nd3r
parent f814f15a50
commit 6c5750ea3c

View File

@ -14,7 +14,6 @@ use crate::{
FlowController, FlowMsg, SwipeFlow, FlowController, FlowMsg, SwipeFlow,
}, },
geometry::{Alignment, Direction, LinearPlacement, Offset}, geometry::{Alignment, Direction, LinearPlacement, Offset},
layout::util::ConfirmValueParams,
}, },
}; };
@ -27,7 +26,6 @@ use super::super::{
theme, theme,
}; };
const TIMEOUT_MS: u32 = 2000;
const ITEM_PADDING: i16 = 16; const ITEM_PADDING: i16 = 16;
const GROUP_PADDING: i16 = 20; const GROUP_PADDING: i16 = 20;
@ -73,7 +71,7 @@ impl FlowController for GetAddress {
pub fn new_get_address( pub fn new_get_address(
title: TString<'static>, title: TString<'static>,
_description: Option<TString<'static>>, _description: Option<TString<'static>>,
extra: Option<TString<'static>>, _extra: Option<TString<'static>>,
address: Obj, // TODO: get rid of Obj address: Obj, // TODO: get rid of Obj
chunkify: bool, chunkify: bool,
address_qr: TString<'static>, address_qr: TString<'static>,
@ -87,23 +85,20 @@ pub fn new_get_address(
) -> 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();
let paragraphs = ConfirmValueParams {
description: title, let test_style = if chunkify {
extra: extra.unwrap_or_else(|| "".into()), let address: TString = address.try_into()?;
value: address.try_into()?, theme::get_chunkified_text_style(address.len())
font: if chunkify { } else {
let address: TString = address.try_into()?; &theme::TEXT_MONO_ADDRESS
theme::get_chunkified_text_style(address.len()) };
} else { let paragraphs = Paragraph::new(test_style, address.try_into().unwrap_or(TString::empty()))
&theme::TEXT_MONO_ADDRESS .into_paragraphs()
}, .with_placement(LinearPlacement::vertical());
description_font: &theme::TEXT_MEDIUM_EXTRA_LIGHT,
extra_font: &theme::TEXT_SMALL,
}
.into_paragraphs()
.with_placement(LinearPlacement::vertical().with_spacing(14));
let content_address = TextScreen::new(paragraphs) let content_address = TextScreen::new(paragraphs)
.with_header(Header::new(flow_title).with_menu_button()) .with_header(Header::new(flow_title).with_menu_button())
.with_subtitle(title)
.with_action_bar(ActionBar::new_single( .with_action_bar(ActionBar::new_single(
Button::with_text(TR::buttons__confirm.into()).styled(theme::button_confirm()), Button::with_text(TR::buttons__confirm.into()).styled(theme::button_confirm()),
)) ))
@ -116,20 +111,23 @@ pub fn new_get_address(
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)); .one_button_request(ButtonRequest::from_num(br_code, br_name))
.with_pages(|address_pages| address_pages + 1);
let content_confirmed = let content_confirmed = TextScreen::new(
TextScreen::new(Paragraph::new(&theme::TEXT_REGULAR, title_success).into_paragraphs()) Paragraph::new(&theme::TEXT_REGULAR, title_success)
.with_header( .into_paragraphs()
Header::new(TR::words__title_done.into()) .with_placement(LinearPlacement::vertical()),
.with_icon(theme::ICON_DONE, theme::GREEN_LIGHT) )
.with_text_style(theme::label_title_confirm()), .with_header(
) Header::new(TR::words__title_done.into())
.with_action_bar(ActionBar::new_timeout( .with_icon(theme::ICON_DONE, theme::GREEN_LIGHT)
Button::with_text(TR::instructions__continue_in_app.into()), .with_text_style(theme::label_title_confirm()),
TIMEOUT_MS, )
)) .with_action_bar(ActionBar::new_single(Button::with_text(
.map(|_| Some(FlowMsg::Confirmed)); TR::instructions__continue_in_app.into(),
)))
.map(|_| Some(FlowMsg::Confirmed));
// Menu // Menu