mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-25 08:58:14 +00:00
fixup! fixup! fixup! feat(core/ui): add cancel button to paginated blobs
This commit is contained in:
parent
fc0bb63062
commit
1eff1d8e0e
@ -70,7 +70,6 @@ impl ConfirmActionStrings {
|
||||
#[derive(PartialEq)]
|
||||
pub struct ConfirmActionMenuStrings {
|
||||
verb_cancel: TString<'static>,
|
||||
has_info: bool,
|
||||
verb_info: Option<TString<'static>>,
|
||||
}
|
||||
|
||||
@ -78,7 +77,6 @@ impl ConfirmActionMenuStrings {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
verb_cancel: TR::buttons__cancel.into(),
|
||||
has_info: false,
|
||||
verb_info: None,
|
||||
}
|
||||
}
|
||||
@ -88,8 +86,7 @@ impl ConfirmActionMenuStrings {
|
||||
self
|
||||
}
|
||||
|
||||
pub const fn with_info(mut self, has_info: bool, verb_info: Option<TString<'static>>) -> Self {
|
||||
self.has_info = has_info;
|
||||
pub const fn with_verb_info(mut self, verb_info: Option<TString<'static>>) -> Self {
|
||||
self.verb_info = verb_info;
|
||||
self
|
||||
}
|
||||
@ -343,15 +340,10 @@ fn create_menu(
|
||||
let mut menu_choices =
|
||||
VerticalMenu::empty().danger(theme::ICON_CANCEL, menu_strings.verb_cancel);
|
||||
|
||||
if menu_strings.has_info {
|
||||
if let Some(verb_info) = menu_strings.verb_info {
|
||||
// The Info menu item (if present) has to be the 2nd,
|
||||
// because of MENU_ITEM_INFO = 1!
|
||||
menu_choices = menu_choices.item(
|
||||
theme::ICON_CHEVRON_RIGHT,
|
||||
menu_strings
|
||||
.verb_info
|
||||
.unwrap_or(TR::words__title_information.into()),
|
||||
);
|
||||
menu_choices = menu_choices.item(theme::ICON_CHEVRON_RIGHT, verb_info);
|
||||
}
|
||||
|
||||
let content_menu = Frame::left_aligned("".into(), menu_choices)
|
||||
|
@ -41,7 +41,6 @@ pub struct ConfirmBlobParams {
|
||||
verb: Option<TString<'static>>,
|
||||
verb_cancel: TString<'static>,
|
||||
verb_info: Option<TString<'static>>,
|
||||
info_button: bool,
|
||||
cancel_button: bool,
|
||||
menu_button: bool,
|
||||
prompt: bool,
|
||||
@ -71,7 +70,6 @@ impl ConfirmBlobParams {
|
||||
verb: None,
|
||||
verb_cancel: TR::buttons__cancel.into(),
|
||||
verb_info: None,
|
||||
info_button: false,
|
||||
cancel_button: false,
|
||||
menu_button: false,
|
||||
prompt: false,
|
||||
@ -108,11 +106,6 @@ impl ConfirmBlobParams {
|
||||
self
|
||||
}
|
||||
|
||||
pub const fn with_info_button(mut self, info_button: bool) -> Self {
|
||||
self.info_button = info_button;
|
||||
self
|
||||
}
|
||||
|
||||
pub const fn with_verb(mut self, verb: Option<TString<'static>>) -> Self {
|
||||
self.verb = verb;
|
||||
self
|
||||
@ -287,7 +280,7 @@ impl ConfirmBlobParams {
|
||||
ConfirmActionExtra::Menu(
|
||||
ConfirmActionMenuStrings::new()
|
||||
.with_verb_cancel(self.verb_cancel)
|
||||
.with_info(self.info_button, self.verb_info),
|
||||
.with_verb_info(self.verb_info),
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -302,9 +302,12 @@ extern "C" fn new_confirm_blob(n_args: usize, args: *const Obj, kwargs: *mut Map
|
||||
.with_subtitle(subtitle)
|
||||
.with_verb(verb)
|
||||
.with_verb_cancel(verb_cancel.unwrap_or(TR::buttons__cancel.into()))
|
||||
.with_verb_info(verb_info)
|
||||
.with_verb_info(if info {
|
||||
Some(verb_info.unwrap_or(TR::words__title_information.into()))
|
||||
} else {
|
||||
None
|
||||
})
|
||||
.with_extra(extra)
|
||||
.with_info_button(info)
|
||||
.with_chunkify(chunkify)
|
||||
.with_page_counter(page_counter)
|
||||
.with_cancel(cancel)
|
||||
@ -344,7 +347,6 @@ extern "C" fn new_confirm_blob_intro(n_args: usize, args: *const Obj, kwargs: *m
|
||||
.with_footer_description(Some(
|
||||
TR::buttons__confirm.into(), /* or words__confirm?? */
|
||||
))
|
||||
.with_info_button(true)
|
||||
.with_chunkify(chunkify)
|
||||
.with_page_limit(Some(1))
|
||||
.with_frame_margin(CONFIRM_BLOB_INTRO_MARGIN)
|
||||
@ -778,7 +780,11 @@ extern "C" fn new_confirm_value(n_args: usize, args: *const Obj, kwargs: *mut Ma
|
||||
.with_subtitle(subtitle)
|
||||
.with_verb(verb)
|
||||
.with_verb_cancel(verb_cancel.unwrap_or(TR::buttons__cancel.into()))
|
||||
.with_info_button(info_button)
|
||||
.with_verb_info(if info_button {
|
||||
Some(TR::words__title_information.into())
|
||||
} else {
|
||||
None
|
||||
})
|
||||
.with_chunkify(chunkify)
|
||||
.with_text_mono(text_mono)
|
||||
.with_prompt(hold)
|
||||
|
Loading…
Reference in New Issue
Block a user