Skip to content

Commit

Permalink
UX: redisplay HWM by pushing both buttons
Browse files Browse the repository at this point in the history
To allow user to update the HWM screen
  • Loading branch information
spalmer25 committed Apr 3, 2024
1 parent 09ed2f8 commit 471b033
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/ui_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 23 additions & 0 deletions test/test_instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 471b033

Please sign in to comment.