Skip to content

Commit

Permalink
Show address from menu in STAX and FLEX
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Lukoťka committed Dec 31, 2024
1 parent 9cc3f06 commit ed4f518
Show file tree
Hide file tree
Showing 284 changed files with 19 additions and 9 deletions.
17 changes: 16 additions & 1 deletion deps/ledger-zxlib/app/ui/view_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "nbgl_use_case.h"
#include "ux.h"
#include "view_internal.h"
#include "menu_handler.h"

#ifdef APP_SECRET_MODE_ENABLED
zxerr_t secret_enabled();
Expand Down Expand Up @@ -87,6 +88,8 @@ static void h_reject_internal(void) { h_reject(review_type); }

static void h_approve_internal(void) { h_approve(review_type); }

static void h_view_address(void);

#ifdef TARGET_STAX
#define MAX_INFO_LIST_ITEM_PER_PAGE 3
#else // TARGET_FLEX
Expand All @@ -96,8 +99,11 @@ static void h_approve_internal(void) { h_approve(review_type); }
static const char *const INFO_KEYS_PAGE[] = {"Version", "Developed by", "Website", "License"};
static const char *const INFO_VALUES_PAGE[] = {APPVERSION, "Zondax AG", "https://zondax.ch", "Apache 2.0"};

static const char SHOW_STORED_PUBKEY_TEXT[] = "Show address";

static nbgl_contentInfoList_t infoList = {0};
static nbgl_genericContents_t settingContents = {0};
static nbgl_homeAction_t showStoredPubkey = {};
static nbgl_contentSwitch_t switches[SETTINGS_SWITCHES_NB_LEN];

static void h_expert_toggle() { app_mode_set_expert(!app_mode_expert()); }
Expand Down Expand Up @@ -345,8 +351,13 @@ void view_idle_show_impl(__Z_UNUSED uint8_t item_idx, const char *statusString)
infoList.infoContents = INFO_VALUES_PAGE;
infoList.infoTypes = INFO_KEYS_PAGE;

showStoredPubkey.text = SHOW_STORED_PUBKEY_TEXT;
showStoredPubkey.icon = NULL;
showStoredPubkey.callback = h_view_address;
showStoredPubkey.style = SOFT_HOME_ACTION;

nbgl_useCaseHomeAndSettings(MENU_MAIN_APP_LINE1, &C_icon_stax_64, home_text, INIT_HOME_PAGE, &settingContents,
&infoList, NULL, app_quit);
&infoList, &showStoredPubkey, app_quit);
}

void view_message_impl(const char *title, const char *message) {
Expand Down Expand Up @@ -505,4 +516,8 @@ void view_review_show_impl(unsigned int requireReply, const char *title, const c
}
}

static void h_view_address() {
handleMenuShowAddress();
}

#endif
Binary file modified tests/snapshots/flex/test_app_mainmenu/part0/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part0/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part0/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part0/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part0/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part1/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part2/00000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part2/00001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part2/00002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part2/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part2/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_app_mainmenu/part2/00005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/snapshots/flex/test_get_public_key_expert/00000.png
Binary file modified tests/snapshots/flex/test_get_public_key_expert/00003.png
Binary file modified tests/snapshots/flex/test_get_public_key_slot/part0/00004.png
Binary file modified tests/snapshots/flex/test_get_public_key_slot/part1/00004.png
Binary file modified tests/snapshots/flex/test_get_slot_accepted/part0/00004.png
Binary file modified tests/snapshots/flex/test_get_slot_accepted/part1/00005.png
Binary file modified tests/snapshots/flex/test_get_slot_accepted/part2/00004.png
Binary file modified tests/snapshots/flex/test_get_slot_refused/00003.png
Binary file modified tests/snapshots/flex/test_message_normal/part0/00004.png
Binary file modified tests/snapshots/flex/test_message_normal/part1/00000.png
Binary file modified tests/snapshots/flex/test_message_normal/part1/00003.png
Binary file modified tests/snapshots/flex/test_message_normal/part2/00005.png
Binary file modified tests/snapshots/flex/test_message_normal/part3/00005.png
Binary file modified tests/snapshots/flex/test_message_normal/part4/00005.png
Binary file modified tests/snapshots/flex/test_message_normal/part5/00000.png
Binary file modified tests/snapshots/flex/test_message_normal/part5/00003.png
Binary file modified tests/snapshots/flex/test_transaction_expert/part0/00000.png
Binary file modified tests/snapshots/flex/test_transaction_expert/part0/00003.png
Binary file modified tests/snapshots/flex/test_transaction_expert/part1/00007.png
Binary file modified tests/snapshots/flex/test_transaction_expert/part2/00007.png
Binary file modified tests/snapshots/flex/test_transaction_params/part1/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part10/00007.png
Binary file modified tests/snapshots/flex/test_transaction_params/part11/00007.png
Binary file modified tests/snapshots/flex/test_transaction_params/part12/00007.png
Binary file modified tests/snapshots/flex/test_transaction_params/part2/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part3/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part4/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part5/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part6/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part7/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part8/00009.png
Binary file modified tests/snapshots/flex/test_transaction_params/part9/00007.png
Binary file modified tests/snapshots/flex/test_transaction_refused/00003.png
Binary file modified tests/snapshots/flex/test_transaction_slot/00004.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part0/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part1/00004.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part10/00008.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part12/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part14/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part15/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part2/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part3/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part4/00009.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part6/00008.png
Binary file modified tests/snapshots/flex/test_transaction_slot/part8/00008.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part0/00000.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part0/00001.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part0/00002.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part0/00003.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part0/00004.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/stax/test_app_mainmenu/part1/00004.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part2/00000.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part2/00001.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part2/00002.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part2/00003.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part2/00004.png
Binary file modified tests/snapshots/stax/test_app_mainmenu/part2/00005.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified tests/snapshots/stax/test_get_public_key_expert/00000.png
Binary file modified tests/snapshots/stax/test_get_public_key_expert/00003.png
Binary file modified tests/snapshots/stax/test_get_public_key_slot/part0/00004.png
Binary file modified tests/snapshots/stax/test_get_public_key_slot/part1/00004.png
Binary file modified tests/snapshots/stax/test_get_slot_accepted/part0/00004.png
Binary file modified tests/snapshots/stax/test_get_slot_accepted/part1/00004.png
Binary file modified tests/snapshots/stax/test_get_slot_accepted/part2/00004.png
Binary file modified tests/snapshots/stax/test_get_slot_refused/00003.png
Binary file modified tests/snapshots/stax/test_message_normal/part0/00004.png
Binary file modified tests/snapshots/stax/test_message_normal/part1/00000.png
Binary file modified tests/snapshots/stax/test_message_normal/part1/00003.png
Binary file modified tests/snapshots/stax/test_message_normal/part2/00005.png
Binary file modified tests/snapshots/stax/test_message_normal/part3/00004.png
Binary file modified tests/snapshots/stax/test_message_normal/part4/00005.png
Binary file modified tests/snapshots/stax/test_message_normal/part5/00000.png
Binary file modified tests/snapshots/stax/test_message_normal/part5/00003.png
Binary file modified tests/snapshots/stax/test_transaction_expert/part0/00000.png
Binary file modified tests/snapshots/stax/test_transaction_expert/part0/00003.png
Binary file modified tests/snapshots/stax/test_transaction_expert/part1/00006.png
Binary file modified tests/snapshots/stax/test_transaction_expert/part2/00006.png
Binary file modified tests/snapshots/stax/test_transaction_params/part1/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part10/00006.png
Binary file modified tests/snapshots/stax/test_transaction_params/part11/00006.png
Binary file modified tests/snapshots/stax/test_transaction_params/part12/00006.png
Binary file modified tests/snapshots/stax/test_transaction_params/part2/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part3/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part4/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part5/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part6/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part7/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part8/00007.png
Binary file modified tests/snapshots/stax/test_transaction_params/part9/00006.png
Binary file modified tests/snapshots/stax/test_transaction_refused/00003.png
Binary file modified tests/snapshots/stax/test_transaction_slot/00004.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part0/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part1/00004.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part10/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part12/00008.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part14/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part15/00008.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part2/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part3/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part4/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part6/00007.png
Binary file modified tests/snapshots/stax/test_transaction_slot/part8/00007.png
11 changes: 3 additions & 8 deletions tests/test_app_mainmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_app_mainmenu(firmware, backend, navigator, test_name):
""" Check the behavior of the device main menu """

client = FlowCommandSender(backend)
choiceIdShowAdderess = 5 if firmware.device == "stax" else 4;

# Navigate in the main menu, click "View address"
if firmware.device == "nanos":
Expand Down Expand Up @@ -41,10 +42,7 @@ def test_app_mainmenu(firmware, backend, navigator, test_name):
]
else:
instructions = [
NavInsID.USE_CASE_HOME_SETTINGS,
NavInsID.USE_CASE_SETTINGS_NEXT,
NavInsID.USE_CASE_SETTINGS_NEXT,
NavInsID.USE_CASE_CHOICE_CONFIRM,
NavIns(NavInsID.CHOICE_CHOOSE, [choiceIdShowAdderess]),
NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM,
NavInsID.USE_CASE_SETTINGS_MULTI_PAGE_EXIT
Expand Down Expand Up @@ -79,10 +77,7 @@ def test_app_mainmenu(firmware, backend, navigator, test_name):
]
else:
instructions = [
NavInsID.USE_CASE_HOME_SETTINGS,
NavInsID.USE_CASE_SETTINGS_NEXT,
NavInsID.USE_CASE_SETTINGS_NEXT,
NavInsID.USE_CASE_CHOICE_CONFIRM,
NavIns(NavInsID.CHOICE_CHOOSE, [choiceIdShowAdderess]),
NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_REVIEW_TAP,
NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CONFIRM,
Expand Down

0 comments on commit ed4f518

Please sign in to comment.