16#include "os_io_seph_ux.h"
19#include "os_helpers.h"
26#define PAGE_NB_ELEMENTS_BITS 3
27#define GET_PAGE_NB_ELEMENTS(pageData) ((pageData) &0x07)
28#define SET_PAGE_NB_ELEMENTS(nbElements) ((nbElements) &0x07)
30#define PAGE_FLAG_BITS 1
31#define GET_PAGE_FLAG(pageData) (((pageData) &0x08) >> 3)
32#define SET_PAGE_FLAG(flag) (((flag) &0x01) << 3)
34#define PAGE_DATA_BITS (PAGE_NB_ELEMENTS_BITS + PAGE_FLAG_BITS)
35#define PAGES_PER_UINT8 (8 / PAGE_DATA_BITS)
36#define SET_PAGE_DATA(pageIdx, pageData) \
37 (pagesData[pageIdx / PAGES_PER_UINT8] = pageData \
38 << ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS))
40#define MAX_PAGE_NB 256
41#define MAX_MODAL_PAGE_NB 32
44#define STARTING_CONTENT localContentsList[0]
45#define FINISHING_CONTENT localContentsList[1]
48#define QRCODE_NB_MAX_LINES 3
50#define QRCODE_REDUCED_ADDR_LEN 128
53#define ADDR_VERIF_NB_PAIRS 3
56#define keypadContext sharedContext.keypad
57#define reviewWithWarnCtx sharedContext.reviewWithWarning
60#define W3C_DESCRIPTION_MAX_LEN 128
67#define RISKY_OPERATION (1 << 6)
74#define NO_THREAT_OPERATION (1 << 7)
87 ADDRESS_QRCODE_BUTTON_TOKEN,
99 QUIT_TIPBOX_MODAL_TOKEN,
100 WARNING_CHOICE_TOKEN,
102 DISMISS_WARNING_TOKEN,
103 FIRST_WARN_BAR_TOKEN,
114typedef struct DetailsContext_s {
117 uint8_t currentPairIdx;
121 const char *nextPageStart;
124typedef struct AddressConfirmationContext_s {
128} AddressConfirmationContext_t;
131typedef struct KeypadContext_s {
134 uint8_t pinMinDigits;
135 uint8_t pinMaxDigits;
141typedef struct ReviewWithWarningContext_s {
146 const char *reviewTitle;
147 const char *reviewSubTitle;
148 const char *finishTitle;
153 uint8_t securityReportLevel;
155} ReviewWithWarningContext_t;
161 KeypadContext_t keypad;
163 ReviewWithWarningContext_t reviewWithWarning;
167 USE_CASE_GENERIC = 0,
169} GenericContextType_t;
172 GenericContextType_t type;
173 uint8_t spinnerPosition;
175 int8_t currentContentIdx;
176 uint8_t currentContentElementNb;
177 uint8_t currentElementIdx;
178 bool hasStartingContent;
179 bool hasFinishingContent;
180 const char *detailsItem;
181 const char *detailsvalue;
182 bool detailsWrapping;
183 bool validWarningCtx;
202} nbgl_homeAndSettingsContext_t;
207} nbgl_reviewContext_t;
215} nbgl_reviewStreamingContext_t;
218 nbgl_homeAndSettingsContext_t homeAndSettings;
219 nbgl_reviewContext_t review;
220 nbgl_reviewStreamingContext_t reviewStreaming;
221} nbgl_BundleNavContext_t;
227} SecurityReportItem_t;
234static char tmpString[W3C_DESCRIPTION_MAX_LEN];
254static const char *pageTitle;
261static bool forwardNavOnly;
262static NavType_t navType;
264static DetailsContext_t detailsContext;
267static SharedContext_t sharedContext;
270static AddressConfirmationContext_t addressConfirmationContext;
273static GenericContext_t genericContext;
275 localContentsList[3];
276static uint8_t genericContextPagesInfo[MAX_PAGE_NB / PAGES_PER_UINT8];
277static uint8_t modalContextPagesInfo[MAX_MODAL_PAGE_NB / PAGES_PER_UINT8];
280static nbgl_BundleNavContext_t bundleNavContext;
283static const uint8_t nbMaxElementsPerContentType[] = {
300 .icon = &WARNING_ICON,
301 .text =
"Blind signing required",
302 .subText =
"This transaction's details are not fully verifiable. If "
303 "you sign, you could lose all your assets."
306 .icon = &WARNING_ICON,
307 .text =
"Transaction Check unavailable",
311 .icon = &WARNING_ICON,
312 .text =
"Risk detected",
313 .subText =
"This transaction was scanned as risky by Web3 Checks."
316 .icon = &WARNING_ICON,
317 .text =
"Critical threat",
318 .subText =
"This transaction was scanned as malicious by Web3 Checks."
322 .text =
"No threat detected",
323 .subText =
"Transaction Check didn't find any threat, but always "
324 "review transaction details carefully."
334static char reducedAddress[QRCODE_REDUCED_ADDR_LEN];
340static void displayReviewPage(uint8_t page,
bool forceFullRefresh);
341static void displayDetailsPage(uint8_t page,
bool forceFullRefresh);
342static void displayTagValueListModalPage(uint8_t pageIdx,
bool forceFullRefresh);
343static void displayFullValuePage(
const char *backText,
344 const char *aliasText,
346static void displayInfosListModal(
const char *modalTitle,
350static void displaySettingsPage(uint8_t page,
bool forceFullRefresh);
351static void displayGenericContextPage(uint8_t pageIdx,
bool forceFullRefresh);
352static void pageCallback(
int token, uint8_t index);
354static void displayAddressQRCode(
void);
356static void modalLayoutTouchCallback(
int token, uint8_t index);
357static void displaySkipWarning(
void);
359static void bundleNavStartHome(
void);
360static void bundleNavStartSettingsAtPage(uint8_t initSettingPage);
361static void bundleNavStartSettings(
void);
363static void bundleNavReviewStreamingChoice(
bool confirm);
364static void displaySecurityReport(uint32_t set);
366static void displayInitialWarning(
void);
370 const char *reviewTitle,
371 const char *reviewSubTitle,
372 const char *finishTitle,
376 bool playNotifSound);
379 const char *reviewTitle,
380 const char *reviewSubTitle,
382 bool playNotifSound);
383static void useCaseHomeExt(
const char *appName,
390static void displayDetails(
const char *tag,
const char *value,
bool wrapping);
392static void reset_callbacks(
void)
399 onContentAction = NULL;
401 onModalConfirm = NULL;
403 onValidatePin = NULL;
408static void genericContextSetPageInfo(uint8_t pageIdx, uint8_t nbElements,
bool flag)
410 uint8_t pageData = SET_PAGE_NB_ELEMENTS(nbElements) + SET_PAGE_FLAG(flag);
412 genericContextPagesInfo[pageIdx / PAGES_PER_UINT8]
413 &= ~(0x0F << ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS));
414 genericContextPagesInfo[pageIdx / PAGES_PER_UINT8]
415 |= pageData << ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS);
419static void genericContextGetPageInfo(uint8_t pageIdx, uint8_t *nbElements,
bool *flag)
421 uint8_t pageData = genericContextPagesInfo[pageIdx / PAGES_PER_UINT8]
422 >> ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS);
423 if (nbElements != NULL) {
424 *nbElements = GET_PAGE_NB_ELEMENTS(pageData);
427 *flag = GET_PAGE_FLAG(pageData);
432static void modalContextSetPageInfo(uint8_t pageIdx, uint8_t nbElements)
434 uint8_t pageData = SET_PAGE_NB_ELEMENTS(nbElements);
436 modalContextPagesInfo[pageIdx / PAGES_PER_UINT8]
437 &= ~(0x0F << ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS));
438 modalContextPagesInfo[pageIdx / PAGES_PER_UINT8]
439 |= pageData << ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS);
443static void modalContextGetPageInfo(uint8_t pageIdx, uint8_t *nbElements)
445 uint8_t pageData = modalContextPagesInfo[pageIdx / PAGES_PER_UINT8]
446 >> ((pageIdx % PAGES_PER_UINT8) * PAGE_DATA_BITS);
447 if (nbElements != NULL) {
448 *nbElements = GET_PAGE_NB_ELEMENTS(pageData);
455 switch (content->
type) {
479 if (contentIdx < 0 || contentIdx >= genericContents->
nbContents) {
496static void prepareNavInfo(
bool isReview, uint8_t nbPages,
const char *rejectText)
498 memset(&navInfo, 0,
sizeof(navInfo));
501 navInfo.
tuneId = TUNE_TAP_CASUAL;
505 if (isReview ==
false) {
514 = ((navType == STREAMING_NAV) && (nbPages < 2)) ?
false : true;
521 const char *reviewTitle,
522 const char *reviewSubTitle)
524 contentCenter->
icon = icon;
525 contentCenter->
title = reviewTitle;
527 contentCenter->
subText =
"Swipe to review";
530 contentCenter->
padding =
false;
536 if (finishTitle != NULL) {
541 return "Sign transaction";
543 return "Sign message";
545 return "Sign operation";
552 const char *finishTitle)
554 infoLongPress->
text = getFinishTitle(operationType, finishTitle);
555 infoLongPress->
icon = icon;
563 const char *finishTitle)
565 infoButton->
text = getFinishTitle(operationType, finishTitle);
566 infoButton->
icon = icon;
573 UNUSED(operationType);
579static void pageModalCallback(
int token, uint8_t index)
583 if (token == INFOS_TIP_BOX_TOKEN) {
590 else if (token == INFO_ALIAS_TOKEN) {
592 displayFullValuePage(genericContext.currentInfos->infoTypes[index],
593 genericContext.currentInfos->infoContents[index],
594 &genericContext.currentInfos->infoExtensions[index]);
598 modalPageContext = NULL;
599 if (token == NAV_TOKEN) {
606 displayDetailsPage(index,
false);
609 if (token == MODAL_NAV_TOKEN) {
616 displayTagValueListModalPage(index,
false);
619 else if (token == QUIT_TOKEN) {
624 else if (token == QUIT_TIPBOX_MODAL_TOKEN) {
626 if (reviewWithWarnCtx.securityReportLevel == 2) {
627 reviewWithWarnCtx.securityReportLevel = 1;
628 displaySecurityReport(reviewWithWarnCtx.warning->predefinedSet);
636 else if (token == SKIP_TOKEN) {
647 else if (token == CHOICE_TOKEN) {
649 if (onModalConfirm != NULL) {
662static void pageCallback(
int token, uint8_t index)
665 if (token == QUIT_TOKEN) {
666 if (onQuit != NULL) {
670 else if (token == CONTINUE_TOKEN) {
671 if (onContinue != NULL) {
675 else if (token == CHOICE_TOKEN) {
676 if (onChoice != NULL) {
677 onChoice((index == 0) ?
true : false);
680 else if (token == ACTION_BUTTON_TOKEN) {
681 if ((index == 0) && (onAction != NULL)) {
684 else if ((index == 1) && (onQuit != NULL)) {
689 else if (token == ADDRESS_QRCODE_BUTTON_TOKEN) {
690 displayAddressQRCode();
693 else if (token == CONFIRM_TOKEN) {
694 if (onChoice != NULL) {
698 else if (token == REJECT_TOKEN) {
699 if (onChoice != NULL) {
703 else if (token == DETAILS_BUTTON_TOKEN) {
704 displayDetails(genericContext.detailsItem,
705 genericContext.detailsvalue,
706 genericContext.detailsWrapping);
708 else if (token == NAV_TOKEN) {
710 if (onQuit != NULL) {
715 if (navType == GENERIC_NAV || navType == STREAMING_NAV) {
716 displayGenericContextPage(index,
false);
718 else if (navType == REVIEW_NAV) {
719 displayReviewPage(index,
false);
722 displaySettingsPage(index,
false);
726 else if (token == NEXT_TOKEN) {
728 displayReviewPage(navInfo.
activePage + 1,
false);
731 displayGenericContextPage(navInfo.
activePage + 1,
false);
734 else if (token == BACK_TOKEN) {
736 displayReviewPage(navInfo.
activePage - 1,
true);
739 displayGenericContextPage(navInfo.
activePage - 1,
false);
742 else if (token == SKIP_TOKEN) {
744 displaySkipWarning();
746 else if (token == VALUE_ALIAS_TOKEN) {
749 if (genericContext.currentPairs != NULL) {
750 pair = &genericContext.currentPairs[genericContext.currentElementIdx + index];
753 pair = genericContext.currentCallback(genericContext.currentElementIdx + index);
757 else if (token == BLIND_WARNING_TOKEN) {
758 reviewWithWarnCtx.isIntro =
false;
759 reviewWithWarnCtx.warning = NULL;
762 else if (token == WARNING_BUTTON_TOKEN) {
764 reviewWithWarnCtx.securityReportLevel = 1;
766 if (reviewWithWarnCtx.warning->predefinedSet) {
767 displaySecurityReport(reviewWithWarnCtx.warning->predefinedSet);
771 if (reviewWithWarnCtx.isIntro) {
772 displayCustomizedSecurityReport(reviewWithWarnCtx.warning->introDetails);
775 displayCustomizedSecurityReport(reviewWithWarnCtx.warning->reviewDetails);
779 else if (token == TIP_BOX_TOKEN) {
781 if (genericContext.validWarningCtx && (reviewWithWarnCtx.warning->predefinedSet != 0)) {
782 reviewWithWarnCtx.securityReportLevel = 1;
783 displaySecurityReport(reviewWithWarnCtx.warning->predefinedSet);
786 displayInfosListModal(activeTipBox.
modalTitle, &activeTipBox.
infos,
false);
790 if (onContentAction != NULL) {
791 onContentAction(token, index, navInfo.
activePage);
793 if (onControls != NULL) {
794 onControls(token, index);
800static void tickerCallback(
void)
803 if (onQuit != NULL) {
809static void displaySettingsPage(uint8_t page,
bool forceFullRefresh)
813 if ((onNav == NULL) || (onNav(page, &content) ==
false)) {
818 content.
title = pageTitle;
821 content.
tuneId = TUNE_TAP_CASUAL;
826 if (forceFullRefresh) {
835static void displayReviewPage(uint8_t page,
bool forceFullRefresh)
844 if ((onNav == NULL) || (onNav(navInfo.
activePage, &content) ==
false)) {
849 content.
title = NULL;
851 content.
tuneId = TUNE_TAP_CASUAL;
858 if (forwardNavOnly) {
882 if (forceFullRefresh) {
892static const nbgl_content_t *genericContextComputeNextPageParams(uint8_t pageIdx,
894 uint8_t *p_nbElementsInNextPage,
897 int8_t nextContentIdx = genericContext.currentContentIdx;
898 int16_t nextElementIdx = genericContext.currentElementIdx;
899 uint8_t nbElementsInNextPage;
902 genericContextGetPageInfo(pageIdx, &nbElementsInNextPage, p_flag);
903 *p_nbElementsInNextPage = nbElementsInNextPage;
908 uint8_t nbElementsInCurrentPage;
910 genericContextGetPageInfo(navInfo.
activePage, &nbElementsInCurrentPage, NULL);
911 nextElementIdx += nbElementsInCurrentPage;
916 if ((nextElementIdx >= genericContext.currentContentElementNb)
917 && (genericContext.currentContentElementNb > 0)) {
927 nextElementIdx -= nbElementsInNextPage;
933 if (nextElementIdx < 0) {
935 nextElementIdx = -nbElementsInNextPage;
941 if ((nextContentIdx == -1) && (genericContext.hasStartingContent)) {
942 p_content = &STARTING_CONTENT;
944 else if ((nextContentIdx == genericContext.genericContents.nbContents)
945 && (genericContext.hasFinishingContent)) {
946 p_content = &FINISHING_CONTENT;
949 p_content = getContentAtIdx(&genericContext.genericContents, nextContentIdx, content);
951 if (p_content == NULL) {
966 if ((nextContentIdx != genericContext.currentContentIdx)
967 || (genericContext.currentContentElementNb == 0)) {
968 genericContext.currentContentIdx = nextContentIdx;
969 genericContext.currentContentElementNb = getContentNbElement(p_content);
971 if (nextElementIdx < 0) {
972 nextElementIdx = genericContext.currentContentElementNb + nextElementIdx;
977 if ((nextElementIdx < 0) || (nextElementIdx >= genericContext.currentContentElementNb)) {
979 "Invalid element index %d / %d\n",
981 genericContext.currentContentElementNb);
986 genericContext.currentElementIdx = nextElementIdx;
994static bool genericContextPreparePageContent(
const nbgl_content_t *p_content,
995 uint8_t nbElementsInPage,
999 uint8_t nextElementIdx = genericContext.currentElementIdx;
1001 pageContent->
title = pageTitle;
1004 pageContent->
tuneId = TUNE_TAP_CASUAL;
1006 pageContent->
type = p_content->
type;
1007 switch (pageContent->
type) {
1059 p_tagValueList = NULL;
1071 genericContext.detailsItem = pair->
item;
1072 genericContext.detailsvalue = pair->
value;
1077 if (p_tagValueList != NULL) {
1078 p_tagValueList->
nbPairs = nbElementsInPage;
1081 p_tagValueList->
pairs
1084 for (uint8_t i = 0; i < nbElementsInPage; i++) {
1086 p_tagValueList->
token = VALUE_ALIAS_TOKEN;
1092 p_tagValueList->
pairs = NULL;
1096 for (uint8_t i = 0; i < nbElementsInPage; i++) {
1100 p_tagValueList->
token = VALUE_ALIAS_TOKEN;
1115 if ((nextElementIdx + nbElementsInPage)
1127 p_tagValueList->
nbPairs = nbElementsInPage;
1128 p_tagValueList->
pairs
1131 for (uint8_t i = 0; i < nbElementsInPage; i++) {
1133 p_tagValueList->
token = VALUE_ALIAS_TOKEN;
1138 genericContext.currentPairs = p_tagValueList->
pairs;
1139 genericContext.currentCallback = p_tagValueList->
callback;
1163 < nextElementIdx + nbElementsInPage)) {
1183 bool isFirstOrLastPage
1187 = (navType == STREAMING_NAV)
1188 ? bundleNavContext.reviewStreaming.operationType
1189 : ((navType == GENERIC_NAV) ? bundleNavContext.review.operationType : 0);
1192 if (isFirstOrLastPage
1193 && (operationType & (
BLIND_OPERATION | RISKY_OPERATION | NO_THREAT_OPERATION))) {
1195 if ((operationType & NO_THREAT_OPERATION)
1204 = (operationType &
BLIND_OPERATION) ? BLIND_WARNING_TOKEN : WARNING_BUTTON_TOKEN;
1211static void displayGenericContextPage(uint8_t pageIdx,
bool forceFullRefresh)
1215 uint8_t nbElementsInPage;
1219 if (navType == STREAMING_NAV) {
1221 if (bundleNavContext.reviewStreaming.skipCallback != NULL) {
1222 bundleNavContext.reviewStreaming.skipCallback();
1226 else if (pageIdx >= bundleNavContext.reviewStreaming.stepPageNb) {
1227 bundleNavReviewStreamingChoice(
true);
1234 = genericContextComputeNextPageParams(pageIdx, &content, &nbElementsInPage, &flag);
1239 for (
int i = navInfo.
activePage + 1; i <= pageIdx; i++) {
1240 p_content = genericContextComputeNextPageParams(i, &content, &nbElementsInPage, &flag);
1250 = genericContextComputeNextPageParams(pageIdx, &content, &nbElementsInPage, &flag);
1253 if (p_content == NULL) {
1259 if (!genericContextPreparePageContent(p_content, nbElementsInPage, flag, &pageContent)) {
1265 if (forceFullRefresh) {
1274static const char *getDetailsPageAt(uint8_t detailsPage)
1277 const char *currentChar = detailsContext.value;
1278 while (page < detailsPage) {
1288 detailsContext.wrapping);
1290 currentChar = currentChar + len;
1298static void displayDetailsPage(uint8_t detailsPage,
bool forceFullRefresh)
1302 .nbPages = detailsContext.nbPages,
1304 .quitToken = QUIT_TOKEN,
1305 .navWithButtons.navToken = NAV_TOKEN,
1306 .navWithButtons.quitButton =
true,
1307 .navWithButtons.backButton =
true,
1308 .navWithButtons.quitText = NULL,
1309 .progressIndicator =
false,
1310 .tuneId = TUNE_TAP_CASUAL};
1312 .topRightIcon = NULL,
1313 .tagValueList.nbPairs = 1,
1314 .tagValueList.pairs = ¤tPair,
1315 .tagValueList.smallCaseForValue =
true,
1316 .tagValueList.wrapping = detailsContext.wrapping};
1318 if (modalPageContext != NULL) {
1321 currentPair.
item = detailsContext.tag;
1323 if (detailsPage <= detailsContext.currentPage) {
1325 currentPair.
value = getDetailsPageAt(detailsPage);
1326 forceFullRefresh =
true;
1330 currentPair.
value = detailsContext.nextPageStart;
1332 detailsContext.currentPage = detailsPage;
1343 detailsContext.wrapping);
1346 detailsContext.nextPageStart = currentPair.
value + len;
1352 detailsContext.nextPageStart = NULL;
1361 if (forceFullRefresh) {
1370static void displayFullValuePage(
const char *backText,
1371 const char *aliasText,
1374 const char *modalTitle
1375 = (extension->
backText != NULL) ? PIC(extension->
backText) : PIC(backText);
1377 genericContext.currentInfos = extension->
infolist;
1378 displayInfosListModal(modalTitle, extension->
infolist,
true);
1381 genericContext.currentTagValues = extension->
tagValuelist;
1386 .withLeftBorder =
true,
1387 .onActionCallback = &modalLayoutTouchCallback,
1388 .tapActionText = NULL};
1390 .separationLine =
false,
1391 .backAndText.token = 0,
1392 .backAndText.tuneId = TUNE_TAP_CASUAL,
1393 .backAndText.text = modalTitle};
1402 .text1 = (extension->
title != NULL) ? extension->
title : extension->fullValue,
1403 .text2 = extension->explanation,
1414 info =
"ENS names are resolved by Ledger backend.";
1417 info =
"This account label comes from your Address Book in Ledger Live.";
1423 genericContext.modalLayout, aliasText, extension->
fullValue, info);
1432static void displayInfosListModal(
const char *modalTitle,
1439 .quitToken = QUIT_TIPBOX_MODAL_TOKEN,
1440 .navWithButtons.navToken = NAV_TOKEN,
1441 .navWithButtons.quitButton =
false,
1442 .navWithButtons.backButton =
true,
1443 .navWithButtons.quitText = NULL,
1444 .progressIndicator =
false,
1445 .tuneId = TUNE_TAP_CASUAL};
1448 .topRightIcon = NULL,
1449 .infosList.nbInfos = infos->
nbInfos,
1451 .infosList.infoTypes = infos->
infoTypes,
1454 .infosList.token = fromReview ? INFO_ALIAS_TOKEN : INFOS_TIP_BOX_TOKEN,
1455 .
title = modalTitle,
1456 .titleToken = QUIT_TIPBOX_MODAL_TOKEN,
1457 .tuneId = TUNE_TAP_CASUAL};
1459 if (modalPageContext != NULL) {
1468static void displayTagValueListModalPage(uint8_t pageIdx,
bool forceFullRefresh)
1471 .nbPages = detailsContext.nbPages,
1473 .quitToken = QUIT_TOKEN,
1474 .navWithButtons.navToken = MODAL_NAV_TOKEN,
1475 .navWithButtons.quitButton =
true,
1476 .navWithButtons.backButton =
true,
1477 .navWithButtons.quitText = NULL,
1478 .progressIndicator =
false,
1479 .tuneId = TUNE_TAP_CASUAL};
1481 .topRightIcon = NULL,
1482 .tagValueList.smallCaseForValue =
true,
1483 .tagValueList.wrapping = detailsContext.wrapping};
1484 uint8_t nbElementsInPage;
1487 if (detailsContext.currentPage <= pageIdx) {
1488 modalContextGetPageInfo(pageIdx, &nbElementsInPage);
1492 modalContextGetPageInfo(pageIdx + 1, &nbElementsInPage);
1493 detailsContext.currentPairIdx -= nbElementsInPage;
1494 modalContextGetPageInfo(pageIdx, &nbElementsInPage);
1495 detailsContext.currentPairIdx -= nbElementsInPage;
1497 detailsContext.currentPage = pageIdx;
1500 = &genericContext.currentTagValues->pairs[detailsContext.currentPairIdx];
1502 detailsContext.currentPairIdx += nbElementsInPage;
1508 if (modalPageContext != NULL) {
1513 if (forceFullRefresh) {
1522static void displayAddressQRCode(
void)
1526 .withLeftBorder =
true,
1527 .onActionCallback = &modalLayoutTouchCallback,
1528 .tapActionText = NULL};
1530 .
type =
HEADER_EMPTY, .separationLine =
false, .emptySpace.height = SMALL_CENTERING_HEADER};
1536 addressConfirmationContext.modalLayout =
nbgl_layoutGet(&layoutDescription);
1541 addressConfirmationContext.tagValuePairs[0].value,
1545 if (nbLines <= QRCODE_NB_MAX_LINES) {
1546 qrCode.
text2 = addressConfirmationContext.tagValuePairs[0].value;
1551 addressConfirmationContext.tagValuePairs[0].value,
1553 QRCODE_NB_MAX_LINES,
1555 QRCODE_REDUCED_ADDR_LEN);
1556 qrCode.
text2 = reducedAddress;
1562 addressConfirmationContext.modalLayout,
"Close", DISMISS_QR_TOKEN, TUNE_TAP_CASUAL);
1570static void modalLayoutTouchCallback(
int token, uint8_t index)
1573 if (token == DISMISS_QR_TOKEN) {
1576 addressConfirmationContext.modalLayout = NULL;
1579 else if (token == DISMISS_WARNING_TOKEN) {
1583 if (reviewWithWarnCtx.securityReportLevel <= 1) {
1584 reviewWithWarnCtx.modalLayout = NULL;
1589 reviewWithWarnCtx.securityReportLevel = 1;
1591 if (reviewWithWarnCtx.warning->predefinedSet) {
1592 displaySecurityReport(reviewWithWarnCtx.warning->predefinedSet);
1597 = (reviewWithWarnCtx.isIntro) ? reviewWithWarnCtx.warning->introDetails
1598 : reviewWithWarnCtx.warning->reviewDetails;
1599 displayCustomizedSecurityReport(details);
1604 else if ((token >= FIRST_WARN_BAR_TOKEN) && (token <= LAST_WARN_BAR_TOKEN)) {
1607 reviewWithWarnCtx.securityReportLevel = 2;
1609 if (reviewWithWarnCtx.warning->predefinedSet) {
1610 displaySecurityReport(1 << (token - FIRST_WARN_BAR_TOKEN));
1615 ? reviewWithWarnCtx.warning->introDetails
1616 : reviewWithWarnCtx.warning->reviewDetails;
1618 displayCustomizedSecurityReport(
1627 genericContext.modalLayout = NULL;
1634static void layoutTouchCallback(
int token, uint8_t index)
1637 if (token == WARNING_CHOICE_TOKEN) {
1639 reviewWithWarnCtx.choiceCallback(
false);
1642 reviewWithWarnCtx.isIntro =
false;
1643 if (reviewWithWarnCtx.isStreaming) {
1644 useCaseReviewStreamingStart(reviewWithWarnCtx.operationType,
1645 reviewWithWarnCtx.icon,
1646 reviewWithWarnCtx.reviewTitle,
1647 reviewWithWarnCtx.reviewSubTitle,
1648 reviewWithWarnCtx.choiceCallback,
1652 useCaseReview(reviewWithWarnCtx.operationType,
1653 reviewWithWarnCtx.tagValueList,
1654 reviewWithWarnCtx.icon,
1655 reviewWithWarnCtx.reviewTitle,
1656 reviewWithWarnCtx.reviewSubTitle,
1657 reviewWithWarnCtx.finishTitle,
1659 reviewWithWarnCtx.choiceCallback,
1666 else if (token == WARNING_BUTTON_TOKEN) {
1668 reviewWithWarnCtx.securityReportLevel = 1;
1670 if (reviewWithWarnCtx.warning->predefinedSet) {
1671 displaySecurityReport(reviewWithWarnCtx.warning->predefinedSet);
1676 ? reviewWithWarnCtx.warning->introDetails
1677 : reviewWithWarnCtx.warning->reviewDetails;
1678 displayCustomizedSecurityReport(details);
1684static void displaySkipWarning(
void)
1687 .cancelText =
"Go back to review",
1688 .centeredInfo.text1 =
"Skip review?",
1690 =
"If you're sure you don't need to review all fields, you can skip straight to signing.",
1691 .centeredInfo.text3 = NULL,
1693 .centeredInfo.icon = &IMPORTANT_CIRCLE_ICON,
1694 .centeredInfo.offsetY = 0,
1695 .confirmationText =
"Yes, skip",
1696 .confirmationToken = SKIP_TOKEN,
1697 .
tuneId = TUNE_TAP_CASUAL,
1699 if (modalPageContext != NULL) {
1711static void updateKeyPad(
bool add)
1713 bool enableValidate, enableBackspace, enableDigits;
1714 bool redrawKeypad =
false;
1717 enableDigits = (keypadContext.pinLen < keypadContext.pinMaxDigits);
1718 enableValidate = (keypadContext.pinLen >= keypadContext.pinMinDigits);
1719 enableBackspace = (keypadContext.pinLen > 0);
1721 if ((keypadContext.pinLen == keypadContext.pinMinDigits)
1723 (keypadContext.pinLen == keypadContext.pinMaxDigits)
1725 (keypadContext.pinLen == 1)) {
1726 redrawKeypad =
true;
1730 if ((keypadContext.pinLen == 0) ||
1731 (keypadContext.pinLen == (keypadContext.pinMinDigits - 1))
1733 (keypadContext.pinLen
1734 == (keypadContext.pinMaxDigits - 1))) {
1735 redrawKeypad =
true;
1738 if (keypadContext.hidden ==
true) {
1743 keypadContext.layoutCtx,
false, 0, (
const char *) keypadContext.pinEntry);
1747 keypadContext.layoutCtx, 0, enableValidate, enableBackspace, enableDigits);
1750 if ((!add) && (keypadContext.pinLen == 0)) {
1758static void keypadCallback(
char touchedKey)
1760 switch (touchedKey) {
1762 if (keypadContext.pinLen > 0) {
1763 keypadContext.pinLen--;
1764 keypadContext.pinEntry[keypadContext.pinLen] = 0;
1766 updateKeyPad(
false);
1775 onValidatePin(keypadContext.pinEntry, keypadContext.pinLen);
1779 if ((touchedKey >= 0x30) && (touchedKey < 0x40)) {
1780 if (keypadContext.pinLen < keypadContext.pinMaxDigits) {
1781 keypadContext.pinEntry[keypadContext.pinLen] = touchedKey;
1782 keypadContext.pinLen++;
1791static void keypadGenericUseCase(
const char *title,
1797 tune_index_e tuneId,
1803 .separationLine =
true,
1804 .backAndText.token = backToken,
1805 .backAndText.tuneId = tuneId,
1806 .backAndText.text = NULL};
1815 memset(&keypadContext, 0,
sizeof(KeypadContext_t));
1819 layoutDescription.
modal =
false;
1822 keypadContext.hidden = hidden;
1834 keypadContext.layoutCtx, title, keypadContext.hidden, maxDigits,
"");
1841 onValidatePin = validatePinCallback;
1843 keypadContext.pinMinDigits = minDigits;
1844 keypadContext.pinMaxDigits = maxDigits;
1865static uint8_t getNbTagValuesInPage(uint8_t nbPairs,
1869 bool hasConfirmationButton,
1870 bool hasDetailsButton,
1871 bool *requireSpecificDisplay)
1873 uint8_t nbPairsInPage = 0;
1874 uint16_t currentHeight = PRE_TAG_VALUE_MARGIN;
1880 maxUsableHeight -= TOUCHABLE_HEADER_BAR_HEIGHT - SMALL_CENTERING_HEADER;
1883 *requireSpecificDisplay =
false;
1884 while (nbPairsInPage < nbPairs) {
1891 if (nbPairsInPage > 0) {
1892 currentHeight += INTER_TAG_VALUE_MARGIN;
1895 if (tagValueList->
pairs != NULL) {
1896 pair = PIC(&tagValueList->
pairs[startIndex + nbPairsInPage]);
1899 pair = PIC(tagValueList->
callback(startIndex + nbPairsInPage));
1908 if (nbPairsInPage > 0) {
1915 *requireSpecificDisplay =
true;
1927 value_font = SMALL_REGULAR_FONT;
1930 value_font = LARGE_MEDIUM_FONT;
1939 if (nbPairsInPage == 0) {
1943 *requireSpecificDisplay =
true;
1952 if (hasConfirmationButton && (nbPairsInPage == nbPairs)) {
1953 maxUsableHeight -= UP_FOOTER_BUTTON_HEIGHT;
1954 if (currentHeight > maxUsableHeight) {
1959 else if (hasDetailsButton) {
1960 maxUsableHeight -= (SMALL_BUTTON_RADIUS * 2);
1961 if (currentHeight > maxUsableHeight) {
1965 return nbPairsInPage;
1977static uint8_t getNbTagValuesInDetailsPage(uint8_t nbPairs,
1981 uint8_t nbPairsInPage = 0;
1982 uint16_t currentHeight = PRE_TAG_VALUE_MARGIN;
1985 while (nbPairsInPage < nbPairs) {
1990 if (nbPairsInPage > 0) {
1991 currentHeight += INTER_TAG_VALUE_MARGIN;
1994 if (tagValueList->
pairs != NULL) {
1995 pair = PIC(&tagValueList->
pairs[startIndex + nbPairsInPage]);
1998 pair = PIC(tagValueList->
callback(startIndex + nbPairsInPage));
2012 if (currentHeight >= maxUsableHeight) {
2017 return nbPairsInPage;
2020static uint8_t getNbPagesForContent(
const nbgl_content_t *content,
2021 uint8_t pageIdxStart,
2025 uint8_t nbElements = 0;
2026 uint8_t nbPages = 0;
2027 uint8_t nbElementsInPage;
2028 uint8_t elemIdx = 0;
2031 nbElements = getContentNbElement(content);
2033 while (nbElements > 0) {
2036 bool hasNav = !isLast || (pageIdxStart > 0) || (elemIdx > 0);
2038 nbElementsInPage = getNbTagValuesInPage(nbElements,
2047 nbElementsInPage = getNbTagValuesInPage(nbElements,
2072 nbElementsInPage =
MIN(nbMaxElementsPerContentType[content->
type], nbElements);
2075 elemIdx += nbElementsInPage;
2076 genericContextSetPageInfo(pageIdxStart + nbPages, nbElementsInPage, flag);
2077 nbElements -= nbElementsInPage;
2085 uint8_t pageIdxStart,
2088 uint8_t nbPages = 0;
2092 for (
int i = 0; i < genericContents->
nbContents; i++) {
2093 p_content = getContentAtIdx(genericContents, i, &content);
2094 if (p_content == NULL) {
2097 nbPages += getNbPagesForContent(p_content,
2098 pageIdxStart + nbPages,
2106static void prepareAddressConfirmationPages(
const char *address,
2113 addressConfirmationContext.tagValuePairs[0].item =
"Address";
2114 addressConfirmationContext.tagValuePairs[0].value = address;
2115 addressConfirmationContext.nbPairs = 1;
2124 if ((tagValueList != NULL) && (tagValueList->
nbPairs < ADDR_VERIF_NB_PAIRS)) {
2128 for (uint8_t i = 0; i < tagValueList->
nbPairs; i++) {
2129 memcpy(&addressConfirmationContext.tagValuePairs[1 + i],
2130 &tagValueList->
pairs[i],
2132 addressConfirmationContext.nbPairs++;
2136 tmpList.
nbPairs = addressConfirmationContext.nbPairs;
2137 tmpList.
pairs = addressConfirmationContext.tagValuePairs;
2138 addressConfirmationContext.nbPairs = getNbTagValuesInPage(
2139 addressConfirmationContext.nbPairs, &tmpList, 0,
false,
true,
true, &flag);
2141 if (tmpList.
nbPairs > addressConfirmationContext.nbPairs) {
2142 addressConfirmationContext.nbPairs = 1;
2153 tagValueConfirm->
tuneId = TUNE_TAP_CASUAL;
2161 if ((tagValueList != NULL)
2162 && (tagValueList->
nbPairs > (addressConfirmationContext.nbPairs - 1))) {
2172 tagValueConfirm->
tuneId = TUNE_TAP_CASUAL;
2175 = tagValueList->
nbPairs - (addressConfirmationContext.nbPairs - 1);
2177 = &tagValueList->
pairs[addressConfirmationContext.nbPairs - 1];
2186static void bundleNavStartHome(
void)
2188 nbgl_homeAndSettingsContext_t *context = &bundleNavContext.homeAndSettings;
2190 useCaseHomeExt(context->appName,
2193 context->settingContents != NULL ?
true : false,
2194 &context->homeAction,
2195 bundleNavStartSettings,
2196 context->quitCallback);
2199static void bundleNavStartSettingsAtPage(uint8_t initSettingPage)
2201 nbgl_homeAndSettingsContext_t *context = &bundleNavContext.homeAndSettings;
2205 context->settingContents,
2207 bundleNavStartHome);
2210static void bundleNavStartSettings(
void)
2212 bundleNavStartSettingsAtPage(0);
2215static void bundleNavReviewConfirmRejection(
void)
2217 bundleNavContext.review.choiceCallback(
false);
2224 const char *confirmText;
2229 title =
"Reject transaction?";
2230 confirmText =
"Go back to transaction";
2233 title =
"Reject message?";
2234 confirmText =
"Go back to message";
2237 title =
"Reject operation?";
2238 confirmText =
"Go back to operation";
2245static void bundleNavReviewChoice(
bool confirm)
2248 bundleNavContext.review.choiceCallback(
true);
2251 bundleNavReviewAskRejectionConfirmation(bundleNavContext.review.operationType,
2252 bundleNavReviewConfirmRejection);
2256static void bundleNavReviewStreamingConfirmRejection(
void)
2258 bundleNavContext.reviewStreaming.choiceCallback(
false);
2261static void bundleNavReviewStreamingChoice(
bool confirm)
2268 bundleNavContext.reviewStreaming.choiceCallback(
true);
2271 bundleNavReviewAskRejectionConfirmation(bundleNavContext.reviewStreaming.operationType,
2272 bundleNavReviewStreamingConfirmRejection);
2279static void displaySecurityReport(uint32_t set)
2282 .withLeftBorder =
true,
2283 .onActionCallback = modalLayoutTouchCallback,
2284 .tapActionText = NULL};
2286 .separationLine =
true,
2287 .backAndText.icon = NULL,
2288 .backAndText.tuneId = TUNE_TAP_CASUAL,
2289 .backAndText.token = DISMISS_WARNING_TOKEN};
2293 uint8_t nbWarnings = 0;
2294 const char *provider;
2296 reviewWithWarnCtx.modalLayout =
nbgl_layoutGet(&layoutDescription);
2309 if ((reviewWithWarnCtx.securityReportLevel == 1) && (!reviewWithWarnCtx.isIntro)) {
2311 if (reviewWithWarnCtx.warning->predefinedSet & (1 << i)) {
2314 || (reviewWithWarnCtx.warning->providerMessage == NULL)) {
2315 bar.
subText = securityReportItems[i].subText;
2318 bar.
subText = reviewWithWarnCtx.warning->providerMessage;
2320 bar.
text = securityReportItems[i].text;
2323 bar.
token = FIRST_WARN_BAR_TOKEN + i;
2324 bar.
tuneId = TUNE_TAP_CASUAL;
2329 bar.
iconLeft = securityReportItems[i].icon;
2340 if (reviewWithWarnCtx.warning && reviewWithWarnCtx.warning->reportProvider) {
2341 provider = reviewWithWarnCtx.warning->reportProvider;
2344 provider =
"[unknown]";
2350 + W3C_DESCRIPTION_MAX_LEN / 2;
2354 .text1 = reviewWithWarnCtx.warning->reportUrl,
2355 .text2 =
"Scan to view full report",
2360 W3C_DESCRIPTION_MAX_LEN / 2,
2362 reviewWithWarnCtx.warning->reportUrl);
2363 urlLen = strlen(destStr) + 1;
2368 snprintf(destStr + urlLen, W3C_DESCRIPTION_MAX_LEN / 2 - urlLen,
"%s report", provider);
2374 info.
icon = &LARGE_WARNING_ICON;
2375 info.
title =
"This transaction cannot be Clear Signed";
2377 =
"This transaction or message cannot be decoded fully. If you choose to sign, you "
2378 "could be authorizing malicious actions that can drain your wallet.\n\nLearn more: "
2387 info.
icon = &LARGE_WARNING_ICON;
2388 info.
title =
"Transaction Check unavailable";
2390 =
"If you're not using the\nLedger Live app, Transaction Check might not work. If your "
2391 "are using Ledger Live, reject the transaction and try again.\n\nGet help at "
2411 .withLeftBorder =
true,
2412 .onActionCallback = modalLayoutTouchCallback,
2413 .tapActionText = NULL};
2415 .separationLine =
true,
2416 .backAndText.icon = NULL,
2417 .backAndText.tuneId = TUNE_TAP_CASUAL,
2418 .backAndText.token = DISMISS_WARNING_TOKEN};
2421 reviewWithWarnCtx.modalLayout =
nbgl_layoutGet(&layoutDescription);
2432 bar.
token = FIRST_WARN_BAR_TOKEN + i;
2433 bar.
tuneId = TUNE_TAP_CASUAL;
2457static void displayInitialWarning(
void)
2460#ifdef HAVE_PIEZO_SOUND
2461 tune_index_e tune = TUNE_RESERVED;
2465 .token = WARNING_CHOICE_TOKEN,
2466 .topText =
"Back to safety",
2468 .tuneId = TUNE_TAP_CASUAL};
2470 .separationLine =
false,
2471 .emptySpace.height = MEDIUM_CENTERING_HEADER};
2472 uint32_t set = reviewWithWarnCtx.warning->predefinedSet
2475 reviewWithWarnCtx.isIntro =
true;
2477 layoutDescription.
modal =
false;
2483 layoutDescription.
ticker.tickerCallback = NULL;
2484 reviewWithWarnCtx.layoutCtx =
nbgl_layoutGet(&layoutDescription);
2487 if (reviewWithWarnCtx.warning->predefinedSet != 0) {
2489 reviewWithWarnCtx.layoutCtx,
2491 WARNING_BUTTON_TOKEN,
2494 else if (reviewWithWarnCtx.warning->introTopRightIcon != NULL) {
2496 reviewWithWarnCtx.warning->introTopRightIcon,
2497 WARNING_BUTTON_TOKEN,
2502 if (reviewWithWarnCtx.warning->predefinedSet != 0) {
2505 const char *provider;
2508 info.
icon = &LARGE_WARNING_ICON;
2512 if (reviewWithWarnCtx.warning->reportProvider) {
2513 provider = reviewWithWarnCtx.warning->reportProvider;
2516 provider =
"[unknown]";
2519 snprintf(tmpString, W3C_DESCRIPTION_MAX_LEN,
"Detected by %s", provider);
2523 info.
title =
"Blind signing ahead";
2525 =
"This transaction's details are not fully verifiable. If you sign, you could "
2526 "lose all your assets.";
2528#ifdef HAVE_PIEZO_SOUND
2529 tune = TUNE_NEUTRAL;
2533 info.
title =
"Potential risk";
2534 if (reviewWithWarnCtx.warning->providerMessage == NULL) {
2538 info.
description = reviewWithWarnCtx.warning->providerMessage;
2540 buttonsInfo.
bottomText =
"Accept risk and continue";
2541#ifdef HAVE_PIEZO_SOUND
2542 tune = TUNE_NEUTRAL;
2546 info.
title =
"Critical threat";
2547 if (reviewWithWarnCtx.warning->providerMessage == NULL) {
2551 info.
description = reviewWithWarnCtx.warning->providerMessage;
2553 buttonsInfo.
bottomText =
"Accept threat and continue";
2554#ifdef HAVE_PIEZO_SOUND
2560 else if (reviewWithWarnCtx.warning->info != NULL) {
2563#ifdef HAVE_PIEZO_SOUND
2564 tune = TUNE_LOOK_AT_ME;
2570#ifdef HAVE_PIEZO_SOUND
2571 if (tune != TUNE_RESERVED) {
2572 os_io_seph_cmd_piezo_play_tune(tune);
2582 const char *predefinedTipBoxText = NULL;
2585 if (reviewWithWarnCtx.warning) {
2586 if (reviewWithWarnCtx.warning->predefinedSet & (1 <<
W3C_ISSUE_WARN)) {
2588 predefinedTipBoxText =
"Transaction Check unavailable.\nBlind signing required.";
2591 predefinedTipBoxText =
"Transaction Check unavailable";
2596 predefinedTipBoxText =
"Critical threat detected.\nBlind signing required.";
2599 predefinedTipBoxText =
"Critical threat detected.";
2604 predefinedTipBoxText =
"Potential risk detected.\nBlind signing required.";
2607 predefinedTipBoxText =
"Potential risk detected.";
2612 predefinedTipBoxText
2613 =
"No threat detected by Transaction Check but blind signing required.";
2616 predefinedTipBoxText =
"No threat detected by Transaction Check.";
2620 predefinedTipBoxText =
"Blind signing required.";
2624 if ((tipBox != NULL) || (predefinedTipBoxText != NULL)) {
2626 STARTING_CONTENT.content.extendedCenter.contentCenter.subText = NULL;
2627 if (predefinedTipBoxText != NULL) {
2628 genericContext.validWarningCtx =
true;
2629 STARTING_CONTENT.content.extendedCenter.tipBox.icon = NULL;
2630 STARTING_CONTENT.content.extendedCenter.tipBox.text = predefinedTipBoxText;
2633 STARTING_CONTENT.content.extendedCenter.tipBox.icon = tipBox->
icon;
2634 STARTING_CONTENT.content.extendedCenter.tipBox.text = tipBox->
text;
2636 STARTING_CONTENT.content.extendedCenter.tipBox.token = TIP_BOX_TOKEN;
2637 STARTING_CONTENT.content.extendedCenter.tipBox.tuneId = TUNE_TAP_CASUAL;
2645 const char *reviewTitle,
2646 const char *reviewSubTitle,
2647 const char *finishTitle,
2651 bool playNotifSound)
2654 memset(&genericContext, 0,
sizeof(genericContext));
2656 bundleNavContext.review.operationType = operationType;
2657 bundleNavContext.review.choiceCallback = choiceCallback;
2660 onChoice = bundleNavReviewChoice;
2661 navType = GENERIC_NAV;
2664 genericContext.genericContents.contentsList = localContentsList;
2665 genericContext.genericContents.nbContents = 3;
2670 prepareReviewFirstPage(
2671 &STARTING_CONTENT.content.extendedCenter.contentCenter, icon, reviewTitle, reviewSubTitle);
2674 initWarningTipBox(tipBox);
2678 memcpy(&localContentsList[1].content.tagValueList,
2686 prepareReviewLightLastPage(
2687 operationType, &localContentsList[2].content.infoButton, icon, finishTitle);
2691 prepareReviewLastPage(
2692 operationType, &localContentsList[2].content.infoLongPress, icon, finishTitle);
2696 uint8_t nbPages = getNbPagesForGenericContents(
2698 prepareNavInfo(
true, nbPages, getRejectReviewText(operationType));
2701 if (playNotifSound) {
2702#ifdef HAVE_PIEZO_SOUND
2703 os_io_seph_cmd_piezo_play_tune(TUNE_LOOK_AT_ME);
2707 displayGenericContextPage(0,
true);
2713 const char *reviewTitle,
2714 const char *reviewSubTitle,
2716 bool playNotifSound)
2719 memset(&genericContext, 0,
sizeof(genericContext));
2721 bundleNavContext.reviewStreaming.operationType = operationType;
2722 bundleNavContext.reviewStreaming.choiceCallback = choiceCallback;
2723 bundleNavContext.reviewStreaming.icon = icon;
2726 onChoice = bundleNavReviewStreamingChoice;
2727 navType = STREAMING_NAV;
2730 genericContext.genericContents.contentsList = localContentsList;
2731 genericContext.genericContents.nbContents = 1;
2736 prepareReviewFirstPage(
2737 &STARTING_CONTENT.content.extendedCenter.contentCenter, icon, reviewTitle, reviewSubTitle);
2740 initWarningTipBox(NULL);
2743 bundleNavContext.reviewStreaming.stepPageNb = getNbPagesForGenericContents(
2750 if (playNotifSound) {
2751#ifdef HAVE_PIEZO_SOUND
2752 os_io_seph_cmd_piezo_play_tune(TUNE_LOOK_AT_ME);
2756 displayGenericContextPage(0,
true);
2775static void useCaseHomeExt(
const char *appName,
2777 const char *tagline,
2786 .centeredInfo.text1 = appName,
2787 .centeredInfo.text3 = NULL,
2789 .centeredInfo.offsetY = 0,
2792 .tapActionText = NULL,
2794 .topRightToken = CONTINUE_TOKEN,
2795 .tuneId = TUNE_TAP_CASUAL};
2796 if ((homeAction->
text != NULL) || (homeAction->
icon != NULL)) {
2811 if (tagline == NULL) {
2815 "This app enables signing\ntransactions on its network.");
2842 onContinue = topRightCallback;
2843 onQuit = quitCallback;
2857static void displayDetails(
const char *tag,
const char *value,
bool wrapping)
2859 memset(&detailsContext, 0,
sizeof(detailsContext));
2865 detailsContext.tag = tag;
2866 detailsContext.value = value;
2868 detailsContext.currentPage = 0;
2869 detailsContext.wrapping = wrapping;
2871 if (detailsContext.nbPages > 1) {
2872 uint16_t nbLostChars = (detailsContext.nbPages - 1) * 3;
2875 uint8_t nbLinesInLastPage
2881 detailsContext.nbPages++;
2885 displayDetailsPage(0,
true);
2891 uint8_t nbElements = 0;
2892 uint8_t nbElementsInPage;
2893 uint8_t elemIdx = 0;
2896 memset(&detailsContext, 0,
sizeof(detailsContext));
2897 nbElements = tagValues->
nbPairs;
2899 while (nbElements > 0) {
2900 nbElementsInPage = getNbTagValuesInDetailsPage(nbElements, tagValues, elemIdx);
2902 elemIdx += nbElementsInPage;
2903 modalContextSetPageInfo(detailsContext.nbPages, nbElementsInPage);
2904 nbElements -= nbElementsInPage;
2905 detailsContext.nbPages++;
2908 displayTagValueListModalPage(0,
true);
2930 bool *requireSpecificDisplay)
2932 return getNbTagValuesInPage(
2933 nbPairs, tagValueList, startIndex,
false,
false,
false, requireSpecificDisplay);
2953 bool *requireSpecificDisplay)
2955 return getNbTagValuesInPage(
2956 nbPairs, tagValueList, startIndex, isSkippable,
false,
false, requireSpecificDisplay);
2973 uint8_t nbInfosInPage = 0;
2974 uint16_t currentHeight = 0;
2975 uint16_t previousHeight;
2976 uint16_t navHeight = withNav ? SIMPLE_FOOTER_HEIGHT : 0;
2977 const char *
const *infoContents = PIC(infosList->
infoContents);
2979 while (nbInfosInPage < nbInfos) {
2982 += LIST_ITEM_MIN_TEXT_HEIGHT + 2 * LIST_ITEM_PRE_HEADING + LIST_ITEM_HEADING_SUB_TEXT;
2986 PIC(infoContents[startIndex + nbInfosInPage]),
2993 if (!withNav && (previousHeight >= (
INFOS_AREA_HEIGHT - SIMPLE_FOOTER_HEIGHT))) {
2998 previousHeight = currentHeight;
3001 return nbInfosInPage;
3018 uint8_t nbSwitchesInPage = 0;
3019 uint16_t currentHeight = 0;
3020 uint16_t previousHeight;
3021 uint16_t navHeight = withNav ? SIMPLE_FOOTER_HEIGHT : 0;
3024 while (nbSwitchesInPage < nbSwitches) {
3027 += LIST_ITEM_MIN_TEXT_HEIGHT + 2 * LIST_ITEM_PRE_HEADING + LIST_ITEM_HEADING_SUB_TEXT;
3032 switchArray[startIndex + nbSwitchesInPage].subText,
3039 previousHeight = currentHeight;
3044 if (!withNav && (previousHeight >= (
INFOS_AREA_HEIGHT - SIMPLE_FOOTER_HEIGHT))) {
3047 return nbSwitchesInPage;
3064 uint8_t nbBarsInPage = 0;
3065 uint16_t currentHeight = 0;
3066 uint16_t previousHeight;
3067 uint16_t navHeight = withNav ? SIMPLE_FOOTER_HEIGHT : 0;
3072 while (nbBarsInPage < nbBars) {
3073 currentHeight += LIST_ITEM_MIN_TEXT_HEIGHT + 2 * LIST_ITEM_PRE_HEADING;
3078 previousHeight = currentHeight;
3083 if (!withNav && (previousHeight >= (
INFOS_AREA_HEIGHT - SIMPLE_FOOTER_HEIGHT))) {
3086 return nbBarsInPage;
3103 uint8_t nbChoicesInPage = 0;
3104 uint16_t currentHeight = 0;
3105 uint16_t previousHeight;
3106 uint16_t navHeight = withNav ? SIMPLE_FOOTER_HEIGHT : 0;
3108 UNUSED(choicesList);
3111 while (nbChoicesInPage < nbChoices) {
3112 currentHeight += LIST_ITEM_MIN_TEXT_HEIGHT + 2 * LIST_ITEM_PRE_HEADING;
3117 if (!withNav && (previousHeight >= (
INFOS_AREA_HEIGHT - SIMPLE_FOOTER_HEIGHT))) {
3122 previousHeight = currentHeight;
3125 return nbChoicesInPage;
3136 uint8_t nbPages = 0;
3137 uint8_t nbPairs = tagValueList->
nbPairs;
3138 uint8_t nbPairsInPage;
3142 while (i < tagValueList->nbPairs) {
3146 nbPairs -= nbPairsInPage;
3158 const char *tagline,
3165 appName, appIcon, tagline, withSettings, &homeAction, topRightCallback, quitCallback);
3174 const char *tagline,
3176 const char *actionButtonText,
3184 .text = actionButtonText};
3187 appName, appIcon, tagline, withSettings, &homeAction, topRightCallback, quitCallback);
3213 onQuit = quitCallback;
3214 onNav = navCallback;
3215 onControls = controlsCallback;
3217 navType = SETTINGS_NAV;
3220 prepareNavInfo(
false, nbPages, NULL);
3222 displaySettingsPage(initPage,
true);
3240 title, initPage, nbPages, quitCallback, navCallback, controlsCallback);
3262 memset(&genericContext, 0,
sizeof(genericContext));
3265 onQuit = quitCallback;
3266 pageTitle = appName;
3267 navType = GENERIC_NAV;
3269 if (settingContents != NULL) {
3272 if (infosList != NULL) {
3273 genericContext.hasFinishingContent =
true;
3276 memcpy(&FINISHING_CONTENT.content, infosList,
sizeof(
nbgl_content_u));
3280 uint8_t nbPages = getNbPagesForGenericContents(&genericContext.genericContents, 0,
false);
3281 if (infosList != NULL) {
3282 nbPages += getNbPagesForContent(&FINISHING_CONTENT, nbPages,
true,
false);
3285 prepareNavInfo(
false, nbPages, NULL);
3287 displayGenericContextPage(initPage,
true);
3326 const char *appName,
3328 const char *tagline,
3336 nbgl_homeAndSettingsContext_t *context = &bundleNavContext.homeAndSettings;
3338 context->appName = appName;
3339 context->appIcon = appIcon;
3340 context->tagline = tagline;
3341 context->settingContents = settingContents;
3342 context->infosList = infosList;
3343 if (action != NULL) {
3349 context->quitCallback = quitCallback;
3352 bundleNavStartSettingsAtPage(initSettingPage);
3355 bundleNavStartHome();
3371 .tickerIntervale = 0,
3374 onQuit = quitCallback;
3376#ifdef HAVE_PIEZO_SOUND
3377 os_io_seph_cmd_piezo_play_tune(TUNE_LEDGER_MOMENT);
3385 .centeredInfo.icon = &DENIED_CIRCLE_ICON,
3386 .centeredInfo.offsetY = SMALL_FOOTER_HEIGHT / 2,
3387 .centeredInfo.onTop =
false,
3389 .centeredInfo.text1 = message,
3390 .centeredInfo.text2 = NULL,
3391 .centeredInfo.text3 = NULL,
3392 .tapActionText =
"",
3393 .isSwipeable =
false,
3394 .tapActionToken = QUIT_TOKEN,
3396 .actionButtonText = NULL,
3397 .tuneId = TUNE_TAP_CASUAL};
3414 switch (reviewStatusType) {
3416 msg =
"Operation signed";
3420 msg =
"Operation rejected";
3424 msg =
"Transaction signed";
3428 msg =
"Transaction rejected";
3432 msg =
"Message signed";
3436 msg =
"Message rejected";
3440 msg =
"Address verified";
3444 msg =
"Address verification\ncancelled";
3466 const char *message,
3467 const char *subMessage,
3468 const char *confirmText,
3469 const char *cancelText,
3476 .centeredInfo.text2 = subMessage,
3477 .centeredInfo.text3 = NULL,
3479 .centeredInfo.icon = icon,
3480 .centeredInfo.offsetY = 0,
3481 .confirmationText = confirmText,
3482 .confirmationToken = CHOICE_TOKEN,
3483 .tuneId = TUNE_TAP_CASUAL,
3486 if ((confirmText == NULL) || (cancelText == NULL)) {
3489 onChoice = callback;
3508 const char *subMessage,
3509 const char *confirmText,
3510 const char *cancelText,
3516 .centeredInfo.text1 = message,
3517 .centeredInfo.text2 = subMessage,
3518 .centeredInfo.text3 = NULL,
3520 .centeredInfo.icon = &IMPORTANT_CIRCLE_ICON,
3521 .centeredInfo.offsetY = 0,
3522 .confirmationText = confirmText,
3523 .confirmationToken = CHOICE_TOKEN,
3524 .tuneId = TUNE_TAP_CASUAL,
3526 onModalConfirm = callback;
3527 if (modalPageContext != NULL) {
3545 const char *message,
3546 const char *actionText,
3552 onAction = callback;
3554 content.
tuneId = TUNE_TAP_CASUAL;
3577 const char *reviewTitle,
3578 const char *reviewSubTitle,
3579 const char *rejectText,
3586 .footerToken = QUIT_TOKEN,
3587 .tapActionText = NULL,
3588 .isSwipeable =
true,
3589 .tapActionToken = CONTINUE_TOKEN,
3591 .actionButtonText = NULL,
3592 .
tuneId = TUNE_TAP_CASUAL};
3599 onQuit = rejectCallback;
3600 onContinue = continueCallback;
3602#ifdef HAVE_PIEZO_SOUND
3604 os_io_seph_cmd_piezo_play_tune(TUNE_LOOK_AT_ME);
3617 const char *rejectText,
3625 onChoice = choiceCallback;
3626 onNav = navCallback;
3627 onControls = buttonCallback;
3628 forwardNavOnly =
false;
3629 navType = REVIEW_NAV;
3633 prepareNavInfo(
true, nbPages, getRejectReviewText(
TYPE_OPERATION));
3635 displayReviewPage(initPage,
true);
3652 const char *rejectText,
3658 memset(&genericContext, 0,
sizeof(genericContext));
3661 onChoice = callback;
3662 navType = GENERIC_NAV;
3666 genericContext.genericContents.contentsList = localContentsList;
3669 if (tagValueList != NULL && tagValueList->
nbPairs != 0) {
3671 memcpy(&localContentsList[offset].content.tagValueList,
3678 memcpy(&localContentsList[offset].content.infoLongPress,
3684 genericContext.genericContents.nbContents = offset;
3687 uint8_t nbPages = getNbPagesForGenericContents(&genericContext.genericContents, 0,
false);
3689 prepareNavInfo(
true, nbPages, getRejectReviewText(
TYPE_OPERATION));
3691 displayGenericContextPage(0,
true);
3709 const char *rejectText,
3715 memset(&genericContext, 0,
sizeof(genericContext));
3718 onChoice = callback;
3719 navType = GENERIC_NAV;
3722 genericContext.genericContents.contentsList = localContentsList;
3725 if (tagValueList != NULL && tagValueList->
nbPairs != 0) {
3727 memcpy(&localContentsList[offset].content.tagValueList,
3741 genericContext.genericContents.nbContents = offset;
3744 uint8_t nbPages = getNbPagesForGenericContents(&genericContext.genericContents, 0,
false);
3746 prepareNavInfo(
true, nbPages, getRejectReviewText(
TYPE_OPERATION));
3748 displayGenericContextPage(0,
true);
3770 const char *reviewTitle,
3771 const char *reviewSubTitle,
3772 const char *finishTitle,
3775 useCaseReview(operationType,
3809 const char *reviewTitle,
3810 const char *reviewSubTitle,
3811 const char *finishTitle,
3822 &blindSigningWarning,
3851 const char *reviewTitle,
3852 const char *reviewSubTitle,
3853 const char *finishTitle,
3858 memset(&reviewWithWarnCtx, 0,
sizeof(reviewWithWarnCtx));
3860 if (tipBox != NULL) {
3861 memcpy(&activeTipBox, tipBox,
sizeof(activeTipBox));
3864 memset(&activeTipBox, 0,
sizeof(activeTipBox));
3867 if ((warning == NULL)
3870 useCaseReview(operationType,
3883 operationType |= NO_THREAT_OPERATION;
3886 operationType |= RISKY_OPERATION;
3889 reviewWithWarnCtx.isStreaming =
false;
3890 reviewWithWarnCtx.operationType = operationType;
3891 reviewWithWarnCtx.tagValueList = tagValueList;
3892 reviewWithWarnCtx.icon = icon;
3893 reviewWithWarnCtx.reviewTitle = reviewTitle;
3894 reviewWithWarnCtx.reviewSubTitle = reviewSubTitle;
3895 reviewWithWarnCtx.finishTitle = finishTitle;
3896 reviewWithWarnCtx.warning = warning;
3897 reviewWithWarnCtx.choiceCallback = choiceCallback;
3903 useCaseReview(operationType,
3916 displayInitialWarning();
3938 const char *reviewTitle,
3939 const char *reviewSubTitle,
3940 const char *finishTitle,
3943 useCaseReview(operationType,
3964 const char *rejectText,
3968 memset(&genericContext, 0,
sizeof(genericContext));
3971 onQuit = rejectCallback;
3972 navType = GENERIC_NAV;
3979 uint8_t nbPages = getNbPagesForGenericContents(&genericContext.genericContents, 0,
false);
3980 prepareNavInfo(
true, nbPages, rejectText);
3983#ifdef HAVE_PIEZO_SOUND
3985 os_io_seph_cmd_piezo_play_tune(TUNE_LOOK_AT_ME);
3988 displayGenericContextPage(0,
true);
4005 const char *reviewTitle,
4006 const char *reviewSubTitle,
4009 useCaseReviewStreamingStart(
4010 operationType, icon, reviewTitle, reviewSubTitle, choiceCallback,
true);
4028 const char *reviewTitle,
4029 const char *reviewSubTitle,
4033 operationType, icon, reviewTitle, reviewSubTitle, &blindSigningWarning, choiceCallback);
4053 const char *reviewTitle,
4054 const char *reviewSubTitle,
4058 memset(&reviewWithWarnCtx, 0,
sizeof(reviewWithWarnCtx));
4060 if ((warning == NULL)
4063 useCaseReviewStreamingStart(
4064 operationType, icon, reviewTitle, reviewSubTitle, choiceCallback,
true);
4068 operationType |= NO_THREAT_OPERATION;
4071 operationType |= RISKY_OPERATION;
4074 reviewWithWarnCtx.isStreaming =
true;
4075 reviewWithWarnCtx.operationType = operationType;
4076 reviewWithWarnCtx.icon = icon;
4077 reviewWithWarnCtx.reviewTitle = reviewTitle;
4078 reviewWithWarnCtx.reviewSubTitle = reviewSubTitle;
4079 reviewWithWarnCtx.choiceCallback = choiceCallback;
4080 reviewWithWarnCtx.warning = warning;
4086 useCaseReviewStreamingStart(
4087 operationType, icon, reviewTitle, reviewSubTitle, choiceCallback,
true);
4090 displayInitialWarning();
4111 memset(&genericContext, 0,
sizeof(genericContext));
4113 bundleNavContext.reviewStreaming.choiceCallback = choiceCallback;
4114 bundleNavContext.reviewStreaming.skipCallback = skipCallback;
4117 onChoice = bundleNavReviewStreamingChoice;
4118 navType = STREAMING_NAV;
4121 genericContext.genericContents.contentsList = localContentsList;
4122 genericContext.genericContents.nbContents = 1;
4131 bundleNavContext.reviewStreaming.stepPageNb = getNbPagesForGenericContents(
4132 &genericContext.genericContents,
4135 prepareNavInfo(
true,
4137 getRejectReviewText(bundleNavContext.reviewStreaming.operationType));
4145 displayGenericContextPage(0,
true);
4176 memset(&genericContext, 0,
sizeof(genericContext));
4178 bundleNavContext.reviewStreaming.choiceCallback = choiceCallback;
4181 onChoice = bundleNavReviewStreamingChoice;
4182 navType = STREAMING_NAV;
4185 genericContext.genericContents.contentsList = localContentsList;
4186 genericContext.genericContents.nbContents = 1;
4191 prepareReviewLastPage(bundleNavContext.reviewStreaming.operationType,
4192 &STARTING_CONTENT.content.infoLongPress,
4193 bundleNavContext.reviewStreaming.icon,
4197 bundleNavContext.reviewStreaming.stepPageNb = getNbPagesForGenericContents(
4198 &genericContext.genericContents,
4201 prepareNavInfo(
true, 1, getRejectReviewText(bundleNavContext.reviewStreaming.operationType));
4203 displayGenericContextPage(0,
true);
4215 memset(&genericContext, 0,
sizeof(genericContext));
4216 memset(&addressConfirmationContext, 0,
sizeof(addressConfirmationContext));
4219 onChoice = callback;
4220 navType = GENERIC_NAV;
4223 genericContext.genericContents.contentsList = localContentsList;
4224 genericContext.genericContents.nbContents = (tagValueList == NULL) ? 1 : 2;
4226 prepareAddressConfirmationPages(
4227 address, tagValueList, &STARTING_CONTENT, &localContentsList[1]);
4230 uint8_t nbPages = getNbPagesForGenericContents(&genericContext.genericContents, 0,
false);
4232 prepareNavInfo(
true, nbPages,
"Cancel");
4234#ifdef HAVE_PIEZO_SOUND
4236 os_io_seph_cmd_piezo_play_tune(TUNE_LOOK_AT_ME);
4239 displayGenericContextPage(0,
true);
4261 const char *reviewTitle,
4262 const char *reviewSubTitle,
4266 memset(&genericContext, 0,
sizeof(genericContext));
4268 if (addressConfirmationContext.modalLayout) {
4271 memset(&addressConfirmationContext, 0,
sizeof(addressConfirmationContext));
4274 onChoice = choiceCallback;
4275 navType = GENERIC_NAV;
4279 genericContext.genericContents.contentsList = localContentsList;
4284 prepareReviewFirstPage(
4285 &STARTING_CONTENT.content.extendedCenter.contentCenter, icon, reviewTitle, reviewSubTitle);
4286 STARTING_CONTENT.content.extendedCenter.contentCenter.subText =
"Swipe to continue";
4289 prepareAddressConfirmationPages(
4290 address, additionalTagValueList, &localContentsList[1], &localContentsList[2]);
4293 genericContext.genericContents.nbContents
4295 uint8_t nbPages = getNbPagesForGenericContents(&genericContext.genericContents, 0,
false);
4297 prepareNavInfo(
true, nbPages,
"Cancel");
4299#ifdef HAVE_PIEZO_SOUND
4301 os_io_seph_cmd_piezo_play_tune(TUNE_LOOK_AT_ME);
4304 displayGenericContextPage(0,
true);
4318 if (genericContext.type != USE_CASE_SPINNER) {
4319 memset(&genericContext, 0,
sizeof(genericContext));
4320 genericContext.type = USE_CASE_SPINNER;
4325 genericContext.backgroundLayout =
nbgl_layoutGet(&layoutDescription);
4328 genericContext.backgroundLayout, text, NULL, genericContext.spinnerPosition);
4335 genericContext.spinnerPosition++;
4338 genericContext.spinnerPosition = 0;
4341 genericContext.backgroundLayout, text, NULL, genericContext.spinnerPosition);
4345 else if (ret == 2) {
4376 tune_index_e tuneId,
4380 keypadGenericUseCase(title,
4387 validatePinCallback,
4414 tune_index_e tuneId,
4418 keypadGenericUseCase(title,
4425 validatePinCallback,
nbgl_contentTagValue_t *(* nbgl_contentTagValueCallback_t)(uint8_t pairIndex)
prototype of tag/value pair retrieval callback
@ ICON_ILLUSTRATION
simple icon
@ LARGE_CASE_INFO
text in BLACK and large case (INTER 32px), subText in black in Inter24px
@ INFO_LONG_PRESS
a centered info and a long press button
@ EXTENDED_CENTER
a centered content and a possible tip-box
@ CHOICES_LIST
list of choices through radio buttons
@ CENTERED_INFO
a centered info
@ SWITCHES_LIST
list of switches with descriptions
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
@ INFOS_LIST
list of infos with titles
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
@ TAG_VALUE_LIST
list of tag/value pairs
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
@ INFO_BUTTON
a centered info and a simple black button
@ INFO_LIST_ALIAS
alias is list of infos
@ ENS_ALIAS
alias comes from ENS
@ ADDRESS_BOOK_ALIAS
alias comes from Address Book
@ QR_CODE_ALIAS
alias is an address to be displayed as a QR Code
void(* nbgl_contentActionCallback_t)(int token, uint8_t index, int page)
prototype of function to be called when an action on a content object occurs
#define LOG_DEBUG(__logger,...)
bool nbgl_getTextMaxLenInNbLines(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, uint16_t maxNbLines, uint16_t *len, bool wrapping)
compute the len of the given text (in bytes) fitting in the given maximum nb lines,...
void nbgl_textReduceOnNbLines(nbgl_font_id_e fontId, const char *origText, uint16_t maxWidth, uint8_t nbLines, char *reducedText, uint16_t reducedTextLen)
Create a reduced version of given ASCII text to wrap it on the given max width (in pixels),...
uint16_t nbgl_getTextHeightInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
return the height of the given multiline text, with the given font.
uint16_t nbgl_getTextNbLinesInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
compute the number of lines of the given text fitting in the given maxWidth
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
int nbgl_layoutAddContentCenter(nbgl_layout_t *layout, const nbgl_contentCenter_t *info)
Creates an area on the center of the main panel, with a possible icon, and possible texts under it.
int nbgl_layoutAddTextContent(nbgl_layout_t *layout, const char *title, const char *description, const char *info)
Creates in the main container three text areas:
int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout, uint8_t index, bool enableValidate, bool enableBackspace, bool enableDigits)
Updates an existing keypad on bottom of the screen, with the given configuration.
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info)
Creates an area on the center of the main panel, with a QRCode, a possible text in black (bold) under...
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
int nbgl_layoutAddTopRightButton(nbgl_layout_t *layout, const nbgl_icon_details_t *icon, uint8_t token, tune_index_e tuneId)
Creates a Top-right button in the top right corner of the top panel.
void * nbgl_layout_t
type shared externally
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
@ HEADER_BACK_AND_TEXT
back key and optional text
int nbgl_layoutAddKeypadContent(nbgl_layout_t *layout, const char *title, bool hidden, uint8_t nbDigits, const char *text)
Adds an area with a title and a placeholder for hidden digits on top of a keypad, to represent the en...
#define NBGL_INVALID_TOKEN
int nbgl_layoutUpdateKeypadContent(nbgl_layout_t *layout, bool hidden, uint8_t nbActiveDigits, const char *text)
Updates an existing set of hidden digits, with the given configuration.
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc)
Creates a touchable area at the footer of the screen, containing various controls,...
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
int nbgl_layoutAddChoiceButtons(nbgl_layout_t *layout, const nbgl_layoutChoiceButtons_t *info)
Creates two buttons to make a choice. Both buttons are mandatory. Both buttons are full width,...
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t initPosition)
Creates a centered (vertically & horizontally) spinner with a text under it.
int nbgl_layoutUpdateSpinner(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t position)
Update an existing spinner (must be the only object of the layout)
#define NBGL_NO_PROGRESS_INDICATOR
To be used when a control token shall not be used.
int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc)
Creates a touchable (or not) area at the header of the screen, containing various controls,...
@ FOOTER_EMPTY
empty space, to have a better vertical centering of centered info
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
int nbgl_layoutAddFooter(nbgl_layout_t *layout, const char *text, uint8_t token, tune_index_e tuneId)
Creates a touchable text at the footer of the screen, separated with a thin line from the rest of the...
int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
Adds a keypad on bottom of the screen, with the associated callback.
#define NB_SPINNER_POSITIONS
void nbgl_refresh(void)
This functions refreshes the actual screen on display with what has changed since the last refresh.
#define KEYPAD_MAX_DIGITS
void nbgl_refreshSpecial(nbgl_refresh_mode_t mode)
This functions refreshes the actual screen on display with what has changed since the last refresh,...
void nbgl_refreshSpecialWithPostRefresh(nbgl_refresh_mode_t mode, nbgl_post_refresh_t post_refresh)
nbgl_page_t * nbgl_pageDrawGenericContent(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageNavigationInfo_t *nav, nbgl_pageContent_t *content)
draw a generic content page, with the given content, and if nav parameter is not NULL,...
nbgl_page_t * nbgl_pageDrawInfo(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_screenTickerConfiguration_t *ticker, const nbgl_pageInfoDescription_t *info)
draw a page with a centered info (icon and/or texts) with a touchable footer, in a potential "tapable...
void * nbgl_page_t
type shared externally
@ NAV_WITH_BUTTONS
move forward and backward with buttons in bottom nav bar
nbgl_page_t * nbgl_pageDrawLedgerInfo(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_screenTickerConfiguration_t *ticker, const char *text, int tapActionToken)
draw a page with a centered text in large case, with a round check icon
nbgl_page_t * nbgl_pageDrawConfirmation(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageConfirmationDescription_t *info)
draw a confirmation page, with a centered info (icon and/or text), a button to confirm and a footer t...
int nbgl_pageRelease(nbgl_page_t *)
Release the page obtained with any of the nbgl_pageDrawXXX() functions.
nbgl_page_t * nbgl_pageDrawGenericContentExt(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageNavigationInfo_t *nav, nbgl_pageContent_t *content, bool modal)
draw a generic content page, with the given content, and if nav parameter is not NULL,...
@ QUIT_APP_TEXT
A full width button with "Quit app" text (only for bottom button)
@ INFO_ICON
info (i) icon in the button.
@ NO_BUTTON_STYLE
no button.
@ SETTINGS_ICON
settings (wheel) icon in the button.
struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
struct to configure a screen layer
void nbgl_screenRedraw(void)
This function redraws the whole screen on top of stack and its children.
@ POST_REFRESH_FORCE_POWER_ON
Force screen power on after refresh.
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
@ FULL_COLOR_CLEAN_REFRESH
to be used for lock screen display (cleaner but longer refresh)
@ BLACK_AND_WHITE_FAST_REFRESH
to be used for pure B&W area, when contrast is not priority
@ FULL_COLOR_PARTIAL_REFRESH
to be used for small partial refresh (radio buttons, switches)
@ FULL_COLOR_REFRESH
to be used for normal refresh
API of the Advanced BOLOS Graphical Library, for typical application use-cases.
DEPRECATED void nbgl_useCaseHome(const char *appName, const nbgl_icon_details_t *appIcon, const char *tagline, bool withSettings, nbgl_callback_t topRightCallback, nbgl_callback_t quitCallback)
#define NB_MAX_LINES_IN_REVIEW
maximum number of lines for value field in review pages
DEPRECATED void nbgl_useCaseSettings(const char *settingsTitle, uint8_t initPage, uint8_t nbPages, bool touchableTitle, nbgl_callback_t quitCallback, nbgl_navCallback_t navCallback, nbgl_layoutTouchCallback_t controlsCallback)
uint8_t nbgl_useCaseGetNbTagValuesInPageExt(uint8_t nbPairs, const nbgl_contentTagValueList_t *tagValueList, uint8_t startIndex, bool isSkippable, bool *requireSpecificDisplay)
void(* nbgl_callback_t)(void)
prototype of generic callback function
#define SKIPPABLE_OPERATION
This is to use in nbgl_operationType_t when the operation is skippable. This is used.
void nbgl_useCaseGenericSettings(const char *appName, uint8_t initPage, const nbgl_genericContents_t *settingContents, const nbgl_contentInfoList_t *infosList, nbgl_callback_t quitCallback)
void nbgl_useCaseKeypadPIN(const char *title, uint8_t minDigits, uint8_t maxDigits, uint8_t backToken, bool shuffled, tune_index_e tuneId, nbgl_pinValidCallback_t validatePinCallback, nbgl_layoutTouchCallback_t actionCallback)
uint32_t nbgl_operationType_t
This mask is used to describe the type of operation to review with additional options It is a mask of...
void nbgl_useCaseReview(nbgl_operationType_t operationType, const nbgl_contentTagValueList_t *tagValueList, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, const char *finishTitle, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseAction(const nbgl_icon_details_t *icon, const char *message, const char *actionText, nbgl_callback_t callback)
uint8_t nbgl_useCaseGetNbTagValuesInPage(uint8_t nbPairs, const nbgl_contentTagValueList_t *tagValueList, uint8_t startIndex, bool *requireSpecificDisplay)
uint8_t nbgl_useCaseGetNbPagesForTagValueList(const nbgl_contentTagValueList_t *tagValueList)
DEPRECATED void nbgl_useCaseRegularReview(uint8_t initPage, uint8_t nbPages, const char *rejectText, nbgl_layoutTouchCallback_t buttonCallback, nbgl_navCallback_t navCallback, nbgl_choiceCallback_t choiceCallback)
void(* nbgl_pinValidCallback_t)(const uint8_t *pin, uint8_t pinLen)
prototype of pin validation callback function
void nbgl_useCaseReviewStreamingStart(nbgl_operationType_t operationType, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseHomeAndSettings(const char *appName, const nbgl_icon_details_t *appIcon, const char *tagline, const uint8_t initSettingPage, const nbgl_genericContents_t *settingContents, const nbgl_contentInfoList_t *infosList, const nbgl_homeAction_t *action, nbgl_callback_t quitCallback)
void nbgl_useCaseStaticReviewLight(const nbgl_contentTagValueList_t *tagValueList, const nbgl_pageInfoLongPress_t *infoLongPress, const char *rejectText, nbgl_choiceCallback_t callback)
uint8_t nbgl_useCaseGetNbInfosInPage(uint8_t nbInfos, const nbgl_contentInfoList_t *infosList, uint8_t startIndex, bool withNav)
void(* nbgl_choiceCallback_t)(bool confirm)
prototype of choice callback function
uint8_t nbgl_useCaseGetNbBarsInPage(uint8_t nbBars, const nbgl_contentBarsList_t *barsList, uint8_t startIndex, bool withNav)
void nbgl_useCaseNavigableContent(const char *title, uint8_t initPage, uint8_t nbPages, nbgl_callback_t quitCallback, nbgl_navCallback_t navCallback, nbgl_layoutTouchCallback_t controlsCallback)
#define INFOS_AREA_HEIGHT
height available for infos pairs display
@ STRONG_HOME_ACTION
Black button, implicating the main action of the App.
void nbgl_useCaseReviewStreamingFinish(const char *finishTitle, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseSpinner(const char *text)
void nbgl_useCaseConfirm(const char *message, const char *subMessage, const char *confirmText, const char *rejectText, nbgl_callback_t callback)
#define NB_MAX_LINES_IN_DETAILS
maximum number of lines for value field in details pages
void nbgl_useCaseReviewStart(const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, const char *rejectText, nbgl_callback_t continueCallback, nbgl_callback_t rejectCallback)
DEPRECATED void nbgl_useCaseHomeExt(const char *appName, const nbgl_icon_details_t *appIcon, const char *tagline, bool withSettings, const char *actionButtonText, nbgl_callback_t actionCallback, nbgl_callback_t topRightCallback, nbgl_callback_t quitCallback)
void nbgl_useCaseKeypadDigits(const char *title, uint8_t minDigits, uint8_t maxDigits, uint8_t backToken, bool shuffled, tune_index_e tuneId, nbgl_pinValidCallback_t validatePinCallback, nbgl_layoutTouchCallback_t actionCallback)
#define APP_DESCRIPTION_MAX_LEN
Length of buffer used for the default Home tagline.
void nbgl_useCaseStatus(const char *message, bool isSuccess, nbgl_callback_t quitCallback)
@ W3C_THREAT_DETECTED_WARN
Web3 Checks: Threat detected (see reportRisk field)
@ W3C_ISSUE_WARN
Web3 Checks issue (not available)
@ BLIND_SIGNING_WARN
Blind signing.
@ W3C_NO_THREAT_WARN
Web3 Checks: No Threat detected.
@ W3C_RISK_DETECTED_WARN
Web3 Checks: Risk detected (see reportRisk field)
DEPRECATED void nbgl_useCaseAddressConfirmationExt(const char *address, nbgl_choiceCallback_t callback, const nbgl_contentTagValueList_t *tagValueList)
void nbgl_useCaseGenericConfiguration(const char *title, uint8_t initPage, const nbgl_genericContents_t *contents, nbgl_callback_t quitCallback)
#define INIT_HOME_PAGE
Value to pass to nbgl_useCaseHomeAndSettings() initSettingPage parameter to initialize the use case o...
void nbgl_useCaseReviewStreamingContinueExt(const nbgl_contentTagValueList_t *tagValueList, nbgl_choiceCallback_t choiceCallback, nbgl_callback_t skipCallback)
void nbgl_useCaseReviewBlindSigning(nbgl_operationType_t operationType, const nbgl_contentTagValueList_t *tagValueList, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, const char *finishTitle, const nbgl_tipBox_t *tipBox, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseChoice(const nbgl_icon_details_t *icon, const char *message, const char *subMessage, const char *confirmText, const char *rejectString, nbgl_choiceCallback_t callback)
#define TAG_VALUE_AREA_HEIGHT
height available for tag/value pairs display
#define BLIND_OPERATION
This is to use in nbgl_operationType_t when the operation is "blind" This is used to indicate a warni...
#define TAGLINE_PART1
Default strings used in the Home tagline.
void nbgl_useCaseGenericReview(const nbgl_genericContents_t *contents, const char *rejectText, nbgl_callback_t rejectCallback)
#define STATUS_SCREEN_DURATION
void nbgl_useCaseStaticReview(const nbgl_contentTagValueList_t *tagValueList, const nbgl_pageInfoLongPress_t *infoLongPress, const char *rejectText, nbgl_choiceCallback_t callback)
void nbgl_useCaseReviewStreamingBlindSigningStart(nbgl_operationType_t operationType, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseReviewStreamingContinue(const nbgl_contentTagValueList_t *tagValueList, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseReviewLight(nbgl_operationType_t operationType, const nbgl_contentTagValueList_t *tagValueList, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, const char *finishTitle, nbgl_choiceCallback_t choiceCallback)
uint8_t nbgl_useCaseGetNbChoicesInPage(uint8_t nbChoices, const nbgl_contentRadioChoice_t *choicesList, uint8_t startIndex, bool withNav)
#define REAL_TYPE_MASK
This is the mask to apply on nbgl_operationType_t to get the real type provided by app.
void nbgl_useCaseReviewStatus(nbgl_reviewStatusType_t reviewStatusType, nbgl_callback_t quitCallback)
#define LAST_PAGE_FOR_REVIEW
value of page parameter used with navigation callback when "skip" button is touched,...
@ CENTERED_INFO_WARNING
Centered info.
@ BAR_LIST_WARNING
list of touchable bars, to display sub-pages
nbgl_reviewStatusType_t
The different types of review status.
@ STATUS_TYPE_TRANSACTION_REJECTED
@ STATUS_TYPE_ADDRESS_REJECTED
@ STATUS_TYPE_TRANSACTION_SIGNED
@ STATUS_TYPE_OPERATION_REJECTED
@ STATUS_TYPE_OPERATION_SIGNED
@ STATUS_TYPE_ADDRESS_VERIFIED
@ STATUS_TYPE_MESSAGE_SIGNED
@ STATUS_TYPE_MESSAGE_REJECTED
bool(* nbgl_navCallback_t)(uint8_t page, nbgl_pageContent_t *content)
prototype of navigation callback function
#define MAX_APP_NAME_FOR_SDK_TAGLINE
Max supported length of appName used for the default Home tagline.
void nbgl_useCaseAddressReview(const char *address, const nbgl_contentTagValueList_t *additionalTagValueList, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, nbgl_choiceCallback_t choiceCallback)
@ TYPE_TRANSACTION
For operations transferring a coin or taken from an account to another.
@ TYPE_OPERATION
For other types of operation (generic type)
void nbgl_useCaseAdvancedReviewStreamingStart(nbgl_operationType_t operationType, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, const nbgl_warning_t *warning, nbgl_choiceCallback_t choiceCallback)
void nbgl_useCaseAdvancedReview(nbgl_operationType_t operationType, const nbgl_contentTagValueList_t *tagValueList, const nbgl_icon_details_t *icon, const char *reviewTitle, const char *reviewSubTitle, const char *finishTitle, const nbgl_tipBox_t *tipBox, const nbgl_warning_t *warning, nbgl_choiceCallback_t choiceCallback)
uint8_t nbgl_useCaseGetNbSwitchesInPage(uint8_t nbSwitches, const nbgl_contentSwitchesList_t *switchesList, uint8_t startIndex, bool withNav)
This structure contains data to build a BARS_LIST content.
const uint8_t * tokens
array of tokens, one for each bar (nbBars items)
const char *const * barTexts
array of texts for each bar (nbBars items, in black/bold)
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when a bar is touched
uint8_t nbBars
number of elements in barTexts and tokens array
This structure contains info to build a centered (vertically and horizontally) area,...
uint16_t iconHug
vertical margin to apply on top and bottom of the icon
const nbgl_icon_details_t * icon
the icon (can be null)
const char * title
title in black large (can be null)
const char * description
description in black small regular case (can be null)
const char * subText
sub-text in dark gray regular small case
bool padding
if true, apply a padding of 40px at the bottom
const char * smallTitle
sub-title in black small bold case (can be null)
nbgl_contentIllustrationType_t illustrType
const char * text2
second text (can be null)
const char * text1
first text (can be null)
nbgl_contentCenteredInfoStyle_t style
style to apply to this info
int16_t offsetY
vertical shift to apply to this info (if >0, shift to bottom)
const char * text3
third text (can be null)
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
nbgl_contentCenter_t contentCenter
centered content (icon + text(s))
This structure contains data to build a centered info + simple black button content.
const char * buttonText
text of the long press button
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
const char * text
centered text in large case
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is touched
This structure contains data to build a INFOS_LIST content.
const char *const * infoContents
array of contents of infos (in black)
const char *const * infoTypes
array of types of infos (in black/bold)
const nbgl_contentValueExt_t * infoExtensions
uint8_t nbInfos
number of elements in infoTypes and infoContents array
This structure contains data to build a centered info + long press button content.
const char * longPressText
text of the long press button
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
const char * text
centered text in large case
This structure contains a list of names to build a list of radio buttons (on the right part of screen...
uint8_t initChoice
index of the current choice
const char *const * names
array of strings giving the choices (nbChoices)
uint8_t nbChoices
number of choices
This structure contains info to build a switch (on the right) with a description (on the left),...
This structure contains [item,value] pair(s) and info about a potential "details" button,...
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when details button is touched
const char * confirmationText
text of the confirmation button, if NULL "It matches" is used
uint8_t detailsButtonToken
uint8_t confirmationToken
the token used as argument of the onActionCallback
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
const char * detailsButtonText
this text is used for "details" button (if NULL, no button)
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
uint8_t detailsButtonToken
const char * detailsButtonText
this text is used for "details" button
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
This structure contains a list of [tag,value] pairs.
const nbgl_contentTagValue_t * pairs
array of [tag,value] pairs (nbPairs items). If NULL, callback is used instead
nbgl_contentTagValueCallback_t callback
function to call to retrieve a given pair
uint8_t nbMaxLinesForValue
bool wrapping
if set to true, value text will be wrapped on ' ' to avoid cutting words
uint8_t startIndex
index of the first pair to get with callback
nbgl_contentActionCallback_t actionCallback
called when a valueIcon is touched on a given pair
This structure contains a [tag,value] pair and possible extensions.
const nbgl_contentValueExt_t * extension
if not NULL, gives additional info on value field
const nbgl_icon_details_t * valueIcon
int8_t centeredInfo
if set to 1, the tag will be displayed as a centered info
const char * value
string giving the value name
const char * item
string giving the tag name
This structure contains additions to a tag/value pair, to be able to build a screen to display these ...
const char * fullValue
full string of the value when used as an alias
nbgl_contentValueAliasType_t aliasType
type of alias
const struct nbgl_contentTagValueList_s * tagValuelist
if aliasType is TAG_VALUE_LIST_ALIAS
const char * backText
used as title of the popping page, if not NULL, otherwise "item" is used
const struct nbgl_contentInfoList_s * infolist
if aliasType is INFO_LIST_ALIAS
This structure contains data to build a content.
nbgl_contentActionCallback_t contentActionCallback
callback to be called when an action on an object occurs
nbgl_contentType_t type
type of page content in the content union
uint8_t nbContents
number of contents
const nbgl_content_t * contentsList
array of nbgl_content_t (nbContents items).
nbgl_contentCallback_t contentGetterCallback
function to call to retrieve a given content
Structure describing the action button in Home Screen.
const nbgl_icon_details_t * icon
icon to use in action button in Home page
nbgl_callback_t callback
function to call when action button is touched in Home page
const char * text
text to use in action button in Home page
nbgl_homeActionStyle_t style
style of action button
This structure contains info to build a clickable "bar" with a text and an icon.
bool inactive
if set to true, the bar is grayed-out and cannot be touched
const char * text
text (can be NULL)
uint8_t token
the token that will be used as argument of the callback
bool large
set to true only for the main level of OS settings
const char * subText
sub text (can be NULL)
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const nbgl_icon_details_t * iconLeft
a buffer containing the 1BPP icon for icon on left (can be NULL)
const nbgl_icon_details_t * iconRight
Structure containing all information when creating a layout. This structure must be passed as argumen...
nbgl_screenTickerConfiguration_t ticker
const char * tapActionText
Light gray text used when main container is "tapable".
nbgl_layoutTouchCallback_t onActionCallback
the callback to be called on any action on the layout
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * url
URL for QR code.
Structure containing all specific information when creating a confirmation page.
const char * cancelText
the text used for cancel action, if NULL a simple X button is used
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is pressed
This structure contains data to build a page in multi-pages mode (nbgl_pageDrawGenericContent)
nbgl_contentTagValueDetails_t tagValueDetails
TAG_VALUE_DETAILS type
const char * title
text for the title of the page (if NULL, no title)
uint8_t topRightToken
token used when top-right button (if not NULL) is touched
nbgl_contentInfoLongPress_t infoLongPress
INFO_LONG_PRESS type
nbgl_contentRadioChoice_t choicesList
CHOICES_LIST type
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when title is touched
nbgl_contentBarsList_t barsList
BARS_LIST type
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
nbgl_contentInfoList_t infosList
INFOS_LIST type
nbgl_contentTagValueList_t tagValueList
TAG_VALUE_LIST type
const nbgl_icon_details_t * topRightIcon
nbgl_contentType_t type
type of page content in the following union
nbgl_contentCenteredInfo_t centeredInfo
CENTERED_INFO type
nbgl_contentTagValueConfirm_t tagValueConfirm
TAG_VALUE_CONFIRM type
bool isTouchableTitle
if set to true, the title is preceded by <- arrow to go back
nbgl_contentExtendedCenter_t extendedCenter
EXTENDED_CENTER type
Structure containing all specific information when creating an information page.
nbgl_layoutButtonStyle_t actionButtonStyle
style of "action" button
const char * actionButtonText
if not NULL an "action" button is set under the centered info
uint8_t bottomButtonsToken
const nbgl_icon_details_t * actionButtonIcon
potential icon of "action" button
nbgl_pageButtonStyle_t bottomButtonStyle
style to apply to the Bottom button
nbgl_layoutCenteredInfo_t centeredInfo
description of the centered info to be used
Structure containing all specific information when creating a multi-screens page.
uint8_t nbPages
the number of pages to display (if <2, no navigation bar)
uint8_t quitToken
the token used as argument of the actionCallback when the footer is touched
uint8_t skipToken
if skipText is NULL the token used when right part of footer is touched
nbgl_pageNavigationType_t navType
uint8_t activePage
the index of the page to display at start-up
bool progressIndicator
if set to true, display a progress indicator on top of the page
nbgl_pageNavWithButtons_t navWithButtons
structure used when navigation with buttons
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when next or back is pressed
bool visiblePageIndicator
if set to true, the page indicator will be visible in navigation
const char * quitText
the text displayed in footer (on the left), used to quit (only on Flex)
bool backButton
if set to true, a back button (<-) is displayed in the nav bar
This structure contains data to build a SWITCHES_LIST content.
uint8_t nbSwitches
number of elements in switches and tokens array
const nbgl_contentSwitch_t * switches
array of switches (nbSwitches items)
The necessary parameters to build a tip-box in first review page and the modal if this tip box is tou...
const char * modalTitle
title given to modal window displayed when tip-box is touched
nbgl_contentInfoList_t infos
infos pairs displayed in modal, if type is INFOS_LIST.
const char * text
text of the tip-box
const nbgl_icon_details_t * icon
icon of the tip-box
const char *const * texts
array of texts for each bar (nbBars items, in black/bold)
const struct nbgl_warningDetails_s * details
array of nbBars structures giving what to display when each bar is touched.
const char *const * subTexts
array of texts for each bar (nbBars items, in black)
uint8_t nbBars
number of touchable bars
const nbgl_icon_details_t ** icons
array of icons for each bar (nbBars items)
The necessary parameters to build the page(s) displayed when the top-right button is touched in intro...
nbgl_warningDetailsType_t type
type of content in the page, determining what to use in the following union
nbgl_contentCenter_t centeredInfo
centered info, if type == CENTERED_INFO_WARNING
const char * title
text of the page (used to go back)
nbgl_layoutQRCode_t qrCode
QR code, if type == QRCODE_WARNING.
nbgl_warningBarList_t barList
touchable bars list, if type == BAR_LIST_WARNING
The necessary parameters to build a warning page preceding a review. One can either use predefinedSet...
const nbgl_warningDetails_t * introDetails
const nbgl_warningDetails_t * reviewDetails
Union of the different type of contents.
nbgl_contentInfoList_t infosList
INFOS_LIST type
nbgl_contentInfoLongPress_t infoLongPress
INFO_LONG_PRESS type
nbgl_contentTagValueConfirm_t tagValueConfirm
TAG_VALUE_CONFIRM type
nbgl_contentTagValueList_t tagValueList
TAG_VALUE_LIST type
nbgl_contentCenteredInfo_t centeredInfo
CENTERED_INFO type
nbgl_contentBarsList_t barsList
BARS_LIST type
nbgl_contentExtendedCenter_t extendedCenter
EXTENDED_CENTER type
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
nbgl_contentRadioChoice_t choicesList
CHOICES_LIST type