|
|
@ -1,13 +1,13 @@
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
error,
|
|
|
|
error,
|
|
|
|
micropython::{map::Map, obj::Obj, qstr::Qstr, util},
|
|
|
|
micropython::{iter::IterBuf, map::Map, obj::Obj, qstr::Qstr, util},
|
|
|
|
strutil::TString,
|
|
|
|
strutil::TString,
|
|
|
|
translations::TR,
|
|
|
|
translations::TR,
|
|
|
|
ui::{
|
|
|
|
ui::{
|
|
|
|
button_request::ButtonRequestCode,
|
|
|
|
button_request::ButtonRequestCode,
|
|
|
|
component::{
|
|
|
|
component::{
|
|
|
|
swipe_detect::SwipeSettings,
|
|
|
|
swipe_detect::SwipeSettings,
|
|
|
|
text::paragraphs::{Paragraph, Paragraphs},
|
|
|
|
text::paragraphs::{Paragraph, ParagraphSource, ParagraphVecShort, Paragraphs, VecExt},
|
|
|
|
ButtonRequestExt, ComponentExt, SwipeDirection,
|
|
|
|
ButtonRequestExt, ComponentExt, SwipeDirection,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
flow::{base::Decision, flow_store, FlowMsg, FlowState, FlowStore, SwipeFlow},
|
|
|
|
flow::{base::Decision, flow_store, FlowMsg, FlowState, FlowStore, SwipeFlow},
|
|
|
@ -24,7 +24,6 @@ use super::super::{
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, ToPrimitive)]
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, ToPrimitive)]
|
|
|
|
pub enum ShowShareWords {
|
|
|
|
pub enum ShowShareWords {
|
|
|
|
// TODO: potentially also add there the 'never put anywhere digital' warning?
|
|
|
|
|
|
|
|
Instruction,
|
|
|
|
Instruction,
|
|
|
|
Words,
|
|
|
|
Words,
|
|
|
|
Confirm,
|
|
|
|
Confirm,
|
|
|
@ -80,16 +79,23 @@ impl ShowShareWords {
|
|
|
|
let subtitle: TString = kwargs.get(Qstr::MP_QSTR_subtitle)?.try_into()?;
|
|
|
|
let subtitle: TString = kwargs.get(Qstr::MP_QSTR_subtitle)?.try_into()?;
|
|
|
|
let share_words_obj: Obj = kwargs.get(Qstr::MP_QSTR_words)?;
|
|
|
|
let share_words_obj: Obj = kwargs.get(Qstr::MP_QSTR_words)?;
|
|
|
|
let share_words_vec: Vec<TString, 33> = util::iter_into_vec(share_words_obj)?;
|
|
|
|
let share_words_vec: Vec<TString, 33> = util::iter_into_vec(share_words_obj)?;
|
|
|
|
let text_info: TString = kwargs.get(Qstr::MP_QSTR_text_info)?.try_into()?;
|
|
|
|
let text_info: Obj = kwargs.get(Qstr::MP_QSTR_text_info)?;
|
|
|
|
let text_confirm: TString = kwargs.get(Qstr::MP_QSTR_text_confirm)?.try_into()?;
|
|
|
|
let text_confirm: TString = kwargs.get(Qstr::MP_QSTR_text_confirm)?.try_into()?;
|
|
|
|
let nwords = share_words_vec.len();
|
|
|
|
let nwords = share_words_vec.len();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut instructions_paragraphs = ParagraphVecShort::new();
|
|
|
|
|
|
|
|
for item in IterBuf::new().try_iterate(text_info)? {
|
|
|
|
|
|
|
|
let text: TString = item.try_into()?;
|
|
|
|
|
|
|
|
instructions_paragraphs.add(Paragraph::new(&theme::TEXT_MAIN_GREY_LIGHT, text));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let paragraphs_spacing = 8;
|
|
|
|
let content_instruction = Frame::left_aligned(
|
|
|
|
let content_instruction = Frame::left_aligned(
|
|
|
|
title,
|
|
|
|
title,
|
|
|
|
SwipeContent::new(Paragraphs::new(Paragraph::new(
|
|
|
|
SwipeContent::new(
|
|
|
|
&theme::TEXT_MAIN_GREY_LIGHT,
|
|
|
|
instructions_paragraphs
|
|
|
|
text_info,
|
|
|
|
.into_paragraphs()
|
|
|
|
))),
|
|
|
|
.with_spacing(paragraphs_spacing),
|
|
|
|
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.with_subtitle(TR::words__instructions.into())
|
|
|
|
.with_subtitle(TR::words__instructions.into())
|
|
|
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
|
|
|
.with_footer(TR::instructions__swipe_up.into(), None)
|
|
|
|