Skip to content

Commit

Permalink
Modify and enrich W3C Use Cases (and related ones)
Browse files Browse the repository at this point in the history
  • Loading branch information
nroggeman-ledger committed Feb 21, 2025
1 parent 0fb6880 commit 2f4d780
Show file tree
Hide file tree
Showing 7 changed files with 414 additions and 312 deletions.
Binary file added lib_nbgl/glyphs/32px/Question_32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib_nbgl/glyphs/40px/Question_40px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions lib_nbgl/include/nbgl_content.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ typedef enum {
NO_ALIAS_TYPE = 0,
ENS_ALIAS, ///< alias comes from ENS
ADDRESS_BOOK_ALIAS, ///< alias comes from Address Book
QR_CODE_ALIAS ///< alias is an address to be displayed as a QR Code
QR_CODE_ALIAS, ///< alias is an address to be displayed as a QR Code
INFO_LIST_ALIAS ///< alias is list of infos
} nbgl_contentValueAliasType_t;

/**
Expand All @@ -153,7 +154,8 @@ typedef struct {
///< only used if aliasType is @ref NO_ALIAS_TYPE
const char *title; ///< if not NULL and aliasType is @ref QR_CODE_ALIAS, is used as title of
///< the QR Code
nbgl_contentValueAliasType_t aliasType; ///< type of alias
const struct nbgl_contentInfoList_s *infolist; ///< if aliasType is INFO_LIST_ALIAS
nbgl_contentValueAliasType_t aliasType; ///< type of alias
} nbgl_contentValueExt_t;

/**
Expand All @@ -172,8 +174,8 @@ typedef struct {
int8_t forcePageStart : 1; ///< if set to 1, the tag will be displayed at the top of a new
///< review page
int8_t centeredInfo : 1; ///< if set to 1, the tag will be displayed as a centered info
int8_t aliasValue : 1; ///< if set to 1, the value represents an alias and an icon enables to
///< view the full value
int8_t aliasValue : 1; ///< if set to 1, the value represents an alias and an > icon enables to
///< view the full value (extension field in union)
#endif
} nbgl_contentTagValue_t;

Expand Down Expand Up @@ -279,7 +281,7 @@ typedef struct nbgl_pageSwitchesList_s {
/**
* @brief This structure contains data to build a @ref INFOS_LIST content
*/
typedef struct {
typedef struct nbgl_contentInfoList_s {
const char *const *infoTypes; ///< array of types of infos (in black/bold)
const char *const *infoContents; ///< array of contents of infos (in black)
const nbgl_contentValueExt_t
Expand Down
19 changes: 11 additions & 8 deletions lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ typedef struct {
const char *modalTitle; ///< title given to modal window displayed when tip-box is touched
nbgl_contentType_t type; ///< type of page content in the following union
union {
nbgl_contentInfoList_t infos; ///< infos pairs displayed in modal.
nbgl_contentInfoList_t
infos; ///< infos pairs displayed in modal, if type is @ref INFOS_LIST.
};
} nbgl_tipBox_t;

Expand Down Expand Up @@ -235,10 +236,11 @@ typedef struct nbgl_warningDetails_s {
*
*/
typedef enum {
BLIND_SIGNING_WARN = 0, ///< Blind signing
W3C_ISSUE_WARN, ///< Web3 Checks issue
W3C_LOSING_SWAP_WARN, ///< Web3 Checks: Losing Swap risk
W3C_THREAT_DETECTED_WARN, ///< Web3 Checks: Thread detexted, malicious (know drainer)
W3C_ISSUE_WARN = 0, ///< Web3 Checks issue (not available)
W3C_RISK_DETECTED_WARN, ///< Web3 Checks: Risk detected (see reportRisk field)
W3C_THREAT_DETECTED_WARN, ///< Web3 Checks: Threat detected (see reportRisk field)
W3C_NO_THREAT_WARN, ///< Web3 Checks: No Threat detected
BLIND_SIGNING_WARN, ///< Blind signing
NB_WARNING_TYPES
} nbgl_warningType_t;

Expand All @@ -252,10 +254,11 @@ typedef enum {
*
*/
typedef struct {
uint32_t predefinedSet; ///< bitfield of pre-defined warnings, to be taken in @ref
///< nbgl_warningType_t set it to 0 if not using pre-defined warnings
uint32_t predefinedSet; ///< bitfield of pre-defined warnings, to be taken in @ref
///< nbgl_warningType_t set it to 0 if not using pre-defined warnings
const char *dAppProvider; ///< name of the dApp provider, used in some strings
const char *reportUrl; ///< URL of the report, used in some strings
const char *reportProvider; ///< name of the security report provider, used in some strings
const char *reportUrl; ///< URL of the report, used in some strings
const char *providerMessage; ///< Dedicated provider message. Default one will be used if NULL
const nbgl_warningDetails_t
*introDetails; ///< details displayed when top-right button is touched in intro page
Expand Down
2 changes: 1 addition & 1 deletion lib_nbgl/src/nbgl_layout.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static void touchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
return;
}
LOG_DEBUG(LAYOUT_LOGGER, "touchCallback(): layout->callback = %p\n", layout->callback);
if (layout->callback != NULL) {
if ((layout->callback != NULL) && (layoutObj->token != NBGL_INVALID_TOKEN)) {
#ifdef HAVE_PIEZO_SOUND
if (layoutObj->tuneId < NBGL_NO_TUNE) {
io_seproxyhal_play_tune(layoutObj->tuneId);
Expand Down
2 changes: 1 addition & 1 deletion lib_nbgl/src/nbgl_page.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void addContent(nbgl_pageContent_t *content,
break;

case EXTENDED_CENTER:
if ((!headerAdded) && (content->extendedCenter.tipBox.text == NULL)) {
if (!headerAdded) {
addEmptyHeader(layout, SMALL_CENTERING_HEADER);
}
nbgl_layoutAddContentCenter(layout, &content->extendedCenter.contentCenter);
Expand Down
Loading

0 comments on commit 2f4d780

Please sign in to comment.