Skip to content

Commit

Permalink
src/tests: Use NBGL for all Nano devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Chapron committed Apr 30, 2024
1 parent 1f92f77 commit 77fac20
Show file tree
Hide file tree
Showing 148 changed files with 71 additions and 253 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
# limitations under the License.
# ****************************************************************************

ifeq ($(BOLOS_SDK),)
$(error Environment variable BOLOS_SDK is not set)
endif

include $(BOLOS_SDK)/Makefile.defines

########################################
# Mandatory configuration #
########################################
Expand Down Expand Up @@ -85,6 +79,7 @@ VARIANT_VALUES = BOL
########################################
ENABLE_BLUETOOTH = 1
#ENABLE_NFC = 1
ENABLE_NBGL_FOR_NANOS = 1

########################################
# NBGL custom features #
Expand All @@ -108,4 +103,8 @@ ENABLE_NBGL_QRCODE = 1
#DISABLE_DEBUG_LEDGER_ASSERT = 1
#DISABLE_DEBUG_THROW = 1

ifeq ($(BOLOS_SDK),)
$(error Environment variable BOLOS_SDK is not set)
endif

include $(BOLOS_SDK)/Makefile.standard_app
173 changes: 0 additions & 173 deletions src/ui/bagl_display.c

This file was deleted.

8 changes: 8 additions & 0 deletions src/ui/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

#include <stdbool.h> // bool

#if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2)
#define ICON_APP_BOILERPLATE C_app_boilerplate_16px
#define ICON_APP_WARNING C_icon_warning
#elif defined(TARGET_STAX) || defined(TARGET_FLEX)
#define ICON_APP_BOILERPLATE C_app_boilerplate_64px
#define ICON_APP_WARNING C_Warning_64px
#endif

/**
* Callback to reuse action with approve/reject in step FLOW.
*/
Expand Down
64 changes: 0 additions & 64 deletions src/ui/menu_bagl.c

This file was deleted.

16 changes: 13 additions & 3 deletions src/ui/menu_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "../globals.h"
#include "menu.h"
#include "display.h"

// -----------------------------------------------------------
// ----------------------- HOME PAGE -------------------------
Expand Down Expand Up @@ -82,7 +83,7 @@ static void review_warning_choice(bool confirm) {

// Reset setting menu to the right page
nbgl_useCaseHomeAndSettings(APPNAME,
&C_app_boilerplate_64px,
&ICON_APP_BOILERPLATE,
NULL,
initSettingPage,
&settingContents,
Expand Down Expand Up @@ -111,10 +112,15 @@ static void controls_callback(int token, uint8_t index, int page) {
// to activate the dummy 2 setting
if (!N_storage.dummy2_allowed) {
// Display the warning message and ask the user to confirm
nbgl_useCaseChoice(&C_Warning_64px,
nbgl_useCaseChoice(&ICON_APP_WARNING,
"Dummy 2",
#ifndef TARGET_NANOS
"Are you sure to\nallow dummy 2\nin transactions?",
"I understand, confirm",
#else
"Are you sure to allow dummy 2 in transactions?",
"Confirm",
#endif
"Cancel",
review_warning_choice);
} else {
Expand All @@ -134,16 +140,20 @@ void ui_menu_main(void) {
switches[DUMMY_SWITCH_1_ID].text = "Dummy 1";
switches[DUMMY_SWITCH_1_ID].subText = "Allow dummy 1\nin transactions";
switches[DUMMY_SWITCH_1_ID].token = DUMMY_SWITCH_1_TOKEN;
#ifdef HAVE_PIEZO_SOUND
switches[DUMMY_SWITCH_1_ID].tuneId = TUNE_TAP_CASUAL;
#endif

switches[DUMMY_SWITCH_2_ID].initState = (nbgl_state_t) N_storage.dummy2_allowed;
switches[DUMMY_SWITCH_2_ID].text = "Dummy 2";
switches[DUMMY_SWITCH_2_ID].subText = "Allow dummy 2\nin transactions";
switches[DUMMY_SWITCH_2_ID].token = DUMMY_SWITCH_2_TOKEN;
#ifdef HAVE_PIEZO_SOUND
switches[DUMMY_SWITCH_2_ID].tuneId = TUNE_TAP_CASUAL;
#endif

nbgl_useCaseHomeAndSettings(APPNAME,
&C_app_boilerplate_64px,
&ICON_APP_BOILERPLATE,
NULL,
INIT_HOME_PAGE,
&settingContents,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/nbgl_display_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int ui_display_address() {

nbgl_useCaseAddressReview(g_address,
NULL,
&C_app_boilerplate_64px,
&ICON_APP_BOILERPLATE,
"Verify BOL address",
NULL,
review_choice);
Expand Down
12 changes: 8 additions & 4 deletions src/ui/nbgl_display_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ static char g_amount[30];
// Buffer where the transaction address string is written
static char g_address[43];

static nbgl_layoutTagValue_t pairs[2];
static nbgl_layoutTagValueList_t pairList;
static nbgl_contentTagValue_t pairs[2];
static nbgl_contentTagValueList_t pairList;

// called when long press button on 3rd page is long-touched or when reject footer is touched
static void review_choice(bool confirm) {
Expand Down Expand Up @@ -97,8 +97,12 @@ int ui_display_transaction() {
// Start review
nbgl_useCaseReview(TYPE_TRANSACTION,
&pairList,
&C_app_boilerplate_64px,
"Review transaction\nto send BOL",
&ICON_APP_BOILERPLATE,
"Review transaction"
#ifndef TARGET_NANOS
"\nto send BOL"
#endif
,
NULL,
"Sign transaction\nto send BOL",
review_choice);
Expand Down
Binary file modified tests/snapshots/nanos/test_app_mainmenu/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/nanos/test_app_mainmenu/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/nanos/test_app_mainmenu/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/nanos/test_app_mainmenu/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 added tests/snapshots/nanos/test_app_mainmenu/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 added tests/snapshots/nanos/test_app_mainmenu/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 added tests/snapshots/nanos/test_app_mainmenu/00006.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 added tests/snapshots/nanos/test_app_mainmenu/00007.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 added tests/snapshots/nanos/test_app_mainmenu/00008.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 added tests/snapshots/nanos/test_app_mainmenu/00009.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 added tests/snapshots/nanos/test_app_mainmenu/00010.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 added tests/snapshots/nanos/test_app_mainmenu/00011.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 added tests/snapshots/nanos/test_app_mainmenu/00012.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 added tests/snapshots/nanos/test_app_mainmenu/00013.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 added tests/snapshots/nanos/test_app_mainmenu/00014.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 added tests/snapshots/nanos/test_app_mainmenu/00015.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 added tests/snapshots/nanos/test_app_mainmenu/00016.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 added tests/snapshots/nanos/test_app_mainmenu/00017.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 added tests/snapshots/nanos/test_app_mainmenu/00018.png
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/nanos/test_sign_tx_long_tx/00000.png
Binary file modified tests/snapshots/nanos/test_sign_tx_long_tx/00001.png
Binary file modified tests/snapshots/nanos/test_sign_tx_long_tx/00002.png
Binary file modified tests/snapshots/nanos/test_sign_tx_long_tx/00003.png
Binary file modified tests/snapshots/nanos/test_sign_tx_long_tx/00004.png
Binary file modified tests/snapshots/nanos/test_sign_tx_long_tx/00006.png
Binary file added tests/snapshots/nanos/test_sign_tx_long_tx/00007.png
Binary file modified tests/snapshots/nanos/test_sign_tx_refused/00000.png
Binary file modified tests/snapshots/nanos/test_sign_tx_refused/00001.png
Binary file modified tests/snapshots/nanos/test_sign_tx_refused/00002.png
Binary file modified tests/snapshots/nanos/test_sign_tx_refused/00003.png
Binary file modified tests/snapshots/nanos/test_sign_tx_refused/00004.png
Binary file modified tests/snapshots/nanos/test_sign_tx_refused/00007.png
Binary file added tests/snapshots/nanos/test_sign_tx_refused/00008.png
Binary file modified tests/snapshots/nanos/test_sign_tx_short_tx/00000.png
Binary file modified tests/snapshots/nanos/test_sign_tx_short_tx/00001.png
Binary file modified tests/snapshots/nanos/test_sign_tx_short_tx/00002.png
Binary file modified tests/snapshots/nanos/test_sign_tx_short_tx/00003.png
Binary file modified tests/snapshots/nanos/test_sign_tx_short_tx/00004.png
Binary file modified tests/snapshots/nanos/test_sign_tx_short_tx/00006.png
Binary file modified tests/snapshots/nanosp/test_app_mainmenu/00000.png
Binary file modified tests/snapshots/nanosp/test_app_mainmenu/00001.png
Binary file modified tests/snapshots/nanosp/test_app_mainmenu/00002.png
Binary file modified tests/snapshots/nanosp/test_app_mainmenu/00003.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00004.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00005.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00006.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00007.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00008.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00009.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00010.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00011.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00012.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00013.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00014.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00015.png
Binary file added tests/snapshots/nanosp/test_app_mainmenu/00016.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_long_tx/00000.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_long_tx/00001.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_long_tx/00002.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_long_tx/00003.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_long_tx/00004.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_refused/00000.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_refused/00001.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_refused/00002.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_refused/00003.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_refused/00004.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_refused/00005.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_short_tx/00000.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_short_tx/00001.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_short_tx/00002.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_short_tx/00003.png
Binary file modified tests/snapshots/nanosp/test_sign_tx_short_tx/00004.png
Binary file modified tests/snapshots/nanox/test_app_mainmenu/00000.png
Binary file modified tests/snapshots/nanox/test_app_mainmenu/00001.png
Binary file modified tests/snapshots/nanox/test_app_mainmenu/00002.png
Binary file modified tests/snapshots/nanox/test_app_mainmenu/00003.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00004.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00005.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00006.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00007.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00008.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00009.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00010.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00011.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00012.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00013.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00014.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00015.png
Binary file added tests/snapshots/nanox/test_app_mainmenu/00016.png
Binary file modified tests/snapshots/nanox/test_get_public_key_confirm_refused/00000.png
Binary file modified tests/snapshots/nanox/test_sign_tx_long_tx/00000.png
Binary file modified tests/snapshots/nanox/test_sign_tx_long_tx/00001.png
Binary file modified tests/snapshots/nanox/test_sign_tx_long_tx/00002.png
Binary file modified tests/snapshots/nanox/test_sign_tx_long_tx/00003.png
Binary file modified tests/snapshots/nanox/test_sign_tx_long_tx/00004.png
Binary file added tests/snapshots/nanox/test_sign_tx_long_tx/00005.png
Binary file modified tests/snapshots/nanox/test_sign_tx_refused/00000.png
Binary file modified tests/snapshots/nanox/test_sign_tx_refused/00001.png
Binary file modified tests/snapshots/nanox/test_sign_tx_refused/00002.png
Binary file modified tests/snapshots/nanox/test_sign_tx_refused/00003.png
Binary file modified tests/snapshots/nanox/test_sign_tx_refused/00004.png
Binary file modified tests/snapshots/nanox/test_sign_tx_refused/00005.png
Binary file added tests/snapshots/nanox/test_sign_tx_refused/00006.png
Binary file modified tests/snapshots/nanox/test_sign_tx_short_tx/00000.png
Binary file modified tests/snapshots/nanox/test_sign_tx_short_tx/00001.png
Binary file modified tests/snapshots/nanox/test_sign_tx_short_tx/00002.png
Binary file modified tests/snapshots/nanox/test_sign_tx_short_tx/00003.png
Binary file modified tests/snapshots/nanox/test_sign_tx_short_tx/00004.png
Loading

0 comments on commit 77fac20

Please sign in to comment.