Skip to content

Commit

Permalink
Merge pull request #672 from LedgerHQ/nbgl-properly-handle-details-in…
Browse files Browse the repository at this point in the history
…-review

Properly handle value details in NBGL Use Case for Flex
  • Loading branch information
nroggeman-ledger committed May 24, 2024
2 parents 0a98f98 + a5e5d35 commit 238f50d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ static const char *getRejectReviewText(nbgl_operationType_t operationType)
// or when skip choice is displayed
static void pageModalCallback(int token, uint8_t index)
{
LOG_DEBUG(USE_CASE_LOGGER, "pageModalCallback, token = %d, index = %d\n", token, index);
nbgl_pageRelease(modalPageContext);
modalPageContext = NULL;
if (token == NAV_TOKEN) {
Expand All @@ -427,6 +428,11 @@ static void pageModalCallback(int token, uint8_t index)
displayDetailsPage(index, false);
}
}
if (token == QUIT_TOKEN) {
// redraw the background layer
nbgl_screenRedraw();
nbgl_refresh();
}
else if (token == SKIP_TOKEN) {
if (index == 0) {
// display the last forward only review page, whatever it is
Expand Down Expand Up @@ -455,6 +461,7 @@ static void pageModalCallback(int token, uint8_t index)
// generic callback for all pages except modal
static void pageCallback(int token, uint8_t index)
{
LOG_DEBUG(USE_CASE_LOGGER, "pageCallback, token = %d, index = %d\n", token, index);
if (token == QUIT_TOKEN) {
if (onQuit != NULL) {
onQuit();
Expand Down Expand Up @@ -1009,6 +1016,7 @@ static void displayDetailsPage(uint8_t detailsPage, bool forceFullRefresh)
nbgl_pageNavigationInfo_t info = {.activePage = detailsPage,
.nbPages = detailsContext.nbPages,
.navType = NAV_WITH_BUTTONS,
.quitToken = QUIT_TOKEN,
.navWithButtons.navToken = NAV_TOKEN,
.navWithButtons.quitButton = true,
.navWithButtons.backButton = true,
Expand Down Expand Up @@ -1058,6 +1066,10 @@ static void displayDetailsPage(uint8_t detailsPage, bool forceFullRefresh)
detailsContext.nextPageStart = NULL;
content.tagValueList.nbMaxLinesForValue = 0;
}
if (info.nbPages == 1) {
// if only one page, no navigation bar, and use a footer instead
info.navWithButtons.quitText = "Close";
}
modalPageContext = nbgl_pageDrawGenericContentExt(&pageModalCallback, &info, &content, true);

if (forceFullRefresh) {
Expand Down

0 comments on commit 238f50d

Please sign in to comment.