From 162e6e2a9e94b7192c3855f7e6c83148317f44d4 Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Sat, 29 Mar 2025 23:19:38 +0100 Subject: [PATCH] chore(eckhart) update get_address flow to use xpubs update test to scroll throiugh an entire page --- .../src/ui/layout_eckhart/flow/get_address.rs | 30 +++++++++++++++---- tests/input_flows_helpers.py | 5 +++- 2 files changed, 28 insertions(+), 7 deletions(-) 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 25061a71b0..5bf21dd2a1 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 @@ -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>, path: Option>, - _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::( &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 = 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( diff --git a/tests/input_flows_helpers.py b/tests/input_flows_helpers.py index 07d897e414..3340ed8cc8 100644 --- a/tests/input_flows_helpers.py +++ b/tests/input_flows_helpers.py @@ -381,7 +381,10 @@ class RecoveryFlow: # Scroll through remaining share pages assert br.pages is not None for _ in range(br.pages - 1): - self.debug.swipe_up() + 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