Skip to content

Commit 4378a63

Browse files
committed
Enable to set a tagline when invoking NbglHomeAndSettings
1 parent bdf87ab commit 4378a63

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

ledger_device_sdk/src/nbgl/nbgl_home_and_settings.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub enum PageIndex {
4747
/// information fields, and settings switches.
4848
pub struct NbglHomeAndSettings {
4949
app_name: CString,
50+
tag_line: Option<CString>,
5051
info_contents: Vec<CString>,
5152
info_contents_ptr: Vec<*const c_char>,
5253
setting_contents: Vec<[CString; 2]>,
@@ -74,6 +75,7 @@ impl<'a> NbglHomeAndSettings {
7475
pub fn new() -> NbglHomeAndSettings {
7576
NbglHomeAndSettings {
7677
app_name: CString::new("").unwrap(),
78+
tag_line: None,
7779
info_contents: Vec::default(),
7880
info_contents_ptr: Vec::default(),
7981
setting_contents: Vec::default(),
@@ -109,6 +111,15 @@ impl<'a> NbglHomeAndSettings {
109111
}
110112
}
111113

114+
pub fn tagline(
115+
self,
116+
tagline: &'a str) -> NbglHomeAndSettings {
117+
NbglHomeAndSettings {
118+
tag_line: Some(CString::new(tagline).unwrap()),
119+
..self
120+
}
121+
}
122+
112123
pub fn settings(
113124
self,
114125
nvm_data: &'a mut AtomicStorage<[u8; SETTINGS_SIZE]>,
@@ -202,7 +213,10 @@ impl<'a> NbglHomeAndSettings {
202213
nbgl_useCaseHomeAndSettings(
203214
self.app_name.as_ptr() as *const c_char,
204215
&self.icon as *const nbgl_icon_details_t,
205-
core::ptr::null(),
216+
match self.tag_line {
217+
None => core::ptr::null(),
218+
Some(ref tag) => tag.as_ptr() as *const c_char,
219+
},
206220
match self.start_page {
207221
PageIndex::Home => INIT_HOME_PAGE as u8,
208222
PageIndex::Settings(idx) => idx,

0 commit comments

Comments
 (0)