Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sgliner-ledger committed Apr 26, 2024
1 parent 251089e commit ac70a29
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/boilerplate/dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ void apdu_dispatcher(command_descriptor_t const cmd_descriptors[],
// - background processing took long enough that the "Processing..." screen was shown.
bool is_ux_dirty = G_dispatcher_state.had_ux_flow || G_was_processing_screen_shown;
if (G_dispatcher_state.termination_cb != NULL && is_ux_dirty) {
#ifdef HAVE_BAGL
G_dispatcher_state.termination_cb();
#endif
G_was_processing_screen_shown = 0;
}

Expand Down
6 changes: 0 additions & 6 deletions src/handler/sign_psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,6 @@ confirm_transaction(dispatcher_context_t *dc, sign_psbt_state_t *st) {
if (10 * fee >= st->inputs_total_amount && st->inputs_total_amount > 10000) {
if (!ui_warn_high_fee(dc)) {
SEND_SW(dc, SW_DENY);
ui_post_processing_confirm_transaction(dc, false);
return false;
}
}
Expand All @@ -1374,7 +1373,6 @@ confirm_transaction(dispatcher_context_t *dc, sign_psbt_state_t *st) {
bool is_self_transfer = st->outputs.n_external == 0;
if (!ui_validate_transaction(dc, COIN_COINID_SHORT, fee, is_self_transfer)) {
SEND_SW(dc, SW_DENY);
ui_post_processing_confirm_transaction(dc, false);
return false;
}
}
Expand Down Expand Up @@ -2469,10 +2467,6 @@ sign_transaction(dispatcher_context_t *dc,
return false;

if (!sign_transaction_input(dc, st, &hashes, &placeholder_info, &input, i)) {
if (!G_swap_state.called_from_swap) {
ui_post_processing_confirm_transaction(dc, false);
}

// we do not send a status word, since sign_transaction_input
// already does it on failure
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/ui/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,10 @@ bool ui_post_processing_confirm_wallet_registration(dispatcher_context_t *contex
}

bool ui_post_processing_confirm_transaction(dispatcher_context_t *context, bool success) {
(void) context;
ui_display_post_processing_confirm_transaction(success);

return io_ui_process(context, success);
return true;
}

bool ui_post_processing_confirm_message(dispatcher_context_t *context, bool success) {
Expand Down
21 changes: 14 additions & 7 deletions src/ui/display_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ static void status_operation_silent_confirmation_callback(bool confirm) {

static void status_address_callback(bool confirm) {
if (confirm) {
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_VERIFIED, ux_flow_response_true);
ux_flow_response_true();
nbgl_useCaseReviewStatus(STATUS_TYPE_ADDRESS_VERIFIED, ui_menu_main);
} else {
status_address_cancel();
}
Expand Down Expand Up @@ -510,25 +511,31 @@ void ui_display_nondefault_sighash_flow(void) {
// Statuses
void ui_display_post_processing_confirm_message(bool success) {
if (success) {
nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_SIGNED, ux_flow_response_true);
ux_flow_response_true();
nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_SIGNED, ui_menu_main);
} else {
nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_REJECTED, ux_flow_response_false);
ux_flow_response_false();
nbgl_useCaseReviewStatus(STATUS_TYPE_MESSAGE_REJECTED, ui_menu_main);
}
}

void ui_display_post_processing_confirm_wallet_registation(bool success) {
if (success) {
nbgl_useCaseStatus("Wallet\nregistered", true, ux_flow_response_true);
ux_flow_response_true();
nbgl_useCaseStatus("Wallet\nregistered", true, ui_menu_main);
} else {
nbgl_useCaseStatus("Wallet rejected", false, ux_flow_response_false);
ux_flow_response_false();
nbgl_useCaseStatus("Wallet rejected", false, ui_menu_main);
}
}

void ui_display_post_processing_confirm_transaction(bool success) {
if (success) {
nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_SIGNED, ux_flow_response_true);
ux_flow_response_true();
nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_SIGNED, ui_menu_main);
} else {
nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_REJECTED, ux_flow_response_false);
ux_flow_response_false();
nbgl_useCaseReviewStatus(STATUS_TYPE_TRANSACTION_REJECTED, ui_menu_main);
}
}
#endif // HAVE_NBGL

0 comments on commit ac70a29

Please sign in to comment.