Skip to content

Commit 5e89d16

Browse files
Merge pull request #451 from LedgerHQ/review-fix
Review fix
2 parents 191be9d + 0bc9ea0 commit 5e89d16

File tree

9 files changed

+33
-25
lines changed

9 files changed

+33
-25
lines changed

src/main.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -978,12 +978,7 @@ void coin_main(libargs_t *args) {
978978
tmpCtx.transactionContext.currentItemIndex = 0;
979979

980980
for (;;) {
981-
#ifdef HAVE_BAGL
982981
UX_INIT();
983-
#endif // HAVE_BAGL
984-
#ifdef HAVE_NBGL
985-
nbgl_objInit();
986-
#endif // HAVE_NBGL
987982

988983
BEGIN_TRY {
989984
TRY {

src_features/provideDomainName/cmd_provide_domain_name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ static bool parse_der_value(const s_tlv_payload *payload, size_t *offset, uint32
479479
if ((*offset + byte_length) > payload->size) {
480480
PRINTF("TLV payload too small for DER encoded value\n");
481481
} else {
482-
if (byte_length > sizeof(buf)) {
482+
if (byte_length > sizeof(buf) || byte_length == 0) {
483483
PRINTF("Unexpectedly long DER-encoded value (%u bytes)\n", byte_length);
484484
} else {
485485
memset(buf, 0, (sizeof(buf) - byte_length));

src_nbgl/ui_approve_tx.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ static void reviewContinueCommon(void) {
201201
if (tx_approval_context.fromPlugin) {
202202
// plugin id + max items + fees
203203
nbPairs += dataContext.tokenContext.pluginUiMaxItems + 1;
204-
if (tx_approval_context.displayNetwork) {
205-
nbPairs++;
206-
}
207204
} else {
208205
nbPairs += 3;
209206
if (N_storage.displayNonce) {
@@ -217,9 +214,10 @@ static void reviewContinueCommon(void) {
217214
nbPairs += 1;
218215
}
219216
#endif // HAVE_DOMAIN_NAME
220-
if (tx_approval_context.displayNetwork) {
221-
nbPairs++;
222-
}
217+
}
218+
219+
if (tx_approval_context.displayNetwork) {
220+
nbPairs++;
223221
}
224222

225223
useCaseTagValueList.pairs = NULL;

src_nbgl/ui_settings.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ static bool navCallback(uint8_t page, nbgl_pageContent_t* content) {
5656
break;
5757

5858
case 2:
59+
#ifdef HAVE_EIP712_FULL_SUPPORT
5960
switches[index++] =
6061
(nbgl_layoutSwitch_t){.initState = N_storage.verbose_eip712 ? ON_STATE : OFF_STATE,
6162
.text = "Verbose EIP712",
6263
.subText = "Ignore filtering and\ndisplay raw content",
6364
.token = EIP712_VERBOSE_TOKEN,
6465
.tuneId = TUNE_TAP_CASUAL};
66+
#endif // HAVE_EIP712_FULL_SUPPORT
6567
#ifdef HAVE_DOMAIN_NAME
6668
switches[index++] = (nbgl_layoutSwitch_t){
6769
.initState = N_storage.verbose_domain_name ? ON_STATE : OFF_STATE,
@@ -116,5 +118,15 @@ static void controlsCallback(int token, uint8_t index) {
116118
}
117119

118120
void ui_menu_settings(void) {
119-
nbgl_useCaseSettings(APPNAME " settings", 0, 3, false, ui_idle, navCallback, controlsCallback);
121+
uint8_t nb_screens = 2;
122+
#if defined(HAVE_EIP712_FULL_SUPPORT) || defined(HAVE_DOMAIN_NAME)
123+
nb_screens += 1;
124+
#endif
125+
nbgl_useCaseSettings(APPNAME " settings",
126+
0,
127+
nb_screens,
128+
false,
129+
ui_idle,
130+
navCallback,
131+
controlsCallback);
120132
}

src_nbgl/ui_sign_712.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static bool display_review_page(uint8_t page, nbgl_pageContent_t *content) {
2929
nbgl_getTextMaxLenInNbLines(BAGL_FONT_INTER_MEDIUM_32px,
3030
strings.tmp.tmp,
3131
SCREEN_WIDTH - (2 * BORDER_MARGIN),
32-
9,
32+
NB_MAX_LINES_IN_REVIEW,
3333
&len);
3434
strings.tmp.tmp[len] = '\0';
3535

@@ -39,7 +39,6 @@ static bool display_review_page(uint8_t page, nbgl_pageContent_t *content) {
3939
content->tagValueList.nbPairs = 1;
4040
content->tagValueList.pairs = &pair;
4141
content->tagValueList.wrapping = false;
42-
content->tagValueList.nbMaxLinesForValue = 0;
4342
ret = true;
4443
break;
4544

src_nbgl/ui_sign_712_v0.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static bool display_review_page(uint8_t page, nbgl_pageContent_t *content) {
3030

3131
content->type = TAG_VALUE_LIST;
3232
content->tagValueList.nbPairs = 2;
33-
content->tagValueList.nbMaxLinesForValue = 0;
3433
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
3534
} else if (page == 1) {
3635
g_position = UI_SIGNING_POSITION_SIGN;

src_nbgl/ui_sign_message.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static bool display_message(nbgl_pageContent_t *content) {
4646
reached = nbgl_getTextMaxLenInNbLines(BAGL_FONT_INTER_MEDIUM_32px,
4747
(char *) g_stax_shared_buffer,
4848
SCREEN_WIDTH - (2 * BORDER_MARGIN),
49-
9,
49+
NB_MAX_LINES_IN_REVIEW,
5050
&len);
5151

5252
stringsTmpTmpIdx = len - eip191MessageIdx;
@@ -71,7 +71,7 @@ static bool display_message(nbgl_pageContent_t *content) {
7171
content->tagValueList.nbPairs = 1;
7272
content->tagValueList.pairs = &pair;
7373
content->tagValueList.smallCaseForValue = false;
74-
content->tagValueList.nbMaxLinesForValue = 9;
74+
content->tagValueList.nbMaxLinesForValue = NB_MAX_LINES_IN_REVIEW;
7575
content->tagValueList.wrapping = false;
7676

7777
if ((g_action != UI_191_ACTION_IDLE) && (stringsTmpTmpIdx >= strlen(strings.tmp.tmp))) {

src_nbgl/ui_stark_limit_order.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
3131
pairs[0].value = strings.common.fullAmount;
3232
pairs[1].item = "Buy";
3333
pairs[1].value = strings.common.maxFee;
34-
pairs[2].item = "Token amount";
34+
pairs[2].item = "Token Account";
3535
pairs[2].value = strings.common.fullAddress;
3636

3737
content->type = TAG_VALUE_LIST;

src_nbgl/ui_stark_transfer.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
5252
pairs[count].value = strings.tmp.tmp;
5353
count++;
5454
}
55+
5556
pairs[count].item = "Token Account";
5657
pairs[count].value = strings.tmp.tmp2;
58+
count++;
59+
5760
content->type = TAG_VALUE_LIST;
5861
content->tagValueList.nbPairs = count;
5962
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
@@ -66,8 +69,8 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
6669
condAddressBuffer,
6770
sizeof(condAddressBuffer),
6871
&global_sha3,
69-
chainConfig->chainId),
70-
pairs[0].item = "Cond. Address";
72+
chainConfig->chainId);
73+
pairs[0].item = "Cond. Address";
7174
pairs[0].value = condAddressBuffer;
7275

7376
stark_sign_display_condition_fact();
@@ -78,6 +81,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
7881
content->tagValueList.nbPairs = 2;
7982
content->tagValueList.pairs = (nbgl_layoutTagValue_t *) pairs;
8083

84+
return true;
8185
} else {
8286
page++;
8387
}
@@ -86,6 +90,7 @@ static bool displayTransactionPage(uint8_t page, nbgl_pageContent_t *content) {
8690
content->type = INFO_LONG_PRESS, content->infoLongPress.icon = get_app_icon(false);
8791
content->infoLongPress.text = "Review transaction";
8892
content->infoLongPress.longPressText = SIGN_BUTTON;
93+
return true;
8994
}
9095

9196
return false;
@@ -106,19 +111,19 @@ void ui_stark_transfer(bool selfTransfer, bool conditional) {
106111
char *subTitle;
107112
if (conditional) {
108113
if (selfTransfer) {
109-
subTitle = (char *) "Conditionnal self transfer";
114+
subTitle = (char *) "Conditional Self Transfer";
110115
} else {
111-
subTitle = (char *) "Conditionnal transfer";
116+
subTitle = (char *) "Conditional Transfer";
112117
}
113118
} else {
114119
if (selfTransfer) {
115-
subTitle = (char *) "self transfer";
120+
subTitle = (char *) "Self Transfer";
116121
} else {
117122
subTitle = (char *) "Transfer";
118123
}
119124
}
120125
nbgl_useCaseReviewStart(get_app_icon(false),
121-
"Review stark transaction",
126+
"Review stark\ntransaction",
122127
subTitle,
123128
REJECT_BUTTON,
124129
reviewContinue,

0 commit comments

Comments
 (0)