@@ -4165,7 +4165,7 @@ bool layoutTransactionSign(const char *chain_name, uint64_t chain_id,
41654165 (void )signer ;
41664166 (void )recipient ;
41674167 bool result = false, has_chain_id = false;
4168- int index = 0 , sub_index = 0 , tokenid_len = 0 , token_id_rowcount = 0 ;
4168+ int index = 0 , sub_index = 0 ;
41694169 int i , y = 0 , bar_heght , bar_start = 12 , bar_end = 52 ;
41704170 uint8_t key = KEY_NULL ;
41714171 uint8_t max_index = 3 ;
@@ -4182,10 +4182,10 @@ bool layoutTransactionSign(const char *chain_name, uint64_t chain_id,
41824182 if (strlen (to_str ) / rowlen ) to_str_rowcount ++ ;
41834183 // if (strlen(signer) / rowlen) signer_rowcount++;
41844184
4185- if (token_id ) {
4186- tokenid_len = strlen (token_id );
4187- token_id_rowcount = tokenid_len / rowlen + 1 ;
4188- }
4185+ // if (token_id) {
4186+ // tokenid_len = strlen(token_id);
4187+ // // token_id_rowcount = tokenid_len / rowlen + 1;
4188+ // }
41894189 if (strncmp (chain_name , "EVM" , 3 ) == 0 ) {
41904190 has_chain_id = true;
41914191 max_index ++ ;
@@ -4221,7 +4221,9 @@ bool layoutTransactionSign(const char *chain_name, uint64_t chain_id,
42214221 resp .has_code = true;
42224222 resp .code = ButtonRequestType_ButtonRequest_SignTx ;
42234223 msg_write (MessageType_MessageType_ButtonRequest , & resp );
4224-
4224+ #if !EMULATOR
4225+ enableLongPress (true);
4226+ #endif
42254227refresh_menu :
42264228 layoutSwipe ();
42274229 oledClear ();
@@ -4390,29 +4392,33 @@ bool layoutTransactionSign(const char *chain_name, uint64_t chain_id,
43904392 oledRefresh ();
43914393
43924394 key = protectWaitKey (0 , 0 );
4395+ #if !EMULATOR
4396+ if (isLongPress (KEY_UP_OR_DOWN ) && getLongPressStatus ()) {
4397+ if (isLongPress (KEY_UP )) {
4398+ key = KEY_UP ;
4399+ } else if (isLongPress (KEY_DOWN )) {
4400+ key = KEY_DOWN ;
4401+ }
4402+ delay_ms (75 );
4403+ }
4404+ #endif
43934405 switch (key ) {
43944406 case KEY_UP :
43954407 if (sub_index > 0 ) {
43964408 sub_index -- ;
43974409 }
43984410 goto refresh_menu ;
43994411 case KEY_DOWN :
4400- if ((has_chain_id == false && len > 0 && index == 3 &&
4412+ if ((has_chain_id == false && len > 0 && index == 2 &&
44014413 sub_index < data_rowcount - 4 ) ||
4402- (has_chain_id == true && len > 0 && index == 4 &&
4414+ (has_chain_id == true && len > 0 && index == 3 &&
44034415 sub_index < data_rowcount - 4 )) {
44044416 sub_index ++ ;
44054417 }
4406- if ((has_chain_id == false && token_transfer && token_id && index == 2 &&
4407- sub_index < token_id_rowcount - 3 ) ||
4408- (has_chain_id == true && token_transfer && token_id && index == 3 &&
4409- sub_index < token_id_rowcount - 3 )) { // token_id
4410- sub_index ++ ;
4411- }
44124418
4413- if ((has_chain_id == false && 1 == index && token_id == NULL &&
4419+ if ((has_chain_id == false && 0 == index && token_id == NULL &&
44144420 sub_index < to_str_rowcount - 3 ) ||
4415- (has_chain_id == true && 2 == index && token_id == NULL &&
4421+ (has_chain_id == true && 1 == index && token_id == NULL &&
44164422 sub_index < to_str_rowcount - 3 )) { // To
44174423 sub_index ++ ;
44184424 }
@@ -4440,7 +4446,9 @@ bool layoutTransactionSign(const char *chain_name, uint64_t chain_id,
44404446 default :
44414447 break ;
44424448 }
4443-
4449+ #if !EMULATOR
4450+ enableLongPress (false);
4451+ #endif
44444452 return result ;
44454453}
44464454
0 commit comments