2020-06-27 13:24:04 +02:00
|
|
|
#include "shared_context.h"
|
|
|
|
|
#include "ui_callbacks.h"
|
2022-10-06 14:55:13 +02:00
|
|
|
#include "common_ui.h"
|
2022-09-02 14:22:11 +02:00
|
|
|
#include "sign_message.h"
|
|
|
|
|
|
2022-10-06 14:55:13 +02:00
|
|
|
typedef enum { UI_191_POS_REVIEW, UI_191_POS_QUESTION, UI_191_POS_END } e_ui_191_position;
|
|
|
|
|
|
2022-09-08 18:41:49 +02:00
|
|
|
static uint8_t ui_pos;
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
static void dummy_pre_cb(void) {
|
|
|
|
|
if (ui_pos == UI_191_POS_REVIEW) {
|
2022-09-08 18:41:49 +02:00
|
|
|
question_switcher();
|
2022-09-15 16:29:45 +02:00
|
|
|
} else {
|
2022-09-08 18:41:49 +02:00
|
|
|
ux_flow_prev();
|
|
|
|
|
ui_pos = UI_191_POS_REVIEW;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
static void dummy_post_cb(void) {
|
|
|
|
|
if (ui_pos == UI_191_POS_QUESTION) {
|
2023-02-09 11:30:42 +01:00
|
|
|
// temporarily disable button clicks, they will be re-enabled as soon as new data
|
|
|
|
|
// is received and the page is redrawn with ux_flow_init()
|
|
|
|
|
G_ux.stack[0].button_push_callback = NULL;
|
2023-02-20 16:37:22 +01:00
|
|
|
continue_displaying_message();
|
2022-09-15 16:29:45 +02:00
|
|
|
} else // UI_191_END
|
2022-09-08 18:41:49 +02:00
|
|
|
{
|
|
|
|
|
ui_191_switch_to_message_end();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-01 16:20:13 +01:00
|
|
|
// clang-format off
|
2020-10-20 15:40:31 +02:00
|
|
|
UX_STEP_NOCB(
|
2022-09-02 14:22:11 +02:00
|
|
|
ux_191_step_review,
|
2020-06-27 13:24:04 +02:00
|
|
|
pnn,
|
|
|
|
|
{
|
|
|
|
|
&C_icon_certificate,
|
2024-04-17 10:33:44 +02:00
|
|
|
"Review",
|
2020-06-27 13:24:04 +02:00
|
|
|
"message",
|
|
|
|
|
});
|
2020-10-20 15:40:31 +02:00
|
|
|
UX_STEP_NOCB(
|
2022-09-02 14:22:11 +02:00
|
|
|
ux_191_step_message,
|
2020-06-27 13:24:04 +02:00
|
|
|
bnnn_paging,
|
|
|
|
|
{
|
2022-05-23 16:39:24 +02:00
|
|
|
.title = "Message",
|
2020-06-27 13:24:04 +02:00
|
|
|
.text = strings.tmp.tmp,
|
|
|
|
|
});
|
2022-09-02 14:22:11 +02:00
|
|
|
UX_STEP_INIT(
|
|
|
|
|
ux_191_step_dummy_pre,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
{
|
|
|
|
|
dummy_pre_cb();
|
|
|
|
|
});
|
2020-10-20 15:40:31 +02:00
|
|
|
UX_STEP_CB(
|
2022-09-02 14:22:11 +02:00
|
|
|
ux_191_step_theres_more,
|
2022-10-03 16:57:02 +02:00
|
|
|
#ifdef TARGET_NANOS
|
|
|
|
|
nn,
|
|
|
|
|
#else
|
2022-09-15 16:23:25 +02:00
|
|
|
nnn,
|
2022-10-03 16:57:02 +02:00
|
|
|
#endif
|
2023-02-09 11:30:42 +01:00
|
|
|
G_ux.stack[0].button_push_callback = NULL; // disable button clicks
|
2022-09-08 18:41:49 +02:00
|
|
|
skip_rest_of_message(),
|
2022-09-02 14:22:11 +02:00
|
|
|
{
|
2022-10-03 16:57:02 +02:00
|
|
|
#ifndef TARGET_NANOS
|
2022-09-15 16:23:25 +02:00
|
|
|
"Press right to",
|
|
|
|
|
"continue message",
|
2022-10-03 16:57:02 +02:00
|
|
|
#else
|
|
|
|
|
"Press right to read",
|
|
|
|
|
#endif
|
2022-09-15 16:23:25 +02:00
|
|
|
"Double-press to skip"
|
2022-09-02 14:22:11 +02:00
|
|
|
});
|
|
|
|
|
UX_STEP_INIT(
|
|
|
|
|
ux_191_step_dummy_post,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
{
|
|
|
|
|
dummy_post_cb();
|
|
|
|
|
});
|
|
|
|
|
UX_STEP_CB(
|
|
|
|
|
ux_191_step_sign,
|
2020-06-27 13:24:04 +02:00
|
|
|
pbb,
|
2022-08-30 10:16:39 +02:00
|
|
|
io_seproxyhal_touch_signMessage_ok(),
|
2020-06-27 13:24:04 +02:00
|
|
|
{
|
|
|
|
|
&C_icon_validate_14,
|
|
|
|
|
"Sign",
|
|
|
|
|
"message",
|
|
|
|
|
});
|
2020-10-20 15:40:31 +02:00
|
|
|
UX_STEP_CB(
|
2022-09-02 14:22:11 +02:00
|
|
|
ux_191_step_cancel,
|
2020-06-27 13:24:04 +02:00
|
|
|
pbb,
|
2022-08-30 10:16:39 +02:00
|
|
|
io_seproxyhal_touch_signMessage_cancel(),
|
2020-06-27 13:24:04 +02:00
|
|
|
{
|
|
|
|
|
&C_icon_crossmark,
|
|
|
|
|
"Cancel",
|
|
|
|
|
"signature",
|
|
|
|
|
});
|
2020-12-01 16:20:13 +01:00
|
|
|
// clang-format on
|
2020-06-27 13:24:04 +02:00
|
|
|
|
2022-09-08 18:41:49 +02:00
|
|
|
UX_FLOW(ux_191_flow,
|
2022-09-02 14:22:11 +02:00
|
|
|
&ux_191_step_review,
|
|
|
|
|
&ux_191_step_message,
|
|
|
|
|
&ux_191_step_dummy_pre,
|
|
|
|
|
&ux_191_step_theres_more,
|
|
|
|
|
&ux_191_step_dummy_post,
|
|
|
|
|
&ux_191_step_sign,
|
|
|
|
|
&ux_191_step_cancel);
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
void ui_191_start(void) {
|
2022-09-08 18:41:49 +02:00
|
|
|
ux_flow_init(0, ux_191_flow, NULL);
|
|
|
|
|
ui_pos = UI_191_POS_REVIEW;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
void ui_191_switch_to_message(void) {
|
2022-09-08 18:41:49 +02:00
|
|
|
ux_flow_init(0, ux_191_flow, &ux_191_step_message);
|
|
|
|
|
ui_pos = UI_191_POS_REVIEW;
|
2022-09-02 14:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
void ui_191_switch_to_message_end(void) {
|
2022-09-08 18:41:49 +02:00
|
|
|
// Force it to a value that will make it automatically do a prev()
|
|
|
|
|
ui_pos = UI_191_POS_QUESTION;
|
|
|
|
|
ux_flow_init(0, ux_191_flow, &ux_191_step_dummy_pre);
|
2022-09-02 14:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
void ui_191_switch_to_sign(void) {
|
2022-09-08 18:41:49 +02:00
|
|
|
ux_flow_init(0, ux_191_flow, &ux_191_step_sign);
|
|
|
|
|
ui_pos = UI_191_POS_END;
|
2022-09-02 14:22:11 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-15 16:29:45 +02:00
|
|
|
void ui_191_switch_to_question(void) {
|
2022-09-08 18:41:49 +02:00
|
|
|
ux_flow_init(0, ux_191_flow, &ux_191_step_theres_more);
|
|
|
|
|
ui_pos = UI_191_POS_QUESTION;
|
2022-09-02 14:22:11 +02:00
|
|
|
}
|