|
|
|
@ -100,10 +100,9 @@ impl TryFrom<SelectWordCountMsg> for Obj {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<F, T, U> ComponentMsgObj for FidoConfirm<F, T, U>
|
|
|
|
|
impl<F, U> ComponentMsgObj for FidoConfirm<F, U>
|
|
|
|
|
where
|
|
|
|
|
F: Fn(usize) -> T,
|
|
|
|
|
T: StringType,
|
|
|
|
|
F: Fn(usize) -> TString<'static>,
|
|
|
|
|
U: Component<Msg = CancelConfirmMsg>,
|
|
|
|
|
{
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
@ -141,10 +140,7 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T> ComponentMsgObj for PinKeyboard<T>
|
|
|
|
|
where
|
|
|
|
|
T: AsRef<str>,
|
|
|
|
|
{
|
|
|
|
|
impl ComponentMsgObj for PinKeyboard<'_> {
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
match msg {
|
|
|
|
|
PinKeyboardMsg::Confirmed => self.pin().try_into(),
|
|
|
|
@ -162,10 +158,9 @@ impl ComponentMsgObj for PassphraseKeyboard {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T, U> ComponentMsgObj for MnemonicKeyboard<T, U>
|
|
|
|
|
impl<T> ComponentMsgObj for MnemonicKeyboard<T>
|
|
|
|
|
where
|
|
|
|
|
T: MnemonicInput,
|
|
|
|
|
U: AsRef<str>,
|
|
|
|
|
{
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
match msg {
|
|
|
|
@ -181,10 +176,9 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T, U> ComponentMsgObj for Frame<T, U>
|
|
|
|
|
impl<T> ComponentMsgObj for Frame<T>
|
|
|
|
|
where
|
|
|
|
|
T: ComponentMsgObj,
|
|
|
|
|
U: AsRef<str>,
|
|
|
|
|
{
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
match msg {
|
|
|
|
@ -194,10 +188,9 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T, U> ComponentMsgObj for ButtonPage<T, U>
|
|
|
|
|
impl<T> ComponentMsgObj for ButtonPage<T>
|
|
|
|
|
where
|
|
|
|
|
T: Component + Paginate,
|
|
|
|
|
U: AsRef<str> + From<&'static str>,
|
|
|
|
|
{
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
match msg {
|
|
|
|
@ -269,10 +262,7 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T> ComponentMsgObj for Progress<T>
|
|
|
|
|
where
|
|
|
|
|
T: StringType,
|
|
|
|
|
{
|
|
|
|
|
impl ComponentMsgObj for Progress {
|
|
|
|
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
unreachable!()
|
|
|
|
|
}
|
|
|
|
@ -286,7 +276,7 @@ impl ComponentMsgObj for Homescreen {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ComponentMsgObj for Lockscreen {
|
|
|
|
|
impl ComponentMsgObj for Lockscreen<'_> {
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
match msg {
|
|
|
|
|
HomescreenMsg::Dismissed => Ok(CANCELLED.as_obj()),
|
|
|
|
@ -342,9 +332,8 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T, U> ComponentMsgObj for CoinJoinProgress<T, U>
|
|
|
|
|
impl<U> ComponentMsgObj for CoinJoinProgress<U>
|
|
|
|
|
where
|
|
|
|
|
T: AsRef<str>,
|
|
|
|
|
U: Component<Msg = Never>,
|
|
|
|
|
{
|
|
|
|
|
fn msg_try_into_obj(&self, _msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
@ -352,10 +341,7 @@ where
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<T> ComponentMsgObj for super::component::bl_confirm::Confirm<T>
|
|
|
|
|
where
|
|
|
|
|
T: AsRef<str>,
|
|
|
|
|
{
|
|
|
|
|
impl ComponentMsgObj for super::component::bl_confirm::Confirm<'_> {
|
|
|
|
|
fn msg_try_into_obj(&self, msg: Self::Msg) -> Result<Obj, Error> {
|
|
|
|
|
match msg {
|
|
|
|
|
super::component::bl_confirm::ConfirmMsg::Cancel => Ok(CANCELLED.as_obj()),
|
|
|
|
@ -401,12 +387,17 @@ extern "C" fn new_confirm_action(n_args: usize, args: *const Obj, kwargs: *mut M
|
|
|
|
|
let mut page = if hold {
|
|
|
|
|
ButtonPage::new(paragraphs, theme::BG).with_hold()?
|
|
|
|
|
} else {
|
|
|
|
|
ButtonPage::new(paragraphs, theme::BG).with_cancel_confirm(verb_cancel, verb)
|
|
|
|
|
ButtonPage::new(paragraphs, theme::BG)
|
|
|
|
|
.with_cancel_confirm(verb_cancel.map(|c| c.into()), verb.map(|c| c.into()))
|
|
|
|
|
};
|
|
|
|
|
if hold && hold_danger {
|
|
|
|
|
page = page.with_confirm_style(theme::button_danger())
|
|
|
|
|
}
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(theme::label_title(), title, page))?;
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title.into(),
|
|
|
|
|
page,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
|
|
@ -438,9 +429,9 @@ extern "C" fn new_confirm_emphasized(n_args: usize, args: *const Obj, kwargs: *m
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
ButtonPage::new(FormattedText::new(ops).vertically_centered(), theme::BG)
|
|
|
|
|
.with_cancel_confirm(None, verb),
|
|
|
|
|
.with_cancel_confirm(None, verb.map(|v| v.into())),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
@ -530,14 +521,14 @@ impl ConfirmBlobParams {
|
|
|
|
|
|
|
|
|
|
let mut page = ButtonPage::new(paragraphs, theme::BG);
|
|
|
|
|
if let Some(verb) = self.verb {
|
|
|
|
|
page = page.with_cancel_confirm(self.verb_cancel, Some(verb))
|
|
|
|
|
page = page.with_cancel_confirm(self.verb_cancel.map(|v| v.into()), Some(verb.into()))
|
|
|
|
|
}
|
|
|
|
|
if self.hold {
|
|
|
|
|
page = page.with_hold()?
|
|
|
|
|
}
|
|
|
|
|
let mut frame = Frame::left_aligned(theme::label_title(), self.title, page);
|
|
|
|
|
let mut frame = Frame::left_aligned(theme::label_title(), self.title.into(), page);
|
|
|
|
|
if let Some(subtitle) = self.subtitle {
|
|
|
|
|
frame = frame.with_subtitle(theme::label_subtitle(), subtitle);
|
|
|
|
|
frame = frame.with_subtitle(theme::label_subtitle(), subtitle.into());
|
|
|
|
|
}
|
|
|
|
|
if self.info_button {
|
|
|
|
|
frame = frame.with_info_button();
|
|
|
|
@ -604,10 +595,10 @@ extern "C" fn new_confirm_address(n_args: usize, args: *const Obj, kwargs: *mut
|
|
|
|
|
let obj = LayoutObj::new(
|
|
|
|
|
Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
ButtonPage::new(paragraphs, theme::BG)
|
|
|
|
|
.with_swipe_left()
|
|
|
|
|
.with_cancel_confirm(None, Some(verb)),
|
|
|
|
|
.with_cancel_confirm(None, Some(verb.into())),
|
|
|
|
|
)
|
|
|
|
|
.with_info_button(),
|
|
|
|
|
)?;
|
|
|
|
@ -628,13 +619,17 @@ extern "C" fn new_confirm_properties(n_args: usize, args: *const Obj, kwargs: *m
|
|
|
|
|
&theme::TEXT_MONO,
|
|
|
|
|
&theme::TEXT_MONO,
|
|
|
|
|
)?;
|
|
|
|
|
let page: ButtonPage<_, StrBuffer> = if hold {
|
|
|
|
|
let page: ButtonPage<_> = if hold {
|
|
|
|
|
ButtonPage::new(paragraphs.into_paragraphs(), theme::BG).with_hold()?
|
|
|
|
|
} else {
|
|
|
|
|
ButtonPage::new(paragraphs.into_paragraphs(), theme::BG)
|
|
|
|
|
.with_cancel_confirm(None, Some(TR::buttons__confirm.try_into()?))
|
|
|
|
|
};
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(theme::label_title(), title, page))?;
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title.into(),
|
|
|
|
|
page,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
|
|
@ -666,10 +661,10 @@ extern "C" fn new_confirm_homescreen(n_args: usize, args: *const Obj, kwargs: *m
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let tr_change: StrBuffer = TR::buttons__change.try_into()?;
|
|
|
|
|
let buttons = Button::cancel_confirm_text(None, Some(tr_change));
|
|
|
|
|
let buttons = Button::cancel_confirm_text(None, Some(tr_change.into()));
|
|
|
|
|
let obj = LayoutObj::new(Frame::centered(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
Dialog::new(painter::jpeg_painter(buffer_func, size, 1), buttons),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -691,12 +686,12 @@ extern "C" fn new_confirm_reset_device(n_args: usize, args: *const Obj, kwargs:
|
|
|
|
|
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()),
|
|
|
|
|
Button::with_text(button.into()).styled(theme::button_confirm()),
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
Dialog::new(paragraphs, buttons),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -768,7 +763,7 @@ extern "C" fn new_show_info_with_cancel(n_args: usize, args: *const Obj, kwargs:
|
|
|
|
|
let obj = LayoutObj::new(
|
|
|
|
|
Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
SimplePage::new(paragraphs.into_paragraphs(), axis, theme::BG)
|
|
|
|
|
.with_swipe_right_to_go_back(),
|
|
|
|
|
)
|
|
|
|
@ -824,7 +819,7 @@ extern "C" fn new_confirm_total(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|
|
|
|
paragraphs.add(Paragraph::new(&theme::TEXT_NORMAL, label).no_break());
|
|
|
|
|
paragraphs.add(Paragraph::new(&theme::TEXT_MONO, value));
|
|
|
|
|
}
|
|
|
|
|
let mut page: ButtonPage<_, StrBuffer> =
|
|
|
|
|
let mut page: ButtonPage<_> =
|
|
|
|
|
ButtonPage::new(paragraphs.into_paragraphs(), theme::BG).with_hold()?;
|
|
|
|
|
if cancel_arrow {
|
|
|
|
|
page = page.with_cancel_arrow()
|
|
|
|
@ -832,7 +827,7 @@ extern "C" fn new_confirm_total(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|
|
|
|
if info_button {
|
|
|
|
|
page = page.with_swipe_left();
|
|
|
|
|
}
|
|
|
|
|
let mut frame = Frame::left_aligned(theme::label_title(), title, page);
|
|
|
|
|
let mut frame = Frame::left_aligned(theme::label_title(), title.into(), page);
|
|
|
|
|
if info_button {
|
|
|
|
|
frame = frame.with_info_button();
|
|
|
|
|
}
|
|
|
|
@ -864,8 +859,8 @@ extern "C" fn new_confirm_modify_output(n_args: usize, args: *const Obj, kwargs:
|
|
|
|
|
let tr_title: StrBuffer = TR::modify_amount__title.try_into()?;
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
tr_title,
|
|
|
|
|
ButtonPage::<_, StrBuffer>::new(paragraphs, theme::BG)
|
|
|
|
|
tr_title.into(),
|
|
|
|
|
ButtonPage::<_>::new(paragraphs, theme::BG)
|
|
|
|
|
.with_cancel_confirm(Some("^".into()), Some(TR::buttons__continue.try_into()?)),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -908,8 +903,8 @@ extern "C" fn new_confirm_modify_fee(n_args: usize, args: *const Obj, kwargs: *m
|
|
|
|
|
let obj = LayoutObj::new(
|
|
|
|
|
Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
ButtonPage::<_, StrBuffer>::new(paragraphs, theme::BG)
|
|
|
|
|
title.into(),
|
|
|
|
|
ButtonPage::<_>::new(paragraphs, theme::BG)
|
|
|
|
|
.with_hold()?
|
|
|
|
|
.with_swipe_left(),
|
|
|
|
|
)
|
|
|
|
@ -963,7 +958,7 @@ fn new_show_modal(
|
|
|
|
|
title,
|
|
|
|
|
Button::cancel_confirm(
|
|
|
|
|
Button::with_icon(theme::ICON_CANCEL),
|
|
|
|
|
Button::with_text(button).styled(button_style),
|
|
|
|
|
Button::with_text(button.into()).styled(button_style),
|
|
|
|
|
false,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -977,9 +972,9 @@ fn new_show_modal(
|
|
|
|
|
IconDialog::new(
|
|
|
|
|
icon,
|
|
|
|
|
title,
|
|
|
|
|
theme::button_bar(Button::with_text(button).styled(button_style).map(|msg| {
|
|
|
|
|
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
|
|
|
|
|
})),
|
|
|
|
|
theme::button_bar(Button::with_text(button.into()).styled(button_style).map(
|
|
|
|
|
|msg| (matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
.with_value(value)
|
|
|
|
|
.with_description(description),
|
|
|
|
@ -1008,7 +1003,7 @@ extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|
|
|
|
let block = move |_args: &[Obj], kwargs: &Map| {
|
|
|
|
|
let title: StrBuffer = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
|
|
|
|
let app_name: StrBuffer = kwargs.get(Qstr::MP_QSTR_app_name)?.try_into()?;
|
|
|
|
|
let icon: Option<StrBuffer> = kwargs.get(Qstr::MP_QSTR_icon_name)?.try_into_option()?;
|
|
|
|
|
let icon: Option<TString> = kwargs.get(Qstr::MP_QSTR_icon_name)?.try_into_option()?;
|
|
|
|
|
let accounts: Gc<List> = kwargs.get(Qstr::MP_QSTR_accounts)?.try_into()?;
|
|
|
|
|
|
|
|
|
|
// Cache the page count so that we can move `accounts` into the closure.
|
|
|
|
@ -1023,14 +1018,17 @@ extern "C" fn new_confirm_fido(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|
|
|
|
|
|
|
|
|
let controls = Button::cancel_confirm(
|
|
|
|
|
Button::with_icon(theme::ICON_CANCEL),
|
|
|
|
|
Button::<StrBuffer>::with_text(TR::buttons__confirm.try_into()?)
|
|
|
|
|
.styled(theme::button_confirm()),
|
|
|
|
|
Button::with_text(TR::buttons__confirm.try_into()?).styled(theme::button_confirm()),
|
|
|
|
|
true,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let fido_page = FidoConfirm::new(app_name, get_page, page_count, icon, controls);
|
|
|
|
|
let fido_page = FidoConfirm::new(app_name.into(), get_page, page_count, icon, controls);
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::centered(theme::label_title(), title, fido_page))?;
|
|
|
|
|
let obj = LayoutObj::new(Frame::centered(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title.into(),
|
|
|
|
|
fido_page,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
|
|
@ -1098,7 +1096,7 @@ extern "C" fn new_show_mismatch(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|
|
|
|
title,
|
|
|
|
|
Button::cancel_confirm(
|
|
|
|
|
Button::with_icon(theme::ICON_BACK),
|
|
|
|
|
Button::with_text(button).styled(theme::button_reset()),
|
|
|
|
|
Button::with_text(button.into()).styled(theme::button_reset()),
|
|
|
|
|
true,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
@ -1128,10 +1126,10 @@ extern "C" fn new_show_simple(n_args: usize, args: *const Obj, kwargs: *mut Map)
|
|
|
|
|
let obj = if let Some(t) = title {
|
|
|
|
|
LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
t,
|
|
|
|
|
t.into(),
|
|
|
|
|
Dialog::new(
|
|
|
|
|
Paragraphs::new([Paragraph::new(&theme::TEXT_NORMAL, description)]),
|
|
|
|
|
theme::button_bar(Button::with_text(button).map(|msg| {
|
|
|
|
|
theme::button_bar(Button::with_text(button.into()).map(|msg| {
|
|
|
|
|
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
|
|
|
|
|
})),
|
|
|
|
|
),
|
|
|
|
@ -1142,7 +1140,7 @@ extern "C" fn new_show_simple(n_args: usize, args: *const Obj, kwargs: *mut Map)
|
|
|
|
|
theme::borders(),
|
|
|
|
|
Dialog::new(
|
|
|
|
|
Paragraphs::new([Paragraph::new(&theme::TEXT_NORMAL, description)]),
|
|
|
|
|
theme::button_bar(Button::with_text(button).map(|msg| {
|
|
|
|
|
theme::button_bar(Button::with_text(button.into()).map(|msg| {
|
|
|
|
|
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
|
|
|
|
|
})),
|
|
|
|
|
),
|
|
|
|
@ -1185,11 +1183,11 @@ extern "C" fn new_confirm_with_info(n_args: usize, args: *const Obj, kwargs: *mu
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let buttons = Button::cancel_info_confirm(button, info_button);
|
|
|
|
|
let buttons = Button::cancel_info_confirm(button.into(), info_button.into());
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
Dialog::new(paragraphs.into_paragraphs(), buttons),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1214,9 +1212,9 @@ extern "C" fn new_confirm_more(n_args: usize, args: *const Obj, kwargs: *mut Map
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
ButtonPage::new(paragraphs.into_paragraphs(), theme::BG)
|
|
|
|
|
.with_cancel_confirm(None, Some(button))
|
|
|
|
|
.with_cancel_confirm(None, Some(button.into()))
|
|
|
|
|
.with_confirm_style(theme::button_default())
|
|
|
|
|
.with_back_button(),
|
|
|
|
|
))?;
|
|
|
|
@ -1240,8 +1238,8 @@ extern "C" fn new_confirm_coinjoin(n_args: usize, args: *const Obj, kwargs: *mut
|
|
|
|
|
let tr_title: StrBuffer = TR::coinjoin__title.try_into()?;
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
tr_title,
|
|
|
|
|
ButtonPage::<_, StrBuffer>::new(paragraphs, theme::BG).with_hold()?,
|
|
|
|
|
tr_title.into(),
|
|
|
|
|
ButtonPage::<_>::new(paragraphs, theme::BG).with_hold()?,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
@ -1259,7 +1257,12 @@ extern "C" fn new_request_pin(n_args: usize, args: *const Obj, kwargs: *mut Map)
|
|
|
|
|
} else {
|
|
|
|
|
None
|
|
|
|
|
};
|
|
|
|
|
let obj = LayoutObj::new(PinKeyboard::new(prompt, subprompt, warning, allow_cancel))?;
|
|
|
|
|
let obj = LayoutObj::new(PinKeyboard::new(
|
|
|
|
|
prompt.into(),
|
|
|
|
|
subprompt.into(),
|
|
|
|
|
warning,
|
|
|
|
|
allow_cancel,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
|
|
@ -1282,7 +1285,7 @@ extern "C" fn new_request_bip39(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|
|
|
|
let can_go_back: bool = kwargs.get(Qstr::MP_QSTR_can_go_back)?.try_into()?;
|
|
|
|
|
let obj = LayoutObj::new(MnemonicKeyboard::new(
|
|
|
|
|
Bip39Input::prefilled_word(prefill_word.as_ref()),
|
|
|
|
|
prompt,
|
|
|
|
|
prompt.into(),
|
|
|
|
|
can_go_back,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1297,7 +1300,7 @@ extern "C" fn new_request_slip39(n_args: usize, args: *const Obj, kwargs: *mut M
|
|
|
|
|
let can_go_back: bool = kwargs.get(Qstr::MP_QSTR_can_go_back)?.try_into()?;
|
|
|
|
|
let obj = LayoutObj::new(MnemonicKeyboard::new(
|
|
|
|
|
Slip39Input::prefilled_word(prefill_word.as_ref()),
|
|
|
|
|
prompt,
|
|
|
|
|
prompt.into(),
|
|
|
|
|
can_go_back,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1310,12 +1313,12 @@ extern "C" fn new_select_word(n_args: usize, args: *const Obj, kwargs: *mut Map)
|
|
|
|
|
let title: StrBuffer = kwargs.get(Qstr::MP_QSTR_title)?.try_into()?;
|
|
|
|
|
let description: StrBuffer = kwargs.get(Qstr::MP_QSTR_description)?.try_into()?;
|
|
|
|
|
let words_iterable: Obj = kwargs.get(Qstr::MP_QSTR_words)?;
|
|
|
|
|
let words: [StrBuffer; 3] = util::iter_into_array(words_iterable)?;
|
|
|
|
|
let words: [TString<'static>; 3] = util::iter_into_array(words_iterable)?;
|
|
|
|
|
|
|
|
|
|
let paragraphs = Paragraphs::new([Paragraph::new(&theme::TEXT_DEMIBOLD, description)]);
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
Dialog::new(paragraphs, Button::select_word(words)),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1336,8 +1339,8 @@ extern "C" fn new_show_share_words(n_args: usize, args: *const Obj, kwargs: *mut
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
ButtonPage::<_, StrBuffer>::new(paragraphs.into_paragraphs(), theme::BG)
|
|
|
|
|
title.into(),
|
|
|
|
|
ButtonPage::<_>::new(paragraphs.into_paragraphs(), theme::BG)
|
|
|
|
|
.with_hold()?
|
|
|
|
|
.without_cancel(),
|
|
|
|
|
))?;
|
|
|
|
@ -1366,7 +1369,7 @@ extern "C" fn new_request_number(n_args: usize, args: *const Obj, kwargs: *mut M
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
NumberInputDialog::new(min_count, max_count, count, callback)?,
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1394,7 +1397,7 @@ extern "C" fn new_show_checklist(n_args: usize, args: *const Obj, kwargs: *mut M
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
Dialog::new(
|
|
|
|
|
Checklist::from_paragraphs(
|
|
|
|
|
theme::ICON_LIST_CURRENT,
|
|
|
|
@ -1407,7 +1410,7 @@ extern "C" fn new_show_checklist(n_args: usize, args: *const Obj, kwargs: *mut M
|
|
|
|
|
.with_check_width(theme::CHECKLIST_CHECK_WIDTH)
|
|
|
|
|
.with_current_offset(theme::CHECKLIST_CURRENT_OFFSET)
|
|
|
|
|
.with_done_offset(theme::CHECKLIST_DONE_OFFSET),
|
|
|
|
|
theme::button_bar(Button::with_text(button).map(|msg| {
|
|
|
|
|
theme::button_bar(Button::with_text(button.into()).map(|msg| {
|
|
|
|
|
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
|
|
|
|
|
})),
|
|
|
|
|
),
|
|
|
|
@ -1440,10 +1443,10 @@ extern "C" fn new_confirm_recovery(n_args: usize, args: *const Obj, kwargs: *mut
|
|
|
|
|
let obj = if info_button {
|
|
|
|
|
LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
notification,
|
|
|
|
|
notification.into(),
|
|
|
|
|
Dialog::new(
|
|
|
|
|
paragraphs,
|
|
|
|
|
Button::<StrBuffer>::cancel_info_confirm(
|
|
|
|
|
Button::cancel_info_confirm(
|
|
|
|
|
TR::buttons__continue.try_into()?,
|
|
|
|
|
TR::buttons__more_info.try_into()?,
|
|
|
|
|
),
|
|
|
|
@ -1452,8 +1455,11 @@ extern "C" fn new_confirm_recovery(n_args: usize, args: *const Obj, kwargs: *mut
|
|
|
|
|
} else {
|
|
|
|
|
LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
notification,
|
|
|
|
|
Dialog::new(paragraphs, Button::cancel_confirm_text(None, Some(button))),
|
|
|
|
|
notification.into(),
|
|
|
|
|
Dialog::new(
|
|
|
|
|
paragraphs,
|
|
|
|
|
Button::cancel_confirm_text(None, Some(button.into())),
|
|
|
|
|
),
|
|
|
|
|
))?
|
|
|
|
|
};
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1477,7 +1483,7 @@ extern "C" fn new_select_word_count(n_args: usize, args: *const Obj, kwargs: *mu
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
title,
|
|
|
|
|
title.into(),
|
|
|
|
|
Dialog::new(paragraphs, SelectWordCount::new()),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
@ -1494,14 +1500,13 @@ extern "C" fn new_show_group_share_success(
|
|
|
|
|
let lines_iterable: Obj = kwargs.get(Qstr::MP_QSTR_lines)?;
|
|
|
|
|
let lines: [StrBuffer; 4] = util::iter_into_array(lines_iterable)?;
|
|
|
|
|
|
|
|
|
|
let obj = LayoutObj::new(IconDialog::new_shares(
|
|
|
|
|
lines,
|
|
|
|
|
theme::button_bar(
|
|
|
|
|
Button::<StrBuffer>::with_text(TR::buttons__continue.try_into()?).map(|msg| {
|
|
|
|
|
(matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed)
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
))?;
|
|
|
|
|
let obj =
|
|
|
|
|
LayoutObj::new(IconDialog::new_shares(
|
|
|
|
|
lines,
|
|
|
|
|
theme::button_bar(Button::with_text(TR::buttons__continue.try_into()?).map(
|
|
|
|
|
|msg| (matches!(msg, ButtonMsg::Clicked)).then(|| CancelConfirmMsg::Confirmed),
|
|
|
|
|
)),
|
|
|
|
|
))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
|
|
@ -1522,8 +1527,8 @@ extern "C" fn new_show_remaining_shares(n_args: usize, args: *const Obj, kwargs:
|
|
|
|
|
let tr_title: StrBuffer = TR::recovery__title_remaining_shares.try_into()?;
|
|
|
|
|
let obj = LayoutObj::new(Frame::left_aligned(
|
|
|
|
|
theme::label_title(),
|
|
|
|
|
tr_title,
|
|
|
|
|
ButtonPage::<_, StrBuffer>::new(paragraphs.into_paragraphs(), theme::BG)
|
|
|
|
|
tr_title.into(),
|
|
|
|
|
ButtonPage::<_>::new(paragraphs.into_paragraphs(), theme::BG)
|
|
|
|
|
.with_cancel_confirm(None, Some(TR::buttons__continue.try_into()?))
|
|
|
|
|
.with_confirm_style(theme::button_default())
|
|
|
|
|
.without_cancel(),
|
|
|
|
@ -1541,7 +1546,7 @@ extern "C" fn new_show_progress(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
|
|
|
|
|
|
|
|
|
// Description updates are received as &str and we need to provide a way to
|
|
|
|
|
// convert them to StrBuffer.
|
|
|
|
|
let obj = LayoutObj::new(Progress::new(title, indeterminate, description))?;
|
|
|
|
|
let obj = LayoutObj::new(Progress::new(title.into(), indeterminate, description))?;
|
|
|
|
|
Ok(obj.into())
|
|
|
|
|
};
|
|
|
|
|
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
|
|
|
|
@ -1556,7 +1561,7 @@ extern "C" fn new_show_progress_coinjoin(n_args: usize, args: *const Obj, kwargs
|
|
|
|
|
|
|
|
|
|
// The second type parameter is actually not used in `new()` but we need to
|
|
|
|
|
// provide it.
|
|
|
|
|
let progress = CoinJoinProgress::<_, Never>::new(title, indeterminate)?;
|
|
|
|
|
let progress = CoinJoinProgress::<Never>::new(title.into(), indeterminate)?;
|
|
|
|
|
let obj = if time_ms > 0 && indeterminate {
|
|
|
|
|
let timeout = Timeout::new(time_ms);
|
|
|
|
|
LayoutObj::new((timeout, progress.map(|_msg| None)))?
|
|
|
|
@ -1635,7 +1640,7 @@ extern "C" fn new_confirm_firmware_update(
|
|
|
|
|
|
|
|
|
|
let title_str = TR::firmware_update__title.try_into()?;
|
|
|
|
|
let title = Label::left_aligned(title_str, theme::TEXT_BOLD).vertically_centered();
|
|
|
|
|
let msg = Label::left_aligned(description, theme::TEXT_NORMAL);
|
|
|
|
|
let msg = Label::left_aligned(description.into(), theme::TEXT_NORMAL);
|
|
|
|
|
|
|
|
|
|
let left =
|
|
|
|
|
Button::with_text(TR::buttons__cancel.try_into()?).styled(theme::button_default());
|
|
|
|
@ -1645,7 +1650,7 @@ extern "C" fn new_confirm_firmware_update(
|
|
|
|
|
let obj = LayoutObj::new(
|
|
|
|
|
Confirm::new(theme::BG, left, right, ConfirmTitle::Text(title), msg).with_info(
|
|
|
|
|
TR::firmware_update__title_fingerprint.try_into()?,
|
|
|
|
|
fingerprint,
|
|
|
|
|
fingerprint.into(),
|
|
|
|
|
theme::button_moreinfo(),
|
|
|
|
|
),
|
|
|
|
|
)?;
|
|
|
|
|