diff --git a/ledger_device_sdk/src/nbgl/nbgl_review.rs b/ledger_device_sdk/src/nbgl/nbgl_review.rs index 31ccb66c..e49cbf9b 100644 --- a/ledger_device_sdk/src/nbgl/nbgl_review.rs +++ b/ledger_device_sdk/src/nbgl/nbgl_review.rs @@ -9,6 +9,7 @@ pub struct NbglReview<'a> { glyph: Option<&'a NbglGlyph<'a>>, tx_type: TransactionType, blind: bool, + light: bool, } impl SyncNBGL for NbglReview<'_> {} @@ -22,6 +23,7 @@ impl<'a> NbglReview<'a> { glyph: None, tx_type: TransactionType::Transaction, blind: false, + light: false, } } @@ -36,6 +38,13 @@ impl<'a> NbglReview<'a> { } } + pub fn light(self) -> NbglReview<'a> { + NbglReview { + light: true, + ..self + } + } + pub fn titles( self, title: &'a str, @@ -106,15 +115,27 @@ impl<'a> NbglReview<'a> { ); } false => { - nbgl_useCaseReview( - self.tx_type.to_c_type(false), - &tag_value_list as *const nbgl_contentTagValueList_t, - &icon as *const nbgl_icon_details_t, - self.title.as_ptr() as *const c_char, - self.subtitle.as_ptr() as *const c_char, - self.finish_title.as_ptr() as *const c_char, - Some(choice_callback), - ); + if self.light { + nbgl_useCaseReviewLight( + self.tx_type.to_c_type(false), + &tag_value_list as *const nbgl_contentTagValueList_t, + &icon as *const nbgl_icon_details_t, + self.title.as_ptr() as *const c_char, + self.subtitle.as_ptr() as *const c_char, + self.finish_title.as_ptr() as *const c_char, + Some(choice_callback), + ); + } else { + nbgl_useCaseReview( + self.tx_type.to_c_type(false), + &tag_value_list as *const nbgl_contentTagValueList_t, + &icon as *const nbgl_icon_details_t, + self.title.as_ptr() as *const c_char, + self.subtitle.as_ptr() as *const c_char, + self.finish_title.as_ptr() as *const c_char, + Some(choice_callback), + ); + } } } let sync_ret = self.ux_sync_wait(false); diff --git a/ledger_device_sdk/src/ui/gadgets.rs b/ledger_device_sdk/src/ui/gadgets.rs index 2492944b..041f54d7 100644 --- a/ledger_device_sdk/src/ui/gadgets.rs +++ b/ledger_device_sdk/src/ui/gadgets.rs @@ -366,9 +366,10 @@ impl<'a> Menu<'a> { pub enum PageStyle { #[default] PictureNormal, // Picture (should be 16x16) with two lines of text (page layout depends on device). - PictureBold, // Icon on top with one line of text on the bottom. - BoldNormal, // One line of bold text and one line of normal text. - Normal, // 2 lines of centered text. + PictureBold, // Icon on top with one line of text on the bottom. + BoldNormal, // One line of bold text and one line of normal text. + Normal, // 2 lines of centered text. + BoldCenteredNormal, // 2 lines of centered text, where the first one is bold } #[derive(Copy, Clone, Default)] @@ -396,6 +397,21 @@ impl<'a> From<([&'a str; 2], bool)> for Page<'a> { } } +// new bold normal or new normal +impl<'a> From<([&'a str; 2], bool, bool)> for Page<'a> { + fn from((label, bold, centered): ([&'a str; 2], bool, bool)) -> Page<'a> { + if centered { + if bold { + Page::new(PageStyle::BoldCenteredNormal, [label[0], label[1]], None) + } else { + Page::new(PageStyle::Normal, [label[0], label[1]], None) + } + } else { + Page::new(PageStyle::BoldNormal, [label[0], label[1]], None) + } + } +} + // new picture bold impl<'a> From<(&'a str, &'a Glyph<'a>)> for Page<'a> { fn from((label, glyph): (&'a str, &'a Glyph<'a>)) -> Page<'a> { @@ -418,6 +434,9 @@ impl<'a> Page<'a> { PageStyle::Normal => { self.label.place(Location::Middle, Layout::Centered, false); } + PageStyle::BoldCenteredNormal => { + self.label.place(Location::Middle, Layout::Centered, true); + } PageStyle::PictureNormal => { let mut icon_x = 16; let mut icon_y = 8;