mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-28 15:22:14 +00:00
feat(eckhart): confirm reset flow
This commit is contained in:
parent
3649a402ef
commit
2ef230c1a9
@ -820,7 +820,7 @@ pub enum TranslatedString {
|
|||||||
reset__any_x_of_y_template = 536, // "any {0} of {1} shares"
|
reset__any_x_of_y_template = 536, // "any {0} of {1} shares"
|
||||||
reset__button_create = 537, // "Create wallet"
|
reset__button_create = 537, // "Create wallet"
|
||||||
reset__button_recover = 538, // "Recover wallet"
|
reset__button_recover = 538, // "Recover wallet"
|
||||||
reset__by_continuing = 539, // "By continuing you agree to Trezor Company's terms and conditions."
|
reset__by_continuing = 539, // {"Bolt": "By continuing you agree to Trezor Company's terms and conditions.", "Caesar": "By continuing you agree to Trezor Company's terms and conditions.", "Delizia": "By continuing you agree to Trezor Company's terms and conditions.", "Eckhart": "By continuing, you agree to Trezor Company's Terms of Use."}
|
||||||
reset__check_backup_title = 540, // "Check backup"
|
reset__check_backup_title = 540, // "Check backup"
|
||||||
reset__check_group_share_title_template = 541, // "Check g{0} - share {1}"
|
reset__check_group_share_title_template = 541, // "Check g{0} - share {1}"
|
||||||
reset__check_wallet_backup_title = 542, // "Check wallet backup"
|
reset__check_wallet_backup_title = 542, // "Check wallet backup"
|
||||||
@ -878,7 +878,7 @@ pub enum TranslatedString {
|
|||||||
reset__title_set_number_of_shares = 595, // "Set number of shares"
|
reset__title_set_number_of_shares = 595, // "Set number of shares"
|
||||||
reset__title_set_threshold = 596, // "Set threshold"
|
reset__title_set_threshold = 596, // "Set threshold"
|
||||||
reset__to_form_group_template = 597, // "to form Group {0}."
|
reset__to_form_group_template = 597, // "to form Group {0}."
|
||||||
reset__tos_link = 598, // "trezor.io/tos"
|
reset__tos_link = 598, // {"Bolt": "https://trezor.io/tos/", "Caesar": "https://trezor.io/tos/", "Delizia": "https://trezor.io/tos/", "Eckhart": "More at trezor.io/tos"}
|
||||||
reset__total_number_of_shares_in_group_template = 599, // "Set the total number of shares in Group {0}."
|
reset__total_number_of_shares_in_group_template = 599, // "Set the total number of shares in Group {0}."
|
||||||
reset__use_your_backup = 600, // "Use your backup when you need to recover your wallet."
|
reset__use_your_backup = 600, // "Use your backup when you need to recover your wallet."
|
||||||
reset__write_down_words_template = 601, // "Write the following {0} words in order on your wallet backup card."
|
reset__write_down_words_template = 601, // "Write the following {0} words in order on your wallet backup card."
|
||||||
@ -2219,7 +2219,14 @@ impl TranslatedString {
|
|||||||
Self::reset__any_x_of_y_template => "any {0} of {1} shares",
|
Self::reset__any_x_of_y_template => "any {0} of {1} shares",
|
||||||
Self::reset__button_create => "Create wallet",
|
Self::reset__button_create => "Create wallet",
|
||||||
Self::reset__button_recover => "Recover wallet",
|
Self::reset__button_recover => "Recover wallet",
|
||||||
|
#[cfg(feature = "layout_bolt")]
|
||||||
Self::reset__by_continuing => "By continuing you agree to Trezor Company's terms and conditions.",
|
Self::reset__by_continuing => "By continuing you agree to Trezor Company's terms and conditions.",
|
||||||
|
#[cfg(feature = "layout_caesar")]
|
||||||
|
Self::reset__by_continuing => "By continuing you agree to Trezor Company's terms and conditions.",
|
||||||
|
#[cfg(feature = "layout_delizia")]
|
||||||
|
Self::reset__by_continuing => "By continuing you agree to Trezor Company's terms and conditions.",
|
||||||
|
#[cfg(feature = "layout_eckhart")]
|
||||||
|
Self::reset__by_continuing => "By continuing, you agree to Trezor Company's Terms of Use.",
|
||||||
Self::reset__check_backup_title => "Check backup",
|
Self::reset__check_backup_title => "Check backup",
|
||||||
Self::reset__check_group_share_title_template => "Check g{0} - share {1}",
|
Self::reset__check_group_share_title_template => "Check g{0} - share {1}",
|
||||||
Self::reset__check_wallet_backup_title => "Check wallet backup",
|
Self::reset__check_wallet_backup_title => "Check wallet backup",
|
||||||
@ -2284,7 +2291,14 @@ impl TranslatedString {
|
|||||||
Self::reset__title_set_number_of_shares => "Set number of shares",
|
Self::reset__title_set_number_of_shares => "Set number of shares",
|
||||||
Self::reset__title_set_threshold => "Set threshold",
|
Self::reset__title_set_threshold => "Set threshold",
|
||||||
Self::reset__to_form_group_template => "to form Group {0}.",
|
Self::reset__to_form_group_template => "to form Group {0}.",
|
||||||
Self::reset__tos_link => "trezor.io/tos",
|
#[cfg(feature = "layout_bolt")]
|
||||||
|
Self::reset__tos_link => "https://trezor.io/tos/",
|
||||||
|
#[cfg(feature = "layout_caesar")]
|
||||||
|
Self::reset__tos_link => "https://trezor.io/tos/",
|
||||||
|
#[cfg(feature = "layout_delizia")]
|
||||||
|
Self::reset__tos_link => "https://trezor.io/tos/",
|
||||||
|
#[cfg(feature = "layout_eckhart")]
|
||||||
|
Self::reset__tos_link => "More at trezor.io/tos",
|
||||||
Self::reset__total_number_of_shares_in_group_template => "Set the total number of shares in Group {0}.",
|
Self::reset__total_number_of_shares_in_group_template => "Set the total number of shares in Group {0}.",
|
||||||
Self::reset__use_your_backup => "Use your backup when you need to recover your wallet.",
|
Self::reset__use_your_backup => "Use your backup when you need to recover your wallet.",
|
||||||
Self::reset__write_down_words_template => "Write the following {0} words in order on your wallet backup card.",
|
Self::reset__write_down_words_template => "Write the following {0} words in order on your wallet backup card.",
|
||||||
|
102
core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs
Normal file
102
core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
use crate::{
|
||||||
|
error,
|
||||||
|
translations::TR,
|
||||||
|
ui::{
|
||||||
|
component::{text::op::OpTextLayout, ComponentExt, FormattedText},
|
||||||
|
flow::{
|
||||||
|
base::{Decision, DecisionBuilder as _},
|
||||||
|
FlowController, FlowMsg, SwipeFlow,
|
||||||
|
},
|
||||||
|
geometry::{Alignment, Direction, Offset},
|
||||||
|
layout_eckhart::component::Button,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
use super::super::{
|
||||||
|
component::{
|
||||||
|
ActionBar, Header, HeaderMsg, Hint, TextScreen, TextScreenMsg, VerticalMenu,
|
||||||
|
VerticalMenuScreen, VerticalMenuScreenMsg,
|
||||||
|
},
|
||||||
|
fonts, theme,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||||
|
pub enum ConfirmReset {
|
||||||
|
Intro,
|
||||||
|
Menu,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FlowController for ConfirmReset {
|
||||||
|
#[inline]
|
||||||
|
fn index(&'static self) -> usize {
|
||||||
|
*self as usize
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_swipe(&'static self, direction: Direction) -> Decision {
|
||||||
|
match (self, direction) {
|
||||||
|
_ => self.do_nothing(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_event(&'static self, msg: FlowMsg) -> Decision {
|
||||||
|
match (self, msg) {
|
||||||
|
(Self::Intro, FlowMsg::Info) => Self::Menu.goto(),
|
||||||
|
(Self::Intro, FlowMsg::Confirmed) => self.return_msg(FlowMsg::Confirmed),
|
||||||
|
(Self::Menu, FlowMsg::Cancelled) => Self::Intro.swipe_right(),
|
||||||
|
(Self::Menu, FlowMsg::Choice(0)) => self.return_msg(FlowMsg::Cancelled),
|
||||||
|
_ => self.do_nothing(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_confirm_reset(recovery: bool) -> Result<SwipeFlow, error::Error> {
|
||||||
|
let title = if recovery {
|
||||||
|
TR::recovery__title_recover.into()
|
||||||
|
} else {
|
||||||
|
TR::reset__title_create_wallet.into()
|
||||||
|
};
|
||||||
|
|
||||||
|
let op = OpTextLayout::new(theme::TEXT_REGULAR)
|
||||||
|
.text(TR::reset__by_continuing, fonts::FONT_SATOSHI_REGULAR_38)
|
||||||
|
.alignment(Alignment::Start);
|
||||||
|
|
||||||
|
let content_intro = TextScreen::new(FormattedText::new(op))
|
||||||
|
.with_header(Header::new(title).with_menu_button())
|
||||||
|
.with_action_bar(ActionBar::new_single(
|
||||||
|
Button::with_text(TR::instructions__hold_to_continue.into())
|
||||||
|
.with_long_press(theme::CONFIRM_HOLD_DURATION)
|
||||||
|
.styled(theme::button_confirm()),
|
||||||
|
))
|
||||||
|
.with_hint(Hint::new_instruction(
|
||||||
|
TR::reset__tos_link,
|
||||||
|
Some(theme::ICON_INFO),
|
||||||
|
))
|
||||||
|
.map(|msg| match msg {
|
||||||
|
TextScreenMsg::Menu => Some(FlowMsg::Info),
|
||||||
|
TextScreenMsg::Confirmed => Some(FlowMsg::Confirmed),
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
|
||||||
|
let content_menu = VerticalMenuScreen::new(
|
||||||
|
VerticalMenu::empty().item(
|
||||||
|
Button::with_text(TR::buttons__cancel.into())
|
||||||
|
.styled(theme::menu_item_title_red())
|
||||||
|
.with_text_align(Alignment::Start)
|
||||||
|
.with_content_offset(Offset::x(12)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.with_header(
|
||||||
|
Header::new(title)
|
||||||
|
.with_right_button(Button::with_icon(theme::ICON_CROSS), HeaderMsg::Cancelled),
|
||||||
|
)
|
||||||
|
.map(|msg| match msg {
|
||||||
|
VerticalMenuScreenMsg::Selected(i) => Some(FlowMsg::Choice(i)),
|
||||||
|
VerticalMenuScreenMsg::Close => Some(FlowMsg::Cancelled),
|
||||||
|
_ => None,
|
||||||
|
});
|
||||||
|
|
||||||
|
let res = SwipeFlow::new(&ConfirmReset::Intro)?
|
||||||
|
.with_page(&ConfirmReset::Intro, content_intro)?
|
||||||
|
.with_page(&ConfirmReset::Menu, content_menu)?;
|
||||||
|
Ok(res)
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
|
pub mod confirm_reset;
|
||||||
pub mod request_passphrase;
|
pub mod request_passphrase;
|
||||||
pub mod show_share_words;
|
pub mod show_share_words;
|
||||||
|
|
||||||
|
pub use confirm_reset::new_confirm_reset;
|
||||||
pub use request_passphrase::RequestPassphrase;
|
pub use request_passphrase::RequestPassphrase;
|
||||||
pub use show_share_words::new_show_share_words_flow;
|
pub use show_share_words::new_show_share_words_flow;
|
||||||
|
@ -165,8 +165,9 @@ impl FirmwareUI for UIEckhart {
|
|||||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm_reset_device(_recovery: bool) -> Result<impl LayoutMaybeTrace, Error> {
|
fn confirm_reset_device(recovery: bool) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
Err::<RootComponent<Empty, ModelUI>, Error>(Error::ValueError(c"not implemented"))
|
let flow = flow::confirm_reset::new_confirm_reset(recovery)?;
|
||||||
|
Ok(flow)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn confirm_summary(
|
fn confirm_summary(
|
||||||
|
@ -695,7 +695,7 @@ class TR:
|
|||||||
reset__title_set_threshold: str = "Set threshold"
|
reset__title_set_threshold: str = "Set threshold"
|
||||||
reset__title_shamir_backup: str = "Multi-share backup"
|
reset__title_shamir_backup: str = "Multi-share backup"
|
||||||
reset__to_form_group_template: str = "to form Group {0}."
|
reset__to_form_group_template: str = "to form Group {0}."
|
||||||
reset__tos_link: str = "trezor.io/tos"
|
reset__tos_link: str = "https://trezor.io/tos/"
|
||||||
reset__total_number_of_shares_in_group_template: str = "Set the total number of shares in Group {0}."
|
reset__total_number_of_shares_in_group_template: str = "Set the total number of shares in Group {0}."
|
||||||
reset__use_your_backup: str = "Use your backup when you need to recover your wallet."
|
reset__use_your_backup: str = "Use your backup when you need to recover your wallet."
|
||||||
reset__words_may_repeat: str = "Words may repeat."
|
reset__words_may_repeat: str = "Words may repeat."
|
||||||
|
@ -621,7 +621,12 @@
|
|||||||
"reset__any_x_of_y_template": "any {0} of {1} shares",
|
"reset__any_x_of_y_template": "any {0} of {1} shares",
|
||||||
"reset__button_create": "Create wallet",
|
"reset__button_create": "Create wallet",
|
||||||
"reset__button_recover": "Recover wallet",
|
"reset__button_recover": "Recover wallet",
|
||||||
"reset__by_continuing": "By continuing you agree to Trezor Company's terms and conditions.",
|
"reset__by_continuing": {
|
||||||
|
"Bolt": "By continuing you agree to Trezor Company's terms and conditions.",
|
||||||
|
"Caesar": "By continuing you agree to Trezor Company's terms and conditions.",
|
||||||
|
"Delizia": "By continuing you agree to Trezor Company's terms and conditions.",
|
||||||
|
"Eckhart": "By continuing, you agree to Trezor Company's Terms of Use."
|
||||||
|
},
|
||||||
"reset__cancel_create_wallet": "Cancel create wallet",
|
"reset__cancel_create_wallet": "Cancel create wallet",
|
||||||
"reset__check_backup_instructions": "Let's do a quick check of your backup.",
|
"reset__check_backup_instructions": "Let's do a quick check of your backup.",
|
||||||
"reset__check_backup_title": "Check backup",
|
"reset__check_backup_title": "Check backup",
|
||||||
@ -707,7 +712,12 @@
|
|||||||
"reset__title_set_threshold": "Set threshold",
|
"reset__title_set_threshold": "Set threshold",
|
||||||
"reset__title_shamir_backup": "Multi-share backup",
|
"reset__title_shamir_backup": "Multi-share backup",
|
||||||
"reset__to_form_group_template": "to form Group {0}.",
|
"reset__to_form_group_template": "to form Group {0}.",
|
||||||
"reset__tos_link": "trezor.io/tos",
|
"reset__tos_link": {
|
||||||
|
"Bolt": "https://trezor.io/tos/",
|
||||||
|
"Caesar": "https://trezor.io/tos/",
|
||||||
|
"Delizia": "https://trezor.io/tos/",
|
||||||
|
"Eckhart": "More at trezor.io/tos"
|
||||||
|
},
|
||||||
"reset__total_number_of_shares_in_group_template": "Set the total number of shares in Group {0}.",
|
"reset__total_number_of_shares_in_group_template": "Set the total number of shares in Group {0}.",
|
||||||
"reset__use_your_backup": "Use your backup when you need to recover your wallet.",
|
"reset__use_your_backup": "Use your backup when you need to recover your wallet.",
|
||||||
"reset__words_may_repeat": "Words may repeat.",
|
"reset__words_may_repeat": "Words may repeat.",
|
||||||
|
Loading…
Reference in New Issue
Block a user