1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-11 16:00:57 +00:00

refactor(core/mercury): init Paragraphs from Vec

[no changelog]
This commit is contained in:
obrusvit 2024-07-29 15:11:12 +02:00 committed by Vít Obrusník
parent ca469784ba
commit fbf380caba
2 changed files with 9 additions and 11 deletions

View File

@ -6,7 +6,7 @@ use crate::{
ui::{ ui::{
component::{ component::{
swipe_detect::SwipeSettings, swipe_detect::SwipeSettings,
text::paragraphs::{Paragraph, Paragraphs}, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
ComponentExt, SwipeDirection, ComponentExt, SwipeDirection,
}, },
flow::{ flow::{
@ -76,9 +76,7 @@ impl SetNewPin {
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?; let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?; let description: TString = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
let par_array: [Paragraph<'static>; 1] = let paragraphs = Paragraphs::new(Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, description));
[Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, description)];
let paragraphs = Paragraphs::new(par_array);
let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs)) let content_intro = Frame::left_aligned(title, SwipeContent::new(paragraphs))
.with_menu_button() .with_menu_button()
.with_footer(TR::instructions__swipe_up.into(), None) .with_footer(TR::instructions__swipe_up.into(), None)
@ -100,11 +98,11 @@ impl SetNewPin {
FrameMsg::Button(_) => None, FrameMsg::Button(_) => None,
}); });
let par_array_cancel_intro: [Paragraph<'static>; 2] = [ let paragraphs_cancel_intro = ParagraphVecShort::from_iter([
Paragraph::new(&theme::TEXT_WARNING, TR::words__not_recommended), Paragraph::new(&theme::TEXT_WARNING, TR::words__not_recommended),
Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, TR::pin__cancel_info), Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, TR::pin__cancel_info),
]; ])
let paragraphs_cancel_intro = Paragraphs::new(par_array_cancel_intro); .into_paragraphs();
let content_cancel_intro = Frame::left_aligned( let content_cancel_intro = Frame::left_aligned(
TR::pin__cancel_setup.into(), TR::pin__cancel_setup.into(),
SwipeContent::new(paragraphs_cancel_intro), SwipeContent::new(paragraphs_cancel_intro),

View File

@ -6,7 +6,7 @@ use crate::{
ui::{ ui::{
component::{ component::{
swipe_detect::SwipeSettings, swipe_detect::SwipeSettings,
text::paragraphs::{Paragraph, Paragraphs}, text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs},
ComponentExt, SwipeDirection, ComponentExt, SwipeDirection,
}, },
flow::{ flow::{
@ -99,14 +99,14 @@ impl PromptBackup {
FrameMsg::Button(_) => None, FrameMsg::Button(_) => None,
}); });
let par_array_skip_intro: [Paragraph<'static>; 2] = [ let paragraphs_skip_intro = ParagraphVecShort::from_iter([
Paragraph::new(&theme::TEXT_WARNING, TR::words__not_recommended), Paragraph::new(&theme::TEXT_WARNING, TR::words__not_recommended),
Paragraph::new( Paragraph::new(
&theme::TEXT_MAIN_GREY_LIGHT, &theme::TEXT_MAIN_GREY_LIGHT,
TR::backup__create_backup_to_prevent_loss, TR::backup__create_backup_to_prevent_loss,
), ),
]; ])
let paragraphs_skip_intro = Paragraphs::new(par_array_skip_intro); .into_paragraphs();
let content_skip_intro = Frame::left_aligned( let content_skip_intro = Frame::left_aligned(
TR::backup__title_skip.into(), TR::backup__title_skip.into(),
SwipeContent::new(paragraphs_skip_intro), SwipeContent::new(paragraphs_skip_intro),