2023-02-21 11:01:18 +01:00
|
|
|
#include "common_ui.h"
|
2023-07-18 10:44:20 +02:00
|
|
|
#include "ui_signing.h"
|
2023-02-21 11:01:18 +01:00
|
|
|
#include "ui_nbgl.h"
|
|
|
|
|
#include "network.h"
|
|
|
|
|
|
2023-04-07 11:30:40 +02:00
|
|
|
typedef enum { PARAMETER_CONFIRMATION, SELECTOR_CONFIRMATION } e_confirmation_type;
|
2024-06-25 12:59:59 +02:00
|
|
|
static nbgl_contentTagValue_t pair;
|
|
|
|
|
static nbgl_contentTagValueList_t pairsList;
|
2023-04-07 11:30:40 +02:00
|
|
|
|
2024-06-25 12:59:59 +02:00
|
|
|
static void reviewChoice(bool confirm) {
|
|
|
|
|
if (confirm) {
|
2024-04-15 16:32:56 +02:00
|
|
|
io_seproxyhal_touch_data_ok(NULL);
|
2024-06-25 12:59:59 +02:00
|
|
|
} else {
|
|
|
|
|
io_seproxyhal_touch_data_cancel(NULL);
|
2023-02-21 11:01:18 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-15 16:32:56 +02:00
|
|
|
static void buildScreen(e_confirmation_type confirm_type) {
|
|
|
|
|
uint32_t buf_size = SHARED_BUFFER_SIZE / 2;
|
2024-06-25 12:59:59 +02:00
|
|
|
nbgl_operationType_t op = TYPE_TRANSACTION;
|
2023-02-21 11:01:18 +01:00
|
|
|
|
2024-06-25 12:59:59 +02:00
|
|
|
pair.item = (confirm_type == PARAMETER_CONFIRMATION) ? "Parameter" : "Selector";
|
|
|
|
|
pair.value = strings.tmp.tmp;
|
|
|
|
|
pairsList.nbPairs = 1;
|
|
|
|
|
pairsList.pairs = &pair;
|
2023-07-06 16:02:40 +02:00
|
|
|
snprintf(g_stax_shared_buffer,
|
2024-04-15 16:32:56 +02:00
|
|
|
buf_size,
|
2023-04-07 11:30:40 +02:00
|
|
|
"Verify %s",
|
|
|
|
|
(confirm_type == PARAMETER_CONFIRMATION) ? "parameter" : "selector");
|
2024-04-15 16:32:56 +02:00
|
|
|
// Finish text: replace "Verify" by "Confirm" and add questionmark
|
|
|
|
|
snprintf(g_stax_shared_buffer + buf_size,
|
|
|
|
|
buf_size,
|
|
|
|
|
"Confirm %s",
|
|
|
|
|
(confirm_type == PARAMETER_CONFIRMATION) ? "parameter" : "selector");
|
|
|
|
|
|
2024-06-25 12:59:59 +02:00
|
|
|
if (tmpContent.txContent.dataPresent) {
|
|
|
|
|
op |= BLIND_OPERATION;
|
|
|
|
|
}
|
|
|
|
|
nbgl_useCaseReview(op,
|
|
|
|
|
&pairsList,
|
|
|
|
|
get_tx_icon(),
|
|
|
|
|
g_stax_shared_buffer,
|
|
|
|
|
NULL,
|
|
|
|
|
g_stax_shared_buffer + buf_size,
|
|
|
|
|
reviewChoice);
|
2023-02-21 11:01:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ui_confirm_parameter(void) {
|
2024-04-15 16:32:56 +02:00
|
|
|
buildScreen(PARAMETER_CONFIRMATION);
|
2023-04-07 11:30:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ui_confirm_selector(void) {
|
2024-04-15 16:32:56 +02:00
|
|
|
buildScreen(SELECTOR_CONFIRMATION);
|
2023-02-21 11:01:18 +01:00
|
|
|
}
|