Skip to content

Commit 7a1b5f5

Browse files
committed
feat: allow to choose light review or not
1 parent 041bded commit 7a1b5f5

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

ledger_device_sdk/src/nbgl/nbgl_review.rs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub struct NbglReview<'a> {
99
glyph: Option<&'a NbglGlyph<'a>>,
1010
tx_type: TransactionType,
1111
blind: bool,
12+
light: bool,
1213
}
1314

1415
impl SyncNBGL for NbglReview<'_> {}
@@ -22,6 +23,7 @@ impl<'a> NbglReview<'a> {
2223
glyph: None,
2324
tx_type: TransactionType::Transaction,
2425
blind: false,
26+
light: false,
2527
}
2628
}
2729

@@ -36,6 +38,13 @@ impl<'a> NbglReview<'a> {
3638
}
3739
}
3840

41+
pub fn light(self) -> NbglReview<'a> {
42+
NbglReview {
43+
light: true,
44+
..self
45+
}
46+
}
47+
3948
pub fn titles(
4049
self,
4150
title: &'a str,
@@ -106,15 +115,27 @@ impl<'a> NbglReview<'a> {
106115
);
107116
}
108117
false => {
109-
nbgl_useCaseReview(
110-
self.tx_type.to_c_type(false),
111-
&tag_value_list as *const nbgl_contentTagValueList_t,
112-
&icon as *const nbgl_icon_details_t,
113-
self.title.as_ptr() as *const c_char,
114-
self.subtitle.as_ptr() as *const c_char,
115-
self.finish_title.as_ptr() as *const c_char,
116-
Some(choice_callback),
117-
);
118+
if self.light {
119+
nbgl_useCaseReviewLight(
120+
self.tx_type.to_c_type(false),
121+
&tag_value_list as *const nbgl_contentTagValueList_t,
122+
&icon as *const nbgl_icon_details_t,
123+
self.title.as_ptr() as *const c_char,
124+
self.subtitle.as_ptr() as *const c_char,
125+
self.finish_title.as_ptr() as *const c_char,
126+
Some(choice_callback),
127+
);
128+
} else {
129+
nbgl_useCaseReview(
130+
self.tx_type.to_c_type(false),
131+
&tag_value_list as *const nbgl_contentTagValueList_t,
132+
&icon as *const nbgl_icon_details_t,
133+
self.title.as_ptr() as *const c_char,
134+
self.subtitle.as_ptr() as *const c_char,
135+
self.finish_title.as_ptr() as *const c_char,
136+
Some(choice_callback),
137+
);
138+
}
118139
}
119140
}
120141
let sync_ret = self.ux_sync_wait(false);

0 commit comments

Comments
 (0)