Skip to content

Commit

Permalink
ui: info_display functions are now internal to nano
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed May 30, 2023
1 parent d3553b7 commit 8246736
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/monero_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ int monero_apdu_close_tx(void);
void ui_init(void);
void ui_menu_lock_display(void);
void ui_menu_main_display(void);
void ui_menu_info_display(unsigned int value);
void ui_menu_info_display2(unsigned int value, const char *line1, const char *line2);
void ui_menu_show_security_error(void);
void ui_menu_show_tx_aborted(void);
void ui_export_viewkey_display(unsigned int value);
void ui_menu_any_pubaddr_display(unsigned int value, unsigned char *pub_view,
unsigned char *pub_spend, unsigned char is_subbadress,
Expand Down
2 changes: 1 addition & 1 deletion src/monero_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,6 @@ void monero_lock_and_throw(int sw) {
G_monero_vstate.protocol_barrier = PROTOCOL_LOCKED;
snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "Security Err");
snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%x", sw);
ui_menu_info_display(0);
ui_menu_show_security_error();
THROW(sw);
}
2 changes: 1 addition & 1 deletion src/monero_open_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int monero_apdu_close_tx() {
/* ----------------------------------------------------------------------- */
int monero_abort_tx() {
monero_reset_tx(1);
ui_menu_info_display2(0, "TX", "Aborted");
ui_menu_show_tx_aborted();
return 0;
}

Expand Down
14 changes: 11 additions & 3 deletions src/monero_ux_nano.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,25 @@ unsigned int ui_menu_info_action(unsigned int value __attribute__((unused))) {
return 0;
}

void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1,
const char* line2) {
static void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1,
const char* line2) {
snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "%s", line1);
snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%s", line2);
ux_flow_init(0, ux_flow_info, NULL);
}

void ui_menu_info_display(unsigned int value __attribute__((unused))) {
static void ui_menu_info_display(unsigned int value __attribute__((unused))) {
ux_flow_init(0, ux_flow_info, NULL);
}

void ui_menu_show_tx_aborted(void) {
ui_menu_info_display2(0, "TX", "Aborted");
}

void ui_menu_show_security_error(void) {
ui_menu_info_display(0);
}

/* -------------------------------- OPEN TX UX --------------------------------- */
unsigned int ui_menu_transaction_start(void) {
return SW_OK;
Expand Down
14 changes: 11 additions & 3 deletions src/monero_ux_nanos.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,25 @@ unsigned int ui_menu_info_button(unsigned int button_mask,
return 0;
}

void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1,
const char* line2) {
static void ui_menu_info_display2(unsigned int value __attribute__((unused)), const char* line1,
const char* line2) {
snprintf(G_monero_vstate.ux_info1, sizeof(G_monero_vstate.ux_info1), "%s", line1);
snprintf(G_monero_vstate.ux_info2, sizeof(G_monero_vstate.ux_info2), "%s", line2);
UX_DISPLAY(ui_menu_info, NULL);
}

void ui_menu_info_display(unsigned int value __attribute__((unused))) {
static void ui_menu_info_display(unsigned int value __attribute__((unused))) {
UX_DISPLAY(ui_menu_info, NULL);
}

void ui_menu_show_tx_aborted(void) {
ui_menu_info_display2(0, "TX", "Aborted");
}

void ui_menu_show_security_error(void) {
ui_menu_info_display(0);
}

/* -------------------------------- OPEN TX UX --------------------------------- */

unsigned int ui_menu_transaction_signed(void) {
Expand Down
6 changes: 2 additions & 4 deletions src/monero_ux_stax.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ static void ui_menu_info_action(void) {
}
}

void ui_menu_info_display2(unsigned int value __attribute__((unused)),
const char* line1 __attribute__((unused)),
const char* line2 __attribute__((unused))) {
void ui_menu_show_tx_aborted(void) {
nbgl_useCaseStatus("Transaction\ncancelled", false, ui_menu_info_action);
}

void ui_menu_info_display(unsigned int value __attribute__((unused))) {
void ui_menu_show_security_error(void) {
nbgl_useCaseStatus("Security Error", false, ui_menu_info_action);
}

Expand Down

0 comments on commit 8246736

Please sign in to comment.