From 0ca0a9e9b7d907a9a471183f2a2e6f9d163c0bb4 Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Tue, 25 Feb 2025 18:30:17 +0100 Subject: [PATCH] chore(eckhart): update share words screen and flow --- .../layout_eckhart/component/share_words.rs | 5 +- .../layout_eckhart/flow/show_share_words.rs | 46 +++++++++++++------ .../rust/src/ui/layout_eckhart/ui_firmware.rs | 13 +++--- core/src/trezor/ui/layouts/eckhart/reset.py | 6 ++- 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/core/embed/rust/src/ui/layout_eckhart/component/share_words.rs b/core/embed/rust/src/ui/layout_eckhart/component/share_words.rs index 3742648a3e..d3f73c341e 100644 --- a/core/embed/rust/src/ui/layout_eckhart/component/share_words.rs +++ b/core/embed/rust/src/ui/layout_eckhart/component/share_words.rs @@ -88,11 +88,8 @@ impl<'a> ShareWordsScreen<'a> { // Update hint content based on the current page - // First word gets a special hint - if self.content.pager().is_first() { - self.hint = Hint::new_instruction(TR::reset__share_words_first, Some(theme::ICON_INFO)); // Repeated words get a special hint - } else if self.content.is_repeated() { + if self.content.is_repeated() { self.hint = Hint::new_instruction_green( TR::reset__the_word_is_repeated, Some(theme::ICON_INFO), diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs b/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs index fbf582beb9..42da4cbb7f 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/show_share_words.rs @@ -4,11 +4,8 @@ use crate::{ translations::TR, ui::{ component::{ - text::{ - op::OpTextLayout, - paragraphs::{Paragraph, ParagraphSource}, - }, - ComponentExt, FormattedText, + text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort}, + ComponentExt, }, flow::{ base::{Decision, DecisionBuilder as _}, @@ -24,7 +21,7 @@ use super::super::{ component::{ ActionBar, Button, Header, ShareWordsScreen, ShareWordsScreenMsg, TextScreen, TextScreenMsg, }, - fonts, theme, + theme, }; #[derive(Copy, Clone, PartialEq, Eq)] @@ -32,6 +29,7 @@ pub enum ShowShareWords { Instruction, ShareWords, Confirm, + CheckBackupIntro, } impl FlowController for ShowShareWords { @@ -53,7 +51,8 @@ impl FlowController for ShowShareWords { (Self::ShareWords, FlowMsg::Cancelled) => Self::Instruction.goto(), (Self::ShareWords, FlowMsg::Confirmed) => Self::Confirm.goto(), (Self::Confirm, FlowMsg::Cancelled) => Self::ShareWords.goto(), - (Self::Confirm, FlowMsg::Confirmed) => self.return_msg(FlowMsg::Confirmed), + (Self::Confirm, FlowMsg::Confirmed) => Self::CheckBackupIntro.goto(), + (Self::CheckBackupIntro, FlowMsg::Confirmed) => self.return_msg(FlowMsg::Confirmed), _ => self.do_nothing(), } } @@ -62,13 +61,13 @@ impl FlowController for ShowShareWords { pub fn new_show_share_words_flow( words: Vec, 33>, _subtitle: TString<'static>, - instruction: Paragraph<'static>, + instructions_paragraphs: ParagraphVecShort<'static>, text_confirm: TString<'static>, ) -> Result { let instruction = TextScreen::new( - instruction + instructions_paragraphs .into_paragraphs() - .with_placement(LinearPlacement::vertical()), + .with_placement(LinearPlacement::vertical().with_spacing(24)), ) .with_header(Header::new(TR::reset__recovery_wallet_backup_title.into())) .with_action_bar(ActionBar::new_double( @@ -86,13 +85,14 @@ pub fn new_show_share_words_flow( ShareWordsScreenMsg::Confirmed => Some(FlowMsg::Confirmed), }); - let op_confirm = - OpTextLayout::new(theme::TEXT_NORMAL).text(text_confirm, fonts::FONT_SATOSHI_REGULAR_38); + let confirm_paragraphs = Paragraph::new(&theme::TEXT_REGULAR, text_confirm) + .into_paragraphs() + .with_placement(LinearPlacement::vertical()); - let confirm = TextScreen::new(FormattedText::new(op_confirm)) + let confirm = TextScreen::new(confirm_paragraphs) .with_header(Header::new(TR::reset__recovery_wallet_backup_title.into())) .with_action_bar(ActionBar::new_double( - Button::with_icon(theme::ICON_CHEVRON_LEFT), + Button::with_icon(theme::ICON_CHEVRON_UP), Button::with_text(TR::buttons__hold_to_confirm.into()) .styled(theme::button_confirm()) .with_long_press(theme::CONFIRM_HOLD_DURATION), @@ -103,9 +103,25 @@ pub fn new_show_share_words_flow( TextScreenMsg::Menu => Some(FlowMsg::Cancelled), }); + let check_backup_paragraphs = + Paragraph::new(&theme::TEXT_REGULAR, TR::reset__check_backup_instructions) + .into_paragraphs() + .with_placement(LinearPlacement::vertical()); + + let check_backup_intro = TextScreen::new(check_backup_paragraphs) + .with_header(Header::new(TR::reset__check_wallet_backup_title.into())) + .with_action_bar(ActionBar::new_single(Button::with_text( + TR::buttons__continue.into(), + ))) + .map(|msg| match msg { + TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed), + _ => None, + }); + let res = SwipeFlow::new(&ShowShareWords::Instruction)? .with_page(&ShowShareWords::Instruction, instruction)? .with_page(&ShowShareWords::ShareWords, share_words)? - .with_page(&ShowShareWords::Confirm, confirm)?; + .with_page(&ShowShareWords::Confirm, confirm)? + .with_page(&ShowShareWords::CheckBackupIntro, check_backup_intro)?; Ok(res) } diff --git a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs index a7ef3bc9ab..1af2dbb69e 100644 --- a/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/ui_firmware.rs @@ -623,17 +623,16 @@ impl FirmwareUI for UIEckhart { _text_footer: Option>, text_confirm: TString<'static>, ) -> Result { - // TODO: add support for multiple instructions - let instruction: TString = IterBuf::new() - .try_iterate(instructions)? - .next() - .unwrap() - .try_into()?; + let mut instructions_paragraphs = ParagraphVecShort::new(); + for item in IterBuf::new().try_iterate(instructions)? { + let text: TString = item.try_into()?; + instructions_paragraphs.add(Paragraph::new(&theme::TEXT_REGULAR, text)); + } let flow = flow::show_share_words::new_show_share_words_flow( words, subtitle.unwrap_or(TString::empty()), - Paragraph::new(&theme::TEXT_REGULAR, instruction), + instructions_paragraphs, text_confirm, )?; Ok(flow) diff --git a/core/src/trezor/ui/layouts/eckhart/reset.py b/core/src/trezor/ui/layouts/eckhart/reset.py index dbe96e26d7..dd5ce28348 100644 --- a/core/src/trezor/ui/layouts/eckhart/reset.py +++ b/core/src/trezor/ui/layouts/eckhart/reset.py @@ -27,8 +27,10 @@ def show_share_words( words_count = len(share_words) description = None # Eckhart currently has only one instruction, other are shown in the hint area - instructions = [TR.reset__write_down_words_template.format(words_count)] - assert len(instructions) == 1 + instructions = [ + TR.reset__write_down_words_template.format(words_count), + TR.reset__words_may_repeat, + ] text_confirm = TR.reset__words_written_down_template.format(words_count) return raise_if_not_confirmed(