Skip to content

Commit

Permalink
Enable to set a setting page when displaying Home screen
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Sep 27, 2024
1 parent 60a6d88 commit 4e47ade
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions ledger_device_sdk/src/nbgl/nbgl_home_and_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub struct NbglHomeAndSettings {
generic_contents: nbgl_genericContents_t,
info_list: nbgl_contentInfoList_t,
icon: nbgl_icon_details_t,
start_page: u8,
}

impl SyncNBGL for NbglHomeAndSettings {}
Expand All @@ -76,6 +77,7 @@ impl<'a> NbglHomeAndSettings {
generic_contents: nbgl_genericContents_t::default(),
info_list: nbgl_contentInfoList_t::default(),
icon: nbgl_icon_details_t::default(),
start_page: INIT_HOME_PAGE as u8,
}
}

Expand Down Expand Up @@ -127,6 +129,13 @@ impl<'a> NbglHomeAndSettings {
}
}

pub fn set_page(self, page: u8) -> NbglHomeAndSettings {
NbglHomeAndSettings {
start_page: page,
..self
}
}

/// Show the home screen and settings page.
/// This function will block until an APDU is received or the user quits the app.
/// DEPRECATED as it constraints to refresh screen for every received APDU.
Expand Down Expand Up @@ -186,7 +195,7 @@ impl<'a> NbglHomeAndSettings {
self.app_name.as_ptr() as *const c_char,
&self.icon as *const nbgl_icon_details_t,
core::ptr::null(),
INIT_HOME_PAGE as u8,
self.start_page,
&self.generic_contents as *const nbgl_genericContents_t,
&self.info_list as *const nbgl_contentInfoList_t,
core::ptr::null(),
Expand Down Expand Up @@ -263,7 +272,7 @@ impl<'a> NbglHomeAndSettings {
self.app_name.as_ptr() as *const c_char,
&self.icon as *const nbgl_icon_details_t,
core::ptr::null(),
INIT_HOME_PAGE as u8,
self.start_page,
&self.generic_contents as *const nbgl_genericContents_t,
&self.info_list as *const nbgl_contentInfoList_t,
core::ptr::null(),
Expand Down

0 comments on commit 4e47ade

Please sign in to comment.