Skip to content

Commit

Permalink
Merge pull request #741 from LedgerHQ/tdj/update_api_level_21
Browse files Browse the repository at this point in the history
update api level 21
  • Loading branch information
tdejoigny-ledger authored Jul 25, 2024
2 parents 54db4be + 5b9ce41 commit 7d8814c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib_nbgl/src/nbgl_use_case.c
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,17 @@ static bool genericContextPreparePageContent(const nbgl_content_t *p_content,
LOG_DEBUG(USE_CASE_LOGGER, "Unsupported type %d\n", pageContent->type);
return false;
}
// if first or last page of review and blind operation, add the top-right button
if (((p_content == &STARTING_CONTENT) || (p_content->type == INFO_LONG_PRESS))
&& (((navType == STREAMING_NAV)
&& (bundleNavContext.reviewStreaming.operationType & BLIND_OPERATION))
|| ((navType == GENERIC_NAV)
&& (bundleNavContext.review.operationType & BLIND_OPERATION)))) {

bool isFirstOrLastPage
= (p_content->type == CENTERED_INFO) || (p_content->type == INFO_LONG_PRESS);
bool isStreamingNavAndBlindOperation
= (navType == STREAMING_NAV)
&& (bundleNavContext.reviewStreaming.operationType & BLIND_OPERATION);
bool isGenericNavAndBlindOperation
= (navType == GENERIC_NAV) && (bundleNavContext.review.operationType & BLIND_OPERATION);

// if first or last page of review and blind operation, add the warning top-right button
if (isFirstOrLastPage && (isStreamingNavAndBlindOperation || isGenericNavAndBlindOperation)) {
pageContent->topRightIcon = &WARNING_ICON;
pageContent->topRightToken = BLIND_WARNING_TOKEN;
}
Expand Down Expand Up @@ -2454,9 +2459,10 @@ void nbgl_useCaseStaticReview(const nbgl_contentTagValueList_t *tagValueList,
memset(&genericContext, 0, sizeof(genericContext));

// memorize context
onChoice = callback;
navType = GENERIC_NAV;
pageTitle = NULL;
onChoice = callback;
navType = GENERIC_NAV;
pageTitle = NULL;
bundleNavContext.review.operationType = TYPE_OPERATION;

genericContext.genericContents.contentsList = localContentsList;
memset(localContentsList, 0, 2 * sizeof(nbgl_content_t));
Expand Down
6 changes: 6 additions & 0 deletions lib_ux_sync/include/ux_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ ux_sync_ret_t ux_sync_reviewStatus(nbgl_reviewStatusType_t reviewStatusType);

ux_sync_ret_t ux_sync_status(const char *message, bool isSuccess);

ux_sync_ret_t ux_sync_choice(const nbgl_icon_details_t *icon,
const char *message,
const char *subMessage,
const char *confirmText,
const char *cancelText);

ux_sync_ret_t ux_sync_reviewStreamingStart(nbgl_operationType_t operationType,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
Expand Down
26 changes: 26 additions & 0 deletions lib_ux_sync/src/ux_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,32 @@ ux_sync_ret_t ux_sync_status(const char *message, bool isSuccess)
return ux_sync_wait(false);
}

/**
* @brief Draws a generic choice page, described in a centered info (with configurable icon), thanks
* to a button and a footer at the bottom of the page. The given callback is called with true as
* argument if the button is touched, false if footer is touched
*
* @param icon icon to set in center of page
* @param message string to set in center of page (32px)
* @param subMessage string to set under message (24px) (can be NULL)
* @param confirmText string to set in button, to confirm (cannot be NULL)
* @param cancelText string to set in footer, to reject (cannot be NULL)
*
* @return ret code:
* - UX_SYNC_RET_APPROVED
* - UX_SYNC_RET_REJECTED
*/
ux_sync_ret_t ux_sync_choice(const nbgl_icon_details_t *icon,
const char *message,
const char *subMessage,
const char *confirmText,
const char *cancelText)
{
ux_sync_init();
nbgl_useCaseChoice(icon, message, subMessage, confirmText, cancelText, choice_callback);
return ux_sync_wait(false);
}

/**
* @brief Start drawing the flow of pages of a review.
* @note This should be followed by calls to nbgl_useCaseReviewStreamingContinue and finally to
Expand Down

0 comments on commit 7d8814c

Please sign in to comment.