Skip to content

Commit

Permalink
Settings management
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Jun 18, 2024
1 parent f9fba2f commit 8dea78f
Showing 1 changed file with 27 additions and 35 deletions.
62 changes: 27 additions & 35 deletions ledger_device_sdk/src/nbgl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,46 +217,38 @@ impl<'a> NbglHomeAndSettings<'a> {
None => nbgl_icon_details_t::default(),
};

let mut content: nbgl_content_t = nbgl_content_t::default();
let mut generic_contents = nbgl_genericContents_t {
callbackCallNeeded: false,
__bindgen_anon_1: nbgl_genericContents_t__bindgen_ty_1 {
contentsList: &content as *const nbgl_content_t,
},
nbContents: 0,
};
if NVM_REF.is_some() {
for (i, setting) in self.setting_contents.iter().enumerate() {
SWITCH_ARRAY[i].text = setting[0].as_ptr();
SWITCH_ARRAY[i].subText = setting[1].as_ptr();
for (i, setting) in self.setting_contents.iter().enumerate() {
SWITCH_ARRAY[i].text = setting[0].as_ptr();
SWITCH_ARRAY[i].subText = setting[1].as_ptr();
if NVM_REF.is_some() {
SWITCH_ARRAY[i].initState =
NVM_REF.as_mut().unwrap().get_ref()[i] as nbgl_state_t;
SWITCH_ARRAY[i].token = (FIRST_USER_TOKEN + i as u32) as u8;
SWITCH_ARRAY[i].tuneId = TuneIndex::TapCasual as u8;
}
SWITCH_ARRAY[i].token = (FIRST_USER_TOKEN + i as u32) as u8;
SWITCH_ARRAY[i].tuneId = TuneIndex::TapCasual as u8;
}

content = nbgl_content_t {
content: nbgl_content_u {
switchesList: nbgl_pageSwitchesList_s {
switches: &SWITCH_ARRAY as *const nbgl_contentSwitch_t,
nbSwitches: self.nb_settings,
},
let content: nbgl_content_t = nbgl_content_t {
content: nbgl_content_u {
switchesList: nbgl_pageSwitchesList_s {
switches: &SWITCH_ARRAY as *const nbgl_contentSwitch_t,
nbSwitches: self.nb_settings,
},
contentActionCallback: transmute(
(|token, index, page| settings_callback(token, index, page))
as fn(::core::ffi::c_int, u8, ::core::ffi::c_int),
),
type_: SWITCHES_LIST,
};

generic_contents = nbgl_genericContents_t {
callbackCallNeeded: false,
__bindgen_anon_1: nbgl_genericContents_t__bindgen_ty_1 {
contentsList: &content as *const nbgl_content_t,
},
nbContents: 1,
};
}
},
contentActionCallback: transmute(
(|token, index, page| settings_callback(token, index, page))
as fn(::core::ffi::c_int, u8, ::core::ffi::c_int),
),
type_: SWITCHES_LIST,
};

let generic_contents: nbgl_genericContents_t = nbgl_genericContents_t {
callbackCallNeeded: false,
__bindgen_anon_1: nbgl_genericContents_t__bindgen_ty_1 {
contentsList: &content as *const nbgl_content_t,
},
nbContents: 1,
};

match ledger_secure_sdk_sys::ux_sync_homeAndSettings(
info_contents[0],
Expand Down

0 comments on commit 8dea78f

Please sign in to comment.