Skip to content

Commit

Permalink
Merge pull request #479 from LedgerHQ/xch/nbgl_useCaseForwardOnlyRevi…
Browse files Browse the repository at this point in the history
…ewNoSkip

nbgl: Add nbgl_useCaseForwardOnlyReviewNoSkip()
  • Loading branch information
xchapron-ledger authored Dec 6, 2023
2 parents 6f81eb6 + 40d6a68 commit f680fa8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ void nbgl_useCaseForwardOnlyReview(const char *rejectText,
nbgl_layoutTouchCallback_t buttonCallback,
nbgl_navCallback_t navCallback,
nbgl_choiceCallback_t choiceCallback);
void nbgl_useCaseForwardOnlyReviewNoSkip(const char *rejectText,
nbgl_layoutTouchCallback_t buttonCallback,
nbgl_navCallback_t navCallback,
nbgl_choiceCallback_t choiceCallback);
void nbgl_useCaseStaticReview(const nbgl_layoutTagValueList_t *tagValueList,
const nbgl_pageInfoLongPress_t *infoLongPress,
const char *rejectText,
Expand Down
45 changes: 44 additions & 1 deletion lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,9 @@ void nbgl_useCaseRegularReview(uint8_t initPage,
* @brief Draws a flow of pages of a review, without back key.
* It is possible to go to next page thanks to "tap to continue".
* For each page, the given navCallback will be called to get the content. Only 'type' and
* union has to be set in this content
* union has to be set in this content.
* Note that this is not a standard use case, it should only be used on very specific
* situations.
*
* @param rejectText text to use in footer
* @param buttonCallback callback called when a potential button (details or long press) in the
Expand Down Expand Up @@ -1245,6 +1247,47 @@ void nbgl_useCaseForwardOnlyReview(const char *rejectText,
displayReviewPage(0, false);
}

/**
* @brief Draws a flow of pages of a review, without back key.
* It is possible to go to next page thanks to "tap to continue".
* For each page, the given navCallback will be called to get the content. Only 'type' and
* union has to be set in this content.
* Note that this is not a standard use case, it should only be used on very specific
* situations.
*
* @param rejectText text to use in footer
* @param buttonCallback callback called when a potential button (details or long press) in the
* content is touched
* @param navCallback callback called when navigation "tap to continue" is touched, to get the
* content of next page
* @param choiceCallback callback called when either long_press or footer is called (param is true
* for long press)
*/
void nbgl_useCaseForwardOnlyReviewNoSkip(const char *rejectText,
nbgl_layoutTouchCallback_t buttonCallback,
nbgl_navCallback_t navCallback,
nbgl_choiceCallback_t choiceCallback)
{
// memorize context
onChoice = choiceCallback;
onNav = navCallback;
onControls = buttonCallback;
forwardNavOnly = true;

// fill navigation structure
navInfo.nbPages = 0;
navInfo.navType = NAV_WITH_TAP;
navInfo.quitToken = REJECT_TOKEN;
navInfo.navWithTap.nextPageToken = NEXT_TOKEN;
navInfo.navWithTap.quitText = rejectText;
navInfo.navWithTap.backToken = BACK_TOKEN;
navInfo.navWithTap.skipText = NULL;
navInfo.progressIndicator = true;
navInfo.tuneId = TUNE_TAP_CASUAL;

displayReviewPage(0, false);
}

/**
* @brief Draws a flow of pages of a review. A back key is available on top-left of the screen,
* except in first page It is possible to go to next page thanks to "tap to continue".
Expand Down

0 comments on commit f680fa8

Please sign in to comment.