From 56e0875979784eecd3e0e1645fb0cc8513ae73d4 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Thu, 16 Jun 2022 17:52:08 +0200 Subject: [PATCH] Made the hacky 712 generic step redraw a function --- src_features/signMessageEIP712/ui_logic.c | 18 +++++++++++------- src_features/signMessageEIP712/ui_logic.h | 1 + 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src_features/signMessageEIP712/ui_logic.c b/src_features/signMessageEIP712/ui_logic.c index 1948c2a..c80e546 100644 --- a/src_features/signMessageEIP712/ui_logic.c +++ b/src_features/signMessageEIP712/ui_logic.c @@ -66,6 +66,16 @@ void ui_712_set_value(const char *const str, uint8_t length) ui_712_set_buf(str, length, strings.tmp.tmp, sizeof(strings.tmp.tmp), true); } +void ui_712_redraw_generic_step(void) +{ + // not pretty, manually changes the internal state of the UX flow + // so that we always land on the first screen of a paging step without any visible + // screen glitching (quick screen switching) + G_ux.flow_stack[G_ux.stack_count - 1].index = 0; + // since the flow now thinks we are displaying the first step, do next + ux_flow_next(); +} + /** * Called on the intermediate dummy screen between the dynamic step * && the approve/reject screen @@ -265,13 +275,7 @@ void ui_712_new_field(const void *const field_ptr, const uint8_t *const data, default: PRINTF("Unhandled type\n"); } - - // not pretty, manually changes the internal state of the UX flow - // so that we always land on the first screen of a paging step without any visible - // screen glitching (quick screen switching) - G_ux.flow_stack[G_ux.stack_count - 1].index = 0; - // since the flow now thinks we are displaying the first step, do next - ux_flow_next(); + ui_712_redraw_generic_step(); } /** diff --git a/src_features/signMessageEIP712/ui_logic.h b/src_features/signMessageEIP712/ui_logic.h index 8c0ec22..43889fc 100644 --- a/src_features/signMessageEIP712/ui_logic.h +++ b/src_features/signMessageEIP712/ui_logic.h @@ -32,6 +32,7 @@ void ui_712_set_value(const char *const str, uint8_t length); #ifdef HAVE_EIP712_HALF_BLIND void ui_712_message_hash(void); #endif // HAVE_EIP712_HALF_BLIND +void ui_712_redraw_generic_step(void); #endif // HAVE_EIP712_FULL_SUPPORT