Skip to content

Commit aa1975d

Browse files
authored
fix(legacy): fix evm empty data display && add long press feature (#552)
1 parent 4ac7391 commit aa1975d

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

legacy/firmware/layout2.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4624,7 +4624,9 @@ bool layoutTransactionSignEVM(const char *chain_name, uint64_t chain_id,
46244624
resp.has_code = true;
46254625
resp.code = ButtonRequestType_ButtonRequest_SignTx;
46264626
msg_write(MessageType_MessageType_ButtonRequest, &resp);
4627-
4627+
#if !EMULATOR
4628+
enableLongPress(true);
4629+
#endif
46284630
refresh_menu:
46294631
layoutSwipe();
46304632
oledClear();
@@ -4768,8 +4770,8 @@ bool layoutTransactionSignEVM(const char *chain_name, uint64_t chain_id,
47684770
oledDrawStringAdapter(0, y + 10, signer, FONT_STANDARD);
47694771
layoutButtonNoAdapter(NULL, &bmp_bottom_left_arrow);
47704772
layoutButtonYesAdapter(NULL, &bmp_bottom_right_arrow);
4771-
} else if ((has_chain_id == false && 3 == index && len > 0) ||
4772-
(has_chain_id == true && 4 == index && len > 0)) { // details
4773+
} else if ((has_chain_id == false && 3 == index) ||
4774+
(has_chain_id == true && 4 == index)) { // details
47734775
sub_index = 0;
47744776
is_details_page = true;
47754777
is_nft_page = false;
@@ -4825,7 +4827,7 @@ bool layoutTransactionSignEVM(const char *chain_name, uint64_t chain_id,
48254827
oledDrawStringAdapter(0, y, tx_msg[1], FONT_STANDARD);
48264828
layoutButtonNoAdapter(NULL, &bmp_bottom_left_close);
48274829
layoutButtonYesAdapter(NULL, &bmp_bottom_right_confirm);
4828-
} else { // raw data
4830+
} else if (len > 0) { // raw data
48294831
layoutHeader(title_data);
48304832
is_details_page = false;
48314833
is_nft_page = false;
@@ -4889,8 +4891,17 @@ bool layoutTransactionSignEVM(const char *chain_name, uint64_t chain_id,
48894891
layoutButtonYesAdapter(NULL, &bmp_bottom_right_arrow);
48904892
}
48914893
oledRefresh();
4892-
48934894
key = protectWaitKey(0, 0);
4895+
#if !EMULATOR
4896+
if (isLongPress(KEY_UP_OR_DOWN) && getLongPressStatus()) {
4897+
if (isLongPress(KEY_UP)) {
4898+
key = KEY_UP;
4899+
} else if (isLongPress(KEY_DOWN)) {
4900+
key = KEY_DOWN;
4901+
}
4902+
delay_ms(75);
4903+
}
4904+
#endif
48944905
switch (key) {
48954906
case KEY_UP:
48964907
if (sub_index > 0) {
@@ -4942,7 +4953,9 @@ bool layoutTransactionSignEVM(const char *chain_name, uint64_t chain_id,
49424953
default:
49434954
break;
49444955
}
4945-
4956+
#if !EMULATOR
4957+
enableLongPress(false);
4958+
#endif
49464959
return result;
49474960
}
49484961

0 commit comments

Comments
 (0)