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

Release API LEVEL 18 v18.3.0 #629

Merged
merged 9 commits into from
Apr 23, 2024
2 changes: 1 addition & 1 deletion Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
ifeq ($(USE_NBGL),0)
SDK_SOURCE_PATH += lib_bagl lib_ux
else
SDK_SOURCE_PATH += lib_nbgl lib_ux_nbgl
SDK_SOURCE_PATH += lib_nbgl lib_ux_nbgl lib_ux_sync
endif

define uniq =
Expand Down
6 changes: 3 additions & 3 deletions lib_nbgl/doc/nbgl_use_case.dox
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ Here is the code to display something similar to example picture:
// 4 pairs of tag/value to display
static nbgl_layoutTagValue_t pairs[4];

static nbgl_layoutTagValueList_t pairList = {
static nbgl_contentTagValueList_t pairList = {
.nbMaxLinesForValue = 0,
.nbPairs = 4,
.pairs = (nbgl_layoutTagValue_t*)pairs
Expand Down Expand Up @@ -604,7 +604,7 @@ static nbgl_layoutTagValue_t pair;

static nbgl_layoutTagValue_t* getPair(uint8_t index);

static nbgl_layoutTagValueList_t pairList = {
static nbgl_contentTagValueList_t pairList = {
.nbMaxLinesForValue = 0,
.nbPairs = 4,
.pairs = NULL, // to indicate that callback should be used
Expand Down Expand Up @@ -831,7 +831,7 @@ Here is the code to display something similar to example picture:
// 2 pairs of tag/value to display in second page
static nbgl_layoutTagValue_t pairs[2];

static nbgl_layoutTagValueList_t pairList = {
static nbgl_contentTagValueList_t pairList = {
.nbMaxLinesForValue = 0,
.nbPairs = 2,
.pairs = (nbgl_layoutTagValue_t*)pairs
Expand Down
4 changes: 2 additions & 2 deletions lib_nbgl/doc/nbgl_use_case_nanos.dox
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ static nbgl_layoutTagValue_t pairs[2] = {
}
};

static nbgl_layoutTagValueList_t pairList = {
static nbgl_contentTagValueList_t pairList = {
.nbMaxLinesForValue = 0,
.nbPairs = 2,
.pairs = (nbgl_layoutTagValue_t*)pairs
Expand Down Expand Up @@ -392,7 +392,7 @@ static nbgl_layoutTagValue_t pair;

static nbgl_layoutTagValue_t* getPair(uint8_t index);

static nbgl_layoutTagValueList_t pairList = {
static nbgl_contentTagValueList_t pairList = {
.nbMaxLinesForValue = 0,
.nbPairs = 5,
.pairs = NULL, // to indicate that callback should be used
Expand Down
7 changes: 6 additions & 1 deletion lib_nbgl/include/nbgl_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,15 @@ typedef struct {
uint8_t token; ///< the token that will be used as argument of the callback
uint8_t nbPages; ///< number of pages. (if 0, no navigation)
uint8_t activePage; ///< index of active page (from 0 to nbPages-1).
bool withExitKey; ///< if set to true, an exit button is drawn
bool withExitKey; ///< if set to true, an exit button is drawn (X on the left)
bool withBackKey; ///< if set to true, the "back" key is drawn
bool withSeparationLine; ///< if set to true, an horizontal line is drawn on top of bar in
///< light gray
bool withPageIndicator; ///< on Flex, a "page on nb_pages" text can be added between back and
///< forward keys
bool visibleIndicator; ///< on Flex, the page indicator can be visible or not.
///< if withPageIndicator is true and this boolean false, the back key
///< is placed as if there was an indicator
#ifdef HAVE_PIEZO_SOUND
tune_index_e tuneId; ///< if not @ref NBGL_NO_TUNE, a tune will be played when pressing keys)
#endif // HAVE_PIEZO_SOUND
Expand Down
10 changes: 6 additions & 4 deletions lib_nbgl/include/nbgl_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ typedef struct nbgl_pageNavWithTap_s {
*
*/
typedef struct nbgl_pageNavWithButtons_s {
bool quitButton; ///< if set to true, a quit button (X) is displayed in the nav bar
bool backButton; ///< if set to true, a back button (<-) is displayed in the nav bar
uint8_t navToken; ///< the token used as argument of the actionCallback when the nav buttons
///< are pressed (index param gives the page)
bool quitButton; ///< if set to true, a quit button (X) is displayed in the nav bar
bool backButton; ///< if set to true, a back button (<-) is displayed in the nav bar
bool
visiblePageIndicator; ///< if set to true, the page indicator will be visible in navigation
uint8_t navToken; ///< the token used as argument of the actionCallback when the nav buttons
///< are pressed (index param gives the page)
const char
*quitText; ///< the text displayed in footer (on the left), used to quit (only on Flex)
} nbgl_pageNavWithButtons_t;
Expand Down
94 changes: 51 additions & 43 deletions lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,28 @@ void nbgl_useCaseHomeAndSettings(const char *appName,
const nbgl_homeAction_t *action,
nbgl_callback_t quitCallback);

void nbgl_useCaseReview(nbgl_operationType_t operationType,
const nbgl_layoutTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
const char *reviewSubTitle,
const char *finishTitle,
nbgl_choiceCallback_t choiceCallback);

void nbgl_useCaseAddressReview(const char *address,
const nbgl_layoutTagValueList_t *additionalTagValueList,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
const char *reviewSubTitle,
nbgl_choiceCallback_t choiceCallback);
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_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);

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);

void nbgl_useCaseReviewStatus(nbgl_reviewStatusType_t reviewStatusType,
nbgl_callback_t quitCallback);
Expand All @@ -212,8 +220,8 @@ void nbgl_useCaseReviewStreamingStart(nbgl_operationType_t operationType,
const char *reviewSubTitle,
nbgl_choiceCallback_t choiceCallback);

void nbgl_useCaseReviewStreamingContinue(const nbgl_layoutTagValueList_t *tagValueList,
nbgl_choiceCallback_t choiceCallback);
void nbgl_useCaseReviewStreamingContinue(const nbgl_contentTagValueList_t *tagValueList,
nbgl_choiceCallback_t choiceCallback);

void nbgl_useCaseReviewStreamingFinish(const char *finishTitle,
nbgl_choiceCallback_t choiceCallback);
Expand All @@ -229,11 +237,11 @@ void nbgl_useCaseGenericConfiguration(const char *title,

#ifdef HAVE_SE_TOUCH
// utils
uint8_t nbgl_useCaseGetNbTagValuesInPage(uint8_t nbPairs,
const nbgl_layoutTagValueList_t *tagValueList,
uint8_t startIndex,
bool *requireSpecificDisplay);
uint8_t nbgl_useCaseGetNbPagesForTagValueList(const nbgl_layoutTagValueList_t *tagValueList);
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);

// use case drawing
void nbgl_useCaseHome(const char *appName,
Expand Down Expand Up @@ -302,19 +310,19 @@ 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,
nbgl_choiceCallback_t callback);
void nbgl_useCaseStaticReviewLight(const nbgl_layoutTagValueList_t *tagValueList,
const nbgl_pageInfoLongPress_t *infoLongPress,
const char *rejectText,
nbgl_choiceCallback_t callback);
void nbgl_useCaseStaticReview(const nbgl_contentTagValueList_t *tagValueList,
const nbgl_pageInfoLongPress_t *infoLongPress,
const char *rejectText,
nbgl_choiceCallback_t callback);
void nbgl_useCaseStaticReviewLight(const nbgl_contentTagValueList_t *tagValueList,
const nbgl_pageInfoLongPress_t *infoLongPress,
const char *rejectText,
nbgl_choiceCallback_t callback);
void nbgl_useCaseViewDetails(const char *tag, const char *value, bool wrapping);
void nbgl_useCaseAddressConfirmation(const char *address, nbgl_choiceCallback_t callback);
void nbgl_useCaseAddressConfirmationExt(const char *address,
nbgl_choiceCallback_t callback,
const nbgl_layoutTagValueList_t *tagValueList);
void nbgl_useCaseAddressConfirmationExt(const char *address,
nbgl_choiceCallback_t callback,
const nbgl_contentTagValueList_t *tagValueList);
#ifdef NBGL_KEYPAD
void nbgl_useCaseKeypadDigits(const char *title,
uint8_t minDigits,
Expand Down Expand Up @@ -369,21 +377,21 @@ void nbgl_useCaseSettings(uint8_t initPage,
nbgl_actionCallback_t actionCallback);
void nbgl_useCaseRegularReview(uint8_t initPage, uint8_t nbPages, nbgl_navCallback_t navCallback);
void nbgl_useCaseForwardOnlyReview(nbgl_navCallback_t navCallback);
void nbgl_useCaseStaticReview(nbgl_layoutTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
const char *acceptText,
const char *rejectText,
nbgl_choiceCallback_t callback);
void nbgl_useCaseStaticReview(nbgl_contentTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
const char *acceptText,
const char *rejectText,
nbgl_choiceCallback_t callback);
void nbgl_useCaseAddressConfirmation(const nbgl_icon_details_t *icon,
const char *title,
const char *address,
nbgl_choiceCallback_t callback);
void nbgl_useCaseAddressConfirmationExt(const nbgl_icon_details_t *icon,
const char *title,
const char *address,
nbgl_choiceCallback_t callback,
const nbgl_layoutTagValueList_t *tagValueList);
void nbgl_useCaseAddressConfirmationExt(const nbgl_icon_details_t *icon,
const char *title,
const char *address,
nbgl_choiceCallback_t callback,
const nbgl_contentTagValueList_t *tagValueList);
#endif // HAVE_SE_TOUCH
void nbgl_useCaseSpinner(const char *text);
#ifdef __cplusplus
Expand Down
42 changes: 14 additions & 28 deletions lib_nbgl/src/nbgl_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,8 @@ static void touchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
|| (eventType == SWIPED_RIGHT))
&& (obj->type == CONTAINER)) {
#if (!defined(TARGET_STAX) && defined(NBGL_KEYBOARD))
if ((layout->swipeUsage == SWIPE_USAGE_SUGGESTIONS)
&& keyboardSwipeCallback(obj, eventType)) {
// if this swipe event is consumed, return here
if (layout->swipeUsage == SWIPE_USAGE_SUGGESTIONS) {
keyboardSwipeCallback(obj, eventType);
return;
}
#endif // TARGET_STAX
Expand Down Expand Up @@ -728,9 +727,6 @@ nbgl_layout_t *nbgl_layoutGet(const nbgl_layoutDescription_t *description)
memset(layout, 0, sizeof(nbgl_layoutInternal_t));

nbTouchableControls = 0;
#ifdef NBGL_KEYBOARD
keyboardInit();
#endif // NBGL_KEYBOARD

layout->callback = (nbgl_layoutTouchCallback_t) PIC(description->onActionCallback);
layout->modal = description->modal;
Expand Down Expand Up @@ -891,14 +887,15 @@ int nbgl_layoutAddTopRightButton(nbgl_layout_t *layout,
int nbgl_layoutAddNavigationBar(nbgl_layout_t *layout, const nbgl_layoutNavigationBar_t *info)
{
nbgl_layoutFooter_t footerDesc;
footerDesc.type = FOOTER_NAV;
footerDesc.separationLine = info->withSeparationLine;
footerDesc.navigation.activePage = info->activePage;
footerDesc.navigation.nbPages = info->nbPages;
footerDesc.navigation.withExitKey = info->withExitKey;
footerDesc.navigation.withBackKey = info->withBackKey;
footerDesc.navigation.token = info->token;
footerDesc.navigation.tuneId = info->tuneId;
footerDesc.type = FOOTER_NAV;
footerDesc.separationLine = info->withSeparationLine;
footerDesc.navigation.activePage = info->activePage;
footerDesc.navigation.nbPages = info->nbPages;
footerDesc.navigation.withExitKey = info->withExitKey;
footerDesc.navigation.withBackKey = info->withBackKey;
footerDesc.navigation.withPageIndicator = false;
footerDesc.navigation.token = info->token;
footerDesc.navigation.tuneId = info->tuneId;
return nbgl_layoutAddExtendedFooter(layout, &footerDesc);
}

Expand Down Expand Up @@ -2577,13 +2574,7 @@ int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_
navContainer->obj.alignment = BOTTOM_RIGHT;
navContainer->obj.area.width = SCREEN_WIDTH - textArea->obj.area.width;
navContainer->obj.area.height = SIMPLE_FOOTER_HEIGHT;
layoutNavigationPopulate(navContainer,
footerDesc->textAndNav.navigation.nbPages,
footerDesc->textAndNav.navigation.activePage,
footerDesc->textAndNav.navigation.withExitKey,
footerDesc->textAndNav.navigation.withBackKey,
true,
layoutInt->layer);
layoutNavigationPopulate(navContainer, &footerDesc->navigation, layoutInt->layer);
obj = layoutAddCallbackObj(layoutInt,
(nbgl_obj_t *) navContainer,
footerDesc->textAndNav.navigation.token,
Expand Down Expand Up @@ -2617,13 +2608,8 @@ int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_
layoutInt->footerContainer->obj.area.width = SCREEN_WIDTH;
#endif // TARGET_STAX
layoutInt->footerContainer->obj.area.height = SIMPLE_FOOTER_HEIGHT;
layoutNavigationPopulate(layoutInt->footerContainer,
footerDesc->navigation.nbPages,
footerDesc->navigation.activePage,
footerDesc->navigation.withExitKey,
footerDesc->navigation.withBackKey,
false,
layoutInt->layer);
layoutNavigationPopulate(
layoutInt->footerContainer, &footerDesc->navigation, layoutInt->layer);
layoutInt->footerContainer->nbChildren = 4;
obj = layoutAddCallbackObj(layoutInt,
(nbgl_obj_t *) layoutInt->footerContainer,
Expand Down
11 changes: 3 additions & 8 deletions lib_nbgl/src/nbgl_layout_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,15 @@ typedef struct nbgl_layoutInternal_s {
/**********************
* GLOBAL PROTOTYPES
**********************/
void keyboardInit(void);
bool keyboardSwipeCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType);
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj);
layoutObj_t *layoutAddCallbackObj(nbgl_layoutInternal_t *layout,
nbgl_obj_t *obj,
uint8_t token,
tune_index_e tuneId);
void layoutNavigationPopulate(nbgl_container_t *navContainer,
uint8_t nbPages,
uint8_t activePage,
bool withExitKey,
bool withBackKey,
bool withPageIndicator,
uint8_t layer);
void layoutNavigationPopulate(nbgl_container_t *navContainer,
const nbgl_layoutNavigationBar_t *navConfig,
uint8_t layer);
bool layoutNavigationCallback(nbgl_obj_t *obj,
nbgl_touchType_t eventType,
uint8_t nbPages,
Expand Down
Loading
Loading