1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-24 17:58:45 +00:00

chore(eckhart) update get_address flow to use xpubs

update test to scroll throiugh an entire page
This commit is contained in:
Lukas Bielesch 2025-03-29 23:19:38 +01:00 committed by obrusvit
parent 401289d6ee
commit 162e6e2a9e
2 changed files with 28 additions and 7 deletions

View File

@ -1,12 +1,12 @@
use crate::{
error,
micropython::obj::Obj,
micropython::{obj::Obj, util},
strutil::TString,
translations::TR,
ui::{
button_request::ButtonRequest,
component::{
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecLong, VecExt},
ButtonRequestExt, ComponentExt, Qr,
},
flow::{
@ -16,6 +16,7 @@ use crate::{
geometry::{Alignment, Direction, LinearPlacement, Offset},
},
};
use heapless::Vec;
use super::super::{
component::Button,
@ -28,6 +29,7 @@ use super::super::{
const ITEM_PADDING: i16 = 16;
const GROUP_PADDING: i16 = 20;
const MAX_XPUBS: usize = 3;
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum GetAddress {
@ -78,7 +80,7 @@ pub fn new_get_address(
case_sensitive: bool,
account: 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>,
br_code: u16,
br_name: TString<'static>,
@ -171,7 +173,7 @@ pub fn new_get_address(
.map(|_| Some(FlowMsg::Cancelled));
// AccountInfo
let mut para = ParagraphVecShort::new();
let mut para = ParagraphVecLong::new();
if let Some(a) = account {
para.add(Paragraph::new::<TString>(
&theme::TEXT_SMALL_LIGHT,
@ -186,9 +188,25 @@ pub fn new_get_address(
&theme::TEXT_SMALL_LIGHT,
TR::address_details__derivation_path.into(),
)
.with_top_padding(GROUP_PADDING),
.with_top_padding(GROUP_PADDING)
.no_break(),
);
para.add(
Paragraph::new(&theme::TEXT_MONO_EXTRA_LIGHT, p)
.with_top_padding(ITEM_PADDING)
.break_after(),
);
}
let xpub_items: Vec<Obj, MAX_XPUBS> = util::iter_into_vec(xpubs).unwrap_or(Vec::new());
for i in xpub_items.into_iter() {
let [label, value]: [TString; 2] = util::iter_into_array(i)?;
para.add(Paragraph::new(&theme::TEXT_SMALL_LIGHT, label).no_break());
para.add(
Paragraph::new(&theme::TEXT_MONO_LIGHT, value)
.with_top_padding(ITEM_PADDING)
.break_after(),
);
para.add(Paragraph::new(&theme::TEXT_MONO_EXTRA_LIGHT, p).with_top_padding(ITEM_PADDING));
}
let content_account = TextScreen::new(

View File

@ -381,7 +381,10 @@ class RecoveryFlow:
# Scroll through remaining share pages
assert br.pages is not None
for _ in range(br.pages - 1):
if self.client.layout_type is LayoutType.Delizia:
self.debug.swipe_up()
elif self.client.layout_type is LayoutType.Eckhart:
self.debug.click(self.debug.screen_buttons.ok())
assert br.name == "show_shares"
assert br.code == B.Other