Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbgl: Add nbgl_useCaseForwardOnlyReviewNoSkip() #479

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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