1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 14:58:09 +00:00

fix(core/ui): T3T1: ethereum signtx hold

[no changelog]
This commit is contained in:
Martin Milata 2024-06-05 20:33:14 +02:00 committed by matejcik
parent 09fc0ebf3e
commit 6911870654
2 changed files with 35 additions and 26 deletions

View File

@ -63,6 +63,7 @@ impl FlowState for ConfirmAction {
Decision::Goto(ConfirmAction::Intro, SwipeDirection::Right)
}
(ConfirmAction::Menu, FlowMsg::Choice(0)) => Decision::Return(FlowMsg::Cancelled),
(ConfirmAction::Menu, FlowMsg::Choice(1)) => Decision::Return(FlowMsg::Info),
(ConfirmAction::Confirm, FlowMsg::Confirmed) => Decision::Return(FlowMsg::Confirmed),
(ConfirmAction::Confirm, FlowMsg::Info) => {
Decision::Goto(ConfirmAction::Menu, SwipeDirection::Left)
@ -97,6 +98,7 @@ impl FlowState for ConfirmActionSimple {
Decision::Goto(ConfirmActionSimple::Intro, SwipeDirection::Right)
}
(ConfirmActionSimple::Menu, FlowMsg::Choice(0)) => Decision::Return(FlowMsg::Cancelled),
(ConfirmActionSimple::Menu, FlowMsg::Choice(1)) => Decision::Return(FlowMsg::Info),
_ => Decision::Nothing,
}
}
@ -166,6 +168,7 @@ fn new_confirm_action_obj(_args: &[Obj], kwargs: &Map) -> Result<Obj, error::Err
verb_cancel,
prompt_screen.then_some(prompt_title),
hold,
false,
)
}
@ -177,6 +180,7 @@ pub fn new_confirm_action_simple<T: Component + Paginate + MaybeTrace + 'static>
verb_cancel: Option<TString<'static>>,
prompt_screen: Option<TString<'static>>,
hold: bool,
info: bool,
) -> Result<Obj, error::Error> {
let mut content_intro =
Frame::left_aligned(title, SwipeContent::new(SwipePage::vertical(content)))
@ -198,23 +202,23 @@ pub fn new_confirm_action_simple<T: Component + Paginate + MaybeTrace + 'static>
})
.with_pages(move |intro_pages| intro_pages + prompt_pages);
let content_menu = if let Some(verb_cancel) = verb_cancel {
Frame::left_aligned(
"".into(),
VerticalMenu::empty().danger(theme::ICON_CANCEL, verb_cancel),
)
} else {
Frame::left_aligned(
"".into(),
VerticalMenu::empty().danger(theme::ICON_CANCEL, TR::buttons__cancel.into()),
)
let mut menu_choices = VerticalMenu::empty().danger(
theme::ICON_CANCEL,
verb_cancel.unwrap_or(TR::buttons__cancel.into()),
);
if info {
menu_choices = menu_choices.item(
theme::ICON_CHEVRON_RIGHT,
TR::words__title_information.into(),
);
}
.with_cancel_button()
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
.map(move |msg| match msg {
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(_)) => Some(FlowMsg::Choice(0)),
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
});
let content_menu = Frame::left_aligned("".into(), menu_choices)
.with_cancel_button()
.with_swipe(SwipeDirection::Right, SwipeSettings::immediate())
.map(move |msg| match msg {
FrameMsg::Content(VerticalMenuChoiceMsg::Selected(i)) => Some(FlowMsg::Choice(i)),
FrameMsg::Button(_) => Some(FlowMsg::Cancelled),
});
if let Some(prompt_title) = prompt_screen {
let (prompt, prompt_action) = if hold {

View File

@ -295,6 +295,7 @@ extern "C" fn new_confirm_emphasized(n_args: usize, args: *const Obj, kwargs: *m
None,
Some(title),
false,
false,
)
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
@ -391,6 +392,7 @@ impl ConfirmBlobParams {
self.verb_cancel,
self.prompt.then_some(self.title),
self.hold,
self.info_button,
)
}
}
@ -459,7 +461,7 @@ extern "C" fn new_confirm_address(n_args: usize, args: *const Obj, kwargs: *mut
}
.into_paragraphs();
flow::new_confirm_action_simple(paragraphs, title, None, None, None, false)
flow::new_confirm_action_simple(paragraphs, title, None, None, None, false, false)
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
@ -484,6 +486,7 @@ extern "C" fn new_confirm_properties(n_args: usize, args: *const Obj, kwargs: *m
None,
hold.then_some(title),
hold,
false,
)
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
@ -613,14 +616,15 @@ extern "C" fn new_confirm_total(n_args: usize, args: *const Obj, kwargs: *mut Ma
paragraphs.add(Paragraph::new(&theme::TEXT_MONO, value));
}
// FIXME: hold
let obj = LayoutObj::new(SwipeUpScreen::new(
Frame::left_aligned(title, SwipeContent::new(paragraphs.into_paragraphs()))
.with_menu_button()
.with_footer(TR::instructions__swipe_up.into(), None)
.with_swipe(SwipeDirection::Up, SwipeSettings::default()),
))?;
Ok(obj.into())
flow::new_confirm_action_simple(
paragraphs.into_paragraphs(),
title,
None,
None,
Some(title),
true,
true,
)
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
}
@ -923,6 +927,7 @@ extern "C" fn new_confirm_coinjoin(n_args: usize, args: *const Obj, kwargs: *mut
None,
Some(TR::coinjoin__title.into()),
true,
false,
)
};
unsafe { util::try_with_args_and_kwargs(n_args, args, kwargs, block) }
@ -1083,7 +1088,7 @@ extern "C" fn new_confirm_recovery(n_args: usize, args: *const Obj, kwargs: *mut
}
extern "C" fn new_select_word_count(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 obj = LayoutObj::new(Frame::left_aligned(
TR::recovery__num_of_words.into(),
SelectWordCount::new(),