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:
parent
401289d6ee
commit
162e6e2a9e
@ -1,12 +1,12 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
error,
|
error,
|
||||||
micropython::obj::Obj,
|
micropython::{obj::Obj, util},
|
||||||
strutil::TString,
|
strutil::TString,
|
||||||
translations::TR,
|
translations::TR,
|
||||||
ui::{
|
ui::{
|
||||||
button_request::ButtonRequest,
|
button_request::ButtonRequest,
|
||||||
component::{
|
component::{
|
||||||
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, VecExt},
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecLong, VecExt},
|
||||||
ButtonRequestExt, ComponentExt, Qr,
|
ButtonRequestExt, ComponentExt, Qr,
|
||||||
},
|
},
|
||||||
flow::{
|
flow::{
|
||||||
@ -16,6 +16,7 @@ use crate::{
|
|||||||
geometry::{Alignment, Direction, LinearPlacement, Offset},
|
geometry::{Alignment, Direction, LinearPlacement, Offset},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use heapless::Vec;
|
||||||
|
|
||||||
use super::super::{
|
use super::super::{
|
||||||
component::Button,
|
component::Button,
|
||||||
@ -28,6 +29,7 @@ use super::super::{
|
|||||||
|
|
||||||
const ITEM_PADDING: i16 = 16;
|
const ITEM_PADDING: i16 = 16;
|
||||||
const GROUP_PADDING: i16 = 20;
|
const GROUP_PADDING: i16 = 20;
|
||||||
|
const MAX_XPUBS: usize = 3;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum GetAddress {
|
pub enum GetAddress {
|
||||||
@ -78,7 +80,7 @@ pub fn new_get_address(
|
|||||||
case_sensitive: bool,
|
case_sensitive: bool,
|
||||||
account: Option<TString<'static>>,
|
account: Option<TString<'static>>,
|
||||||
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>,
|
||||||
@ -171,7 +173,7 @@ pub fn new_get_address(
|
|||||||
.map(|_| Some(FlowMsg::Cancelled));
|
.map(|_| Some(FlowMsg::Cancelled));
|
||||||
|
|
||||||
// AccountInfo
|
// AccountInfo
|
||||||
let mut para = ParagraphVecShort::new();
|
let mut para = ParagraphVecLong::new();
|
||||||
if let Some(a) = account {
|
if let Some(a) = account {
|
||||||
para.add(Paragraph::new::<TString>(
|
para.add(Paragraph::new::<TString>(
|
||||||
&theme::TEXT_SMALL_LIGHT,
|
&theme::TEXT_SMALL_LIGHT,
|
||||||
@ -186,9 +188,25 @@ pub fn new_get_address(
|
|||||||
&theme::TEXT_SMALL_LIGHT,
|
&theme::TEXT_SMALL_LIGHT,
|
||||||
TR::address_details__derivation_path.into(),
|
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(
|
let content_account = TextScreen::new(
|
||||||
|
@ -381,7 +381,10 @@ class RecoveryFlow:
|
|||||||
# Scroll through remaining share pages
|
# Scroll through remaining share pages
|
||||||
assert br.pages is not None
|
assert br.pages is not None
|
||||||
for _ in range(br.pages - 1):
|
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.name == "show_shares"
|
||||||
assert br.code == B.Other
|
assert br.code == B.Other
|
||||||
|
Loading…
Reference in New Issue
Block a user