mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-02 02:41:28 +00:00
refactor(core): move confirm_reset to UiFeatures
- unify param to just one bool `recovery` - title and button is determined in Rust based on the argument
This commit is contained in:
parent
b67b5567e8
commit
caae0134a4
@ -253,7 +253,6 @@ static void _librust_qstrs(void) {
|
|||||||
MP_QSTR_firmware_update__title_fingerprint;
|
MP_QSTR_firmware_update__title_fingerprint;
|
||||||
MP_QSTR_first_screen;
|
MP_QSTR_first_screen;
|
||||||
MP_QSTR_flow_confirm_output;
|
MP_QSTR_flow_confirm_output;
|
||||||
MP_QSTR_flow_confirm_reset;
|
|
||||||
MP_QSTR_flow_confirm_set_new_pin;
|
MP_QSTR_flow_confirm_set_new_pin;
|
||||||
MP_QSTR_flow_confirm_summary;
|
MP_QSTR_flow_confirm_summary;
|
||||||
MP_QSTR_flow_continue_recovery;
|
MP_QSTR_flow_continue_recovery;
|
||||||
|
@ -110,6 +110,16 @@ extern "C" fn new_confirm_homescreen(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" fn new_confirm_reset_device(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
|
let block = move |_args: &[Obj], kwargs: &Map| {
|
||||||
|
let recovery: bool = kwargs.get(Qstr::MP_QSTR_recovery)?.try_into()?;
|
||||||
|
|
||||||
|
let layout = ModelUI::confirm_reset_device(recovery)?;
|
||||||
|
Ok(LayoutObj::new_root(layout)?.into())
|
||||||
|
};
|
||||||
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" fn new_request_bip39(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
extern "C" fn new_request_bip39(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
let block = move |_args: &[Obj], kwargs: &Map| {
|
||||||
let prompt: TString = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
let prompt: TString = kwargs.get(Qstr::MP_QSTR_prompt)?.try_into()?;
|
||||||
@ -494,6 +504,10 @@ pub static mp_module_trezorui_api: Module = obj_module! {
|
|||||||
/// """Confirm homescreen."""
|
/// """Confirm homescreen."""
|
||||||
Qstr::MP_QSTR_confirm_homescreen => obj_fn_kw!(0, new_confirm_homescreen).as_obj(),
|
Qstr::MP_QSTR_confirm_homescreen => obj_fn_kw!(0, new_confirm_homescreen).as_obj(),
|
||||||
|
|
||||||
|
/// def confirm_reset_device(recovery: bool) -> LayoutObj[UiResult]:
|
||||||
|
/// """Confirm TOS before creating wallet creation or wallet recovery."""
|
||||||
|
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
||||||
|
|
||||||
/// def request_bip39(
|
/// def request_bip39(
|
||||||
/// *,
|
/// *,
|
||||||
/// prompt: str,
|
/// prompt: str,
|
||||||
|
@ -420,16 +420,6 @@ extern "C" fn new_confirm_properties(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn new_confirm_reset(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
|
||||||
let recovery: bool = kwargs.get(Qstr::MP_QSTR_recovery)?.try_into()?;
|
|
||||||
|
|
||||||
let flow = flow::confirm_reset::new_confirm_reset(recovery)?;
|
|
||||||
Ok(LayoutObj::new_root(flow)?.into())
|
|
||||||
};
|
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" fn new_confirm_set_new_pin(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
extern "C" fn new_confirm_set_new_pin(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
let block = move |_args: &[Obj], kwargs: &Map| {
|
||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
||||||
@ -1175,10 +1165,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
||||||
|
|
||||||
/// def flow_confirm_reset(recovery: bool) -> LayoutObj[UiResult]:
|
|
||||||
/// """Confirm TOS before creating wallet creation or wallet recovery."""
|
|
||||||
Qstr::MP_QSTR_flow_confirm_reset => obj_fn_kw!(0, new_confirm_reset).as_obj(),
|
|
||||||
|
|
||||||
// TODO: supply more arguments for Wipe code setting when figma done
|
// TODO: supply more arguments for Wipe code setting when figma done
|
||||||
/// def flow_confirm_set_new_pin(
|
/// def flow_confirm_set_new_pin(
|
||||||
/// *,
|
/// *,
|
||||||
|
@ -112,6 +112,11 @@ impl UIFeaturesFirmware for ModelMercuryFeatures {
|
|||||||
Ok(flow)
|
Ok(flow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn confirm_reset_device(recovery: bool) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
|
let flow = flow::confirm_reset::new_confirm_reset(recovery)?;
|
||||||
|
Ok(flow)
|
||||||
|
}
|
||||||
|
|
||||||
fn check_homescreen_format(image: BinaryData, __accept_toif: bool) -> bool {
|
fn check_homescreen_format(image: BinaryData, __accept_toif: bool) -> bool {
|
||||||
super::component::check_homescreen_format(image)
|
super::component::check_homescreen_format(image)
|
||||||
}
|
}
|
||||||
|
@ -372,24 +372,6 @@ extern "C" fn new_confirm_properties(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn new_confirm_reset_device(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
|
||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
|
||||||
let button: TString<'static> = kwargs.get(Qstr::MP_QSTR_button)?.try_into()?;
|
|
||||||
|
|
||||||
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
|
||||||
.text_normal(TR::reset__by_continuing)
|
|
||||||
.next_page()
|
|
||||||
.text_normal(TR::reset__more_info_at)
|
|
||||||
.newline()
|
|
||||||
.text_bold(TR::reset__tos_link);
|
|
||||||
let formatted = FormattedText::new(ops).vertically_centered();
|
|
||||||
|
|
||||||
content_in_button_page(title, formatted, button, Some("".into()), false)
|
|
||||||
};
|
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" fn new_confirm_backup(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
extern "C" fn new_confirm_backup(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
let block = move |_args: &[Obj], _kwargs: &Map| {
|
let block = move |_args: &[Obj], _kwargs: &Map| {
|
||||||
let get_page = move |page_index| match page_index {
|
let get_page = move |page_index| match page_index {
|
||||||
@ -1297,14 +1279,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
/// This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
||||||
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
||||||
|
|
||||||
/// def confirm_reset_device(
|
|
||||||
/// *,
|
|
||||||
/// title: str,
|
|
||||||
/// button: str,
|
|
||||||
/// ) -> LayoutObj[UiResult]:
|
|
||||||
/// """Confirm TOS before device setup."""
|
|
||||||
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
|
||||||
|
|
||||||
/// def confirm_backup() -> LayoutObj[UiResult]:
|
/// def confirm_backup() -> LayoutObj[UiResult]:
|
||||||
/// """Strongly recommend user to do backup."""
|
/// """Strongly recommend user to do backup."""
|
||||||
Qstr::MP_QSTR_confirm_backup => obj_fn_kw!(0, new_confirm_backup).as_obj(),
|
Qstr::MP_QSTR_confirm_backup => obj_fn_kw!(0, new_confirm_backup).as_obj(),
|
||||||
|
@ -30,7 +30,9 @@ use crate::{
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
component::{
|
component::{
|
||||||
ButtonDetails, ButtonPage, CoinJoinProgress, ConfirmHomescreen, Flow, FlowPages, Frame, Homescreen, Lockscreen, NumberInput, PassphraseEntry, PinEntry, Progress, ScrollableFrame, SimpleChoice, WordlistEntry, WordlistType
|
ButtonDetails, ButtonPage, CoinJoinProgress, ConfirmHomescreen, Flow, FlowPages, Frame,
|
||||||
|
Homescreen, Lockscreen, NumberInput, PassphraseEntry, PinEntry, Progress, ScrollableFrame,
|
||||||
|
SimpleChoice, WordlistEntry, WordlistType,
|
||||||
},
|
},
|
||||||
theme, ModelTRFeatures,
|
theme, ModelTRFeatures,
|
||||||
};
|
};
|
||||||
@ -114,6 +116,29 @@ impl UIFeaturesFirmware for ModelTRFeatures {
|
|||||||
Ok(layout)
|
Ok(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn confirm_reset_device(recovery: bool) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
|
let (title, button) = if recovery {
|
||||||
|
(
|
||||||
|
TR::recovery__title_recover.into(),
|
||||||
|
TR::reset__button_recover.into(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
TR::reset__title_create_wallet.into(),
|
||||||
|
TR::reset__button_create.into(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
let ops = OpTextLayout::new(theme::TEXT_NORMAL)
|
||||||
|
.text_normal(TR::reset__by_continuing)
|
||||||
|
.next_page()
|
||||||
|
.text_normal(TR::reset__more_info_at)
|
||||||
|
.newline()
|
||||||
|
.text_bold(TR::reset__tos_link);
|
||||||
|
let formatted = FormattedText::new(ops).vertically_centered();
|
||||||
|
|
||||||
|
content_in_button_page(title, formatted, button, Some("".into()), false)
|
||||||
|
}
|
||||||
|
|
||||||
fn check_homescreen_format(image: BinaryData, _accept_toif: bool) -> bool {
|
fn check_homescreen_format(image: BinaryData, _accept_toif: bool) -> bool {
|
||||||
super::component::check_homescreen_format(image)
|
super::component::check_homescreen_format(image)
|
||||||
}
|
}
|
||||||
|
@ -552,32 +552,6 @@ extern "C" fn new_confirm_properties(n_args: usize, args: *const Obj, kwargs: *m
|
|||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn new_confirm_reset_device(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
|
||||||
let title: TString = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
|
||||||
let button: TString = kwargs.get(Qstr::MP_QSTR_button)?.try_into()?;
|
|
||||||
|
|
||||||
let par_array: [Paragraph<'static>; 3] = [
|
|
||||||
Paragraph::new(&theme::TEXT_NORMAL, TR::reset__by_continuing).with_bottom_padding(17), /* simulating a carriage return */
|
|
||||||
Paragraph::new(&theme::TEXT_NORMAL, TR::reset__more_info_at),
|
|
||||||
Paragraph::new(&theme::TEXT_DEMIBOLD, TR::reset__tos_link),
|
|
||||||
];
|
|
||||||
let paragraphs = Paragraphs::new(par_array);
|
|
||||||
let buttons = Button::cancel_confirm(
|
|
||||||
Button::with_icon(theme::ICON_CANCEL),
|
|
||||||
Button::with_text(button).styled(theme::button_confirm()),
|
|
||||||
true,
|
|
||||||
);
|
|
||||||
let obj = LayoutObj::new(Frame::left_aligned(
|
|
||||||
theme::label_title(),
|
|
||||||
title,
|
|
||||||
Dialog::new(paragraphs, buttons),
|
|
||||||
))?;
|
|
||||||
Ok(obj.into())
|
|
||||||
};
|
|
||||||
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" fn new_show_address_details(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
extern "C" fn new_show_address_details(n_args: usize, args: *const Obj, kwargs: *mut Map) -> Obj {
|
||||||
let block = move |_args: &[Obj], kwargs: &Map| {
|
let block = move |_args: &[Obj], kwargs: &Map| {
|
||||||
let qr_title: TString<'static> = kwargs.get(Qstr::MP_QSTR_qr_title)?.try_into()?;
|
let qr_title: TString<'static> = kwargs.get(Qstr::MP_QSTR_qr_title)?.try_into()?;
|
||||||
@ -1240,14 +1214,6 @@ pub static mp_module_trezorui2: Module = obj_module! {
|
|||||||
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
/// the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
Qstr::MP_QSTR_confirm_properties => obj_fn_kw!(0, new_confirm_properties).as_obj(),
|
||||||
|
|
||||||
/// def confirm_reset_device(
|
|
||||||
/// *,
|
|
||||||
/// title: str,
|
|
||||||
/// button: str,
|
|
||||||
/// ) -> LayoutObj[UiResult]:
|
|
||||||
/// """Confirm TOS before device setup."""
|
|
||||||
Qstr::MP_QSTR_confirm_reset_device => obj_fn_kw!(0, new_confirm_reset_device).as_obj(),
|
|
||||||
|
|
||||||
/// def show_address_details(
|
/// def show_address_details(
|
||||||
/// *,
|
/// *,
|
||||||
/// qr_title: str,
|
/// qr_title: str,
|
||||||
|
@ -122,6 +122,37 @@ impl UIFeaturesFirmware for ModelTTFeatures {
|
|||||||
Ok(layout)
|
Ok(layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn confirm_reset_device(recovery: bool) -> Result<impl LayoutMaybeTrace, Error> {
|
||||||
|
let (title, button) = if recovery {
|
||||||
|
(
|
||||||
|
TR::recovery__title_recover.into(),
|
||||||
|
TR::reset__button_recover.into(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
(
|
||||||
|
TR::reset__title_create_wallet.into(),
|
||||||
|
TR::reset__button_create.into(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
let par_array: [Paragraph<'static>; 3] = [
|
||||||
|
Paragraph::new(&theme::TEXT_NORMAL, TR::reset__by_continuing).with_bottom_padding(17), /* simulating a carriage return */
|
||||||
|
Paragraph::new(&theme::TEXT_NORMAL, TR::reset__more_info_at),
|
||||||
|
Paragraph::new(&theme::TEXT_DEMIBOLD, TR::reset__tos_link),
|
||||||
|
];
|
||||||
|
let paragraphs = Paragraphs::new(par_array);
|
||||||
|
let buttons = Button::cancel_confirm(
|
||||||
|
Button::with_icon(theme::ICON_CANCEL),
|
||||||
|
Button::with_text(button).styled(theme::button_confirm()),
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
let layout = RootComponent::new(Frame::left_aligned(
|
||||||
|
theme::label_title(),
|
||||||
|
title,
|
||||||
|
Dialog::new(paragraphs, buttons),
|
||||||
|
));
|
||||||
|
Ok(layout)
|
||||||
|
}
|
||||||
|
|
||||||
fn check_homescreen_format(image: BinaryData, accept_toif: bool) -> bool {
|
fn check_homescreen_format(image: BinaryData, accept_toif: bool) -> bool {
|
||||||
super::component::check_homescreen_format(image, false)
|
super::component::check_homescreen_format(image, false)
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ pub trait UIFeaturesFirmware {
|
|||||||
fingerprint: TString<'static>,
|
fingerprint: TString<'static>,
|
||||||
) -> Result<impl LayoutMaybeTrace, Error>;
|
) -> Result<impl LayoutMaybeTrace, Error>;
|
||||||
|
|
||||||
|
fn confirm_reset_device(recovery: bool) -> Result<impl LayoutMaybeTrace, Error>;
|
||||||
|
|
||||||
fn check_homescreen_format(image: BinaryData, accept_toif: bool) -> bool;
|
fn check_homescreen_format(image: BinaryData, accept_toif: bool) -> bool;
|
||||||
|
|
||||||
fn request_bip39(
|
fn request_bip39(
|
||||||
|
@ -76,11 +76,6 @@ def confirm_properties(
|
|||||||
the value is to be rendered as binary with monospace font, False otherwise."""
|
the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_mercury/layout.rs
|
|
||||||
def flow_confirm_reset(recovery: bool) -> LayoutObj[UiResult]:
|
|
||||||
"""Confirm TOS before creating wallet creation or wallet recovery."""
|
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_mercury/layout.rs
|
# rust/src/ui/model_mercury/layout.rs
|
||||||
def flow_confirm_set_new_pin(
|
def flow_confirm_set_new_pin(
|
||||||
*,
|
*,
|
||||||
@ -397,15 +392,6 @@ def confirm_properties(
|
|||||||
This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
This only concerns the text style, you need to decode the value to UTF-8 in python."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
|
||||||
def confirm_reset_device(
|
|
||||||
*,
|
|
||||||
title: str,
|
|
||||||
button: str,
|
|
||||||
) -> LayoutObj[UiResult]:
|
|
||||||
"""Confirm TOS before device setup."""
|
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tr/layout.rs
|
# rust/src/ui/model_tr/layout.rs
|
||||||
def confirm_backup() -> LayoutObj[UiResult]:
|
def confirm_backup() -> LayoutObj[UiResult]:
|
||||||
"""Strongly recommend user to do backup."""
|
"""Strongly recommend user to do backup."""
|
||||||
@ -707,15 +693,6 @@ def confirm_properties(
|
|||||||
the value is to be rendered as binary with monospace font, False otherwise."""
|
the value is to be rendered as binary with monospace font, False otherwise."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
|
||||||
def confirm_reset_device(
|
|
||||||
*,
|
|
||||||
title: str,
|
|
||||||
button: str,
|
|
||||||
) -> LayoutObj[UiResult]:
|
|
||||||
"""Confirm TOS before device setup."""
|
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/model_tt/layout.rs
|
# rust/src/ui/model_tt/layout.rs
|
||||||
def show_address_details(
|
def show_address_details(
|
||||||
*,
|
*,
|
||||||
|
@ -114,6 +114,11 @@ def confirm_homescreen(
|
|||||||
"""Confirm homescreen."""
|
"""Confirm homescreen."""
|
||||||
|
|
||||||
|
|
||||||
|
# rust/src/ui/api/firmware_upy.rs
|
||||||
|
def confirm_reset_device(recovery: bool) -> LayoutObj[UiResult]:
|
||||||
|
"""Confirm TOS before creating wallet creation or wallet recovery."""
|
||||||
|
|
||||||
|
|
||||||
# rust/src/ui/api/firmware_upy.rs
|
# rust/src/ui/api/firmware_upy.rs
|
||||||
def request_bip39(
|
def request_bip39(
|
||||||
*,
|
*,
|
||||||
|
@ -67,7 +67,7 @@ async def recovery_device(msg: RecoveryDevice) -> Success:
|
|||||||
return await recovery_process()
|
return await recovery_process()
|
||||||
|
|
||||||
if recovery_type == RecoveryType.NormalRecovery:
|
if recovery_type == RecoveryType.NormalRecovery:
|
||||||
await confirm_reset_device(TR.recovery__title_recover, recovery=True)
|
await confirm_reset_device(recovery=True)
|
||||||
|
|
||||||
# wipe storage to make sure the device is in a clear state
|
# wipe storage to make sure the device is in a clear state
|
||||||
storage.reset()
|
storage.reset()
|
||||||
|
@ -55,7 +55,7 @@ async def reset_device(msg: ResetDevice) -> Success:
|
|||||||
_validate_reset_device(msg)
|
_validate_reset_device(msg)
|
||||||
|
|
||||||
# make sure user knows they're setting up a new wallet
|
# make sure user knows they're setting up a new wallet
|
||||||
await confirm_reset_device(TR.reset__title_create_wallet)
|
await confirm_reset_device()
|
||||||
|
|
||||||
# Rendering empty loader so users do not feel a freezing screen
|
# Rendering empty loader so users do not feel a freezing screen
|
||||||
render_empty_loader(config.StorageMessage.PROCESSING_MSG)
|
render_empty_loader(config.StorageMessage.PROCESSING_MSG)
|
||||||
|
@ -89,8 +89,10 @@ def confirm_single(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def confirm_reset_device(_title: str, recovery: bool = False) -> Awaitable[None]:
|
def confirm_reset_device(recovery: bool = False) -> Awaitable[None]:
|
||||||
return raise_if_not_confirmed(trezorui2.flow_confirm_reset(recovery=recovery), None)
|
return raise_if_not_confirmed(
|
||||||
|
trezorui_api.confirm_reset_device(recovery=recovery), None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def show_wallet_created_success() -> None:
|
async def show_wallet_created_success() -> None:
|
||||||
|
@ -109,19 +109,10 @@ def confirm_single(
|
|||||||
|
|
||||||
|
|
||||||
def confirm_reset_device(
|
def confirm_reset_device(
|
||||||
title: str,
|
|
||||||
recovery: bool = False,
|
recovery: bool = False,
|
||||||
) -> Awaitable[None]:
|
) -> Awaitable[None]:
|
||||||
if recovery:
|
|
||||||
button = TR.reset__button_recover
|
|
||||||
else:
|
|
||||||
button = TR.reset__button_create
|
|
||||||
|
|
||||||
return raise_if_not_confirmed(
|
return raise_if_not_confirmed(
|
||||||
trezorui2.confirm_reset_device(
|
trezorui_api.confirm_reset_device(recovery=recovery),
|
||||||
title=title,
|
|
||||||
button=button,
|
|
||||||
),
|
|
||||||
"recover_device" if recovery else "setup_device",
|
"recover_device" if recovery else "setup_device",
|
||||||
ButtonRequestType.ProtectCall if recovery else ButtonRequestType.ResetDevice,
|
ButtonRequestType.ProtectCall if recovery else ButtonRequestType.ResetDevice,
|
||||||
)
|
)
|
||||||
|
@ -84,17 +84,9 @@ def confirm_single(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def confirm_reset_device(title: str, recovery: bool = False) -> Awaitable[None]:
|
def confirm_reset_device(recovery: bool = False) -> Awaitable[None]:
|
||||||
if recovery:
|
|
||||||
button = TR.reset__button_recover
|
|
||||||
else:
|
|
||||||
button = TR.reset__button_create
|
|
||||||
|
|
||||||
return raise_if_not_confirmed(
|
return raise_if_not_confirmed(
|
||||||
trezorui2.confirm_reset_device(
|
trezorui_api.confirm_reset_device(recovery=recovery),
|
||||||
title=title,
|
|
||||||
button=button,
|
|
||||||
),
|
|
||||||
"recover_device" if recovery else "setup_device",
|
"recover_device" if recovery else "setup_device",
|
||||||
(ButtonRequestType.ProtectCall if recovery else ButtonRequestType.ResetDevice),
|
(ButtonRequestType.ProtectCall if recovery else ButtonRequestType.ResetDevice),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user