Skip to content

Commit

Permalink
Format.
Browse files Browse the repository at this point in the history
  • Loading branch information
agrojean-ledger committed Jul 19, 2024
1 parent 5496413 commit f3686a4
Showing 1 changed file with 29 additions and 36 deletions.
65 changes: 29 additions & 36 deletions src/ui_menu_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
#include "uiHelpers.h"
#include "uiScreens_nbgl.h"

#define PAGE_START 0
#define NB_PAGE_SETTING 2
#define IS_TOUCHABLE false
#define NB_INFO_FIELDS 3
#define PAGE_START 0
#define NB_PAGE_SETTING 2
#define IS_TOUCHABLE false
#define NB_INFO_FIELDS 3
#define NB_SETTINGS_SWITCHES 1

enum {
Expand All @@ -37,27 +37,26 @@ static nbgl_layoutSwitch_t switches[NB_SETTINGS_SWITCHES];

static const char* const infoTypes[NB_INFO_FIELDS] = {"Version", "Developer", "Copyright"};
static const char* const infoContents[NB_INFO_FIELDS] = {APPVERSION, "Vacuumlabs",
"(c) 2022 Ledger"
};
"(c) 2022 Ledger"};

static const nbgl_contentInfoList_t infoList = {
.nbInfos = NB_INFO_FIELDS,
.infoTypes = infoTypes,
.infoContents = infoContents,
.nbInfos = NB_INFO_FIELDS,
.infoTypes = infoTypes,
.infoContents = infoContents,
};

// settings menu definition
static void settings_control_callback(int token, uint8_t index, int page);
#define SETTING_CONTENTS_NB 1
static const nbgl_content_t contents[SETTING_CONTENTS_NB] = {
{.type = SWITCHES_LIST,
.content.switchesList.nbSwitches = NB_SETTINGS_SWITCHES,
.content.switchesList.switches = switches,
.contentActionCallback = settings_control_callback}};
{.type = SWITCHES_LIST,
.content.switchesList.nbSwitches = NB_SETTINGS_SWITCHES,
.content.switchesList.switches = switches,
.contentActionCallback = settings_control_callback}};

static const nbgl_genericContents_t settingContents = {.callbackCallNeeded = false,
.contentsList = contents,
.nbContents = SETTING_CONTENTS_NB};
.contentsList = contents,
.nbContents = SETTING_CONTENTS_NB};

static const int INS_NONE = -1;

Expand All @@ -71,14 +70,14 @@ static void settings_control_callback(int token, uint8_t index, int page)
{
UNUSED(page);
switch (token) {
case SWITCH_APP_MODE_TOKEN:
app_mode_set_expert(index);
switches[0].initState = app_mode_expert();
break;
case SWITCH_APP_MODE_TOKEN:
app_mode_set_expert(index);
switches[0].initState = app_mode_expert();
break;

default:
PRINTF("Should not happen !");
break;
default:
PRINTF("Should not happen !");
break;
}
}

Expand All @@ -87,24 +86,18 @@ void ui_idle_flow(void)
// We need to make sure the ui context is reset even if the app restarts
nbgl_reset_transaction_full_context();

switches[0].text = "Expert mode";
switches[0].subText = "Enable expert mode";
switches[0].token = SWITCH_APP_MODE_TOKEN;
switches[0].tuneId = TUNE_TAP_CASUAL;
switches[0].initState = app_mode_expert();
switches[0].text = "Expert mode";
switches[0].subText = "Enable expert mode";
switches[0].token = SWITCH_APP_MODE_TOKEN;
switches[0].tuneId = TUNE_TAP_CASUAL;
switches[0].initState = app_mode_expert();

nbgl_useCaseHomeAndSettings("Cardano",
&C_cardano_64,
NULL,
INIT_HOME_PAGE,
&settingContents,
&infoList,
NULL,
exit);
nbgl_useCaseHomeAndSettings("Cardano", &C_cardano_64, NULL, INIT_HOME_PAGE, &settingContents,
&infoList, NULL, exit);
}

void ui_idle(void)
{
currentInstruction = INS_NONE;
}
#endif // HAVE_NBGL
#endif // HAVE_NBGL

0 comments on commit f3686a4

Please sign in to comment.