From 471b033c73cf0e390ce556f0c8550c4dbd0261e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Palmer?= Date: Wed, 3 Apr 2024 11:28:19 +0200 Subject: [PATCH] UX: redisplay HWM by pushing both buttons To allow user to update the HWM screen --- src/ui_bagl.c | 17 ++++++++++++++++- test/test_instructions.py | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/ui_bagl.c b/src/ui_bagl.c index 70a0ac5c..645a2b70 100644 --- a/src/ui_bagl.c +++ b/src/ui_bagl.c @@ -38,6 +38,8 @@ #define G_display global.dynamic_display +static void ui_refresh_idle_hwm_screen(void); + /** * @brief This structure represents a context needed for home screens navigation * @@ -66,7 +68,10 @@ UX_STEP_NOCB(ux_app_is_ready_step, nn, {"Application", "is ready"}); UX_STEP_NOCB(ux_version_step, bnnn_paging, {"Tezos Baking", APPVERSION}); UX_STEP_NOCB(ux_chain_id_step, bnnn_paging, {"Chain", home_context.chain_id}); UX_STEP_NOCB(ux_authorized_key_step, bnnn_paging, {"Public Key Hash", home_context.authorized_key}); -UX_STEP_NOCB(ux_hwm_step, bnnn_paging, {"High Watermark", home_context.hwm}); +UX_STEP_CB(ux_hwm_step, + bnnn_paging, + ui_refresh_idle_hwm_screen(), + {"High Watermark", home_context.hwm}); UX_STEP_CB(ux_idle_quit_step, pb, exit_app(), {&C_icon_dashboard_x, "Quit"}); UX_FLOW(ux_idle_flow, @@ -154,6 +159,16 @@ void ui_initial_screen(void) { TZ_EXC_PRINT(exc); } +/** + * @brief Refreshes the idle HWM screen + * + * Used to update the HWM by pushing both buttons + * + */ +static void ui_refresh_idle_hwm_screen(void) { + ux_flow_init(0, ux_idle_flow, &ux_hwm_step); +} + void ux_prepare_confirm_callbacks(ui_callback_t ok_c, ui_callback_t cxl_c) { if (ok_c) { G_display.ok_callback = ok_c; diff --git a/test/test_instructions.py b/test/test_instructions.py index 971301db..d5e0ac54 100644 --- a/test/test_instructions.py +++ b/test/test_instructions.py @@ -522,6 +522,11 @@ def test_sign_preattestation( tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path) + if firmware.is_nano: + # No update for Stax + backend.both_click() + backend.wait_for_screen_change() + tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path) tezos_navigator.check_app_context( account, @@ -574,6 +579,12 @@ def test_sign_attestation( tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path) + if firmware.is_nano: + # No update for Stax + backend.both_click() + backend.wait_for_screen_change() + tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path) + tezos_navigator.check_app_context( account, chain_id=main_chain_id, @@ -625,6 +636,12 @@ def test_sign_attestation_dal( tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path) + if firmware.is_nano: + # No update for Stax + backend.both_click() + backend.wait_for_screen_change() + tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path) + tezos_navigator.check_app_context( account, chain_id=main_chain_id, @@ -676,6 +693,12 @@ def test_sign_block( tezos_navigator.assert_screen("hwm_before_sign", snap_path=snap_path) + if firmware.is_nano: + # No update for Stax + backend.both_click() + backend.wait_for_screen_change() + tezos_navigator.assert_screen("hwm_after_sign", snap_path=snap_path) + tezos_navigator.check_app_context( account, chain_id=main_chain_id,