Merge remote-tracking branch 'origin/develop' into HEAD

This commit is contained in:
Alexandre Paillier
2022-10-17 11:44:28 +02:00
75 changed files with 516 additions and 534 deletions

View File

@@ -32,10 +32,6 @@ void ui_display_public_key(void) {
ux_flow_init(0, ux_display_public_flow, NULL);
}
void ui_display_sign(void) {
ux_flow_init(0, ux_sign_flow, NULL);
}
void ui_sign_712_v0(void) {
ux_flow_init(0, ux_sign_712_v0_flow, NULL);
}
@@ -74,4 +70,4 @@ void ui_confirm_parameter(void) {
ux_flow_init(0, ux_confirm_parameter_flow, NULL);
}
#endif // HAVE_BAGL
#endif // HAVE_BAGL

View File

@@ -1,5 +1,5 @@
#include "shared_context.h"
#include "ui_callbacks.h"
#include "common_ui.h"
void display_settings(const ux_flow_step_t* const start_step);
void switch_settings_blind_signing(void);

View File

@@ -20,8 +20,6 @@ extern const ux_flow_step_t* const ux_confirm_parameter_flow[];
extern const ux_flow_step_t* const ux_approval_allowance_flow[];
extern const ux_flow_step_t* const ux_sign_flow[];
extern const ux_flow_step_t* const ux_sign_712_v0_flow[];
extern const ux_flow_step_t* const ux_display_public_eth2_flow[];

View File

@@ -1,9 +1,33 @@
#include "shared_context.h"
#include "ui_callbacks.h"
#include "common_ui.h"
#include "sign_message.h"
typedef enum { UI_191_POS_REVIEW, UI_191_POS_QUESTION, UI_191_POS_END } e_ui_191_position;
static uint8_t ui_pos;
static void dummy_pre_cb(void) {
if (ui_pos == UI_191_POS_REVIEW) {
question_switcher();
} else {
ux_flow_prev();
ui_pos = UI_191_POS_REVIEW;
}
}
static void dummy_post_cb(void) {
if (ui_pos == UI_191_POS_QUESTION) {
continue_displaying_message();
} else // UI_191_END
{
ui_191_switch_to_message_end();
}
}
// clang-format off
UX_STEP_NOCB(
ux_sign_flow_1_step,
ux_191_step_review,
pnn,
{
&C_icon_certificate,
@@ -11,25 +35,56 @@ UX_STEP_NOCB(
"message",
});
UX_STEP_NOCB(
ux_sign_flow_2_step,
ux_191_step_message,
bnnn_paging,
{
.title = "Message",
.text = strings.tmp.tmp,
});
UX_STEP_INIT(
ux_191_step_dummy_pre,
NULL,
NULL,
{
dummy_pre_cb();
});
UX_STEP_CB(
ux_sign_flow_3_step,
ux_191_step_theres_more,
#ifdef TARGET_NANOS
nn,
#else
nnn,
#endif
skip_rest_of_message(),
{
#ifndef TARGET_NANOS
"Press right to",
"continue message",
#else
"Press right to read",
#endif
"Double-press to skip"
});
UX_STEP_INIT(
ux_191_step_dummy_post,
NULL,
NULL,
{
dummy_post_cb();
});
UX_STEP_CB(
ux_191_step_sign,
pbb,
io_seproxyhal_touch_signMessage_ok(NULL),
io_seproxyhal_touch_signMessage_ok(),
{
&C_icon_validate_14,
"Sign",
"message",
});
UX_STEP_CB(
ux_sign_flow_4_step,
ux_191_step_cancel,
pbb,
io_seproxyhal_touch_signMessage_cancel(NULL),
io_seproxyhal_touch_signMessage_cancel(),
{
&C_icon_crossmark,
"Cancel",
@@ -37,8 +92,37 @@ UX_STEP_CB(
});
// clang-format on
UX_FLOW(ux_sign_flow,
&ux_sign_flow_1_step,
&ux_sign_flow_2_step,
&ux_sign_flow_3_step,
&ux_sign_flow_4_step);
UX_FLOW(ux_191_flow,
&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);
void ui_191_start(void) {
ux_flow_init(0, ux_191_flow, NULL);
ui_pos = UI_191_POS_REVIEW;
}
void ui_191_switch_to_message(void) {
ux_flow_init(0, ux_191_flow, &ux_191_step_message);
ui_pos = UI_191_POS_REVIEW;
}
void ui_191_switch_to_message_end(void) {
// 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);
}
void ui_191_switch_to_sign(void) {
ux_flow_init(0, ux_191_flow, &ux_191_step_sign);
ui_pos = UI_191_POS_END;
}
void ui_191_switch_to_question(void) {
ux_flow_init(0, ux_191_flow, &ux_191_step_theres_more);
ui_pos = UI_191_POS_QUESTION;
}

View File

@@ -7,6 +7,7 @@
#include "eth_plugin_handler.h"
#include "ui_plugin.h"
#include "common_ui.h"
#include "plugins.h"
// clang-format off
UX_STEP_NOCB(

View File

@@ -3,18 +3,7 @@
#include "shared_context.h"
#include "ui_callbacks.h"
#include "ethUtils.h"
void stark_sign_display_master_account() {
snprintf(strings.tmp.tmp,
sizeof(strings.tmp.tmp),
"0x%.*H",
32,
dataContext.starkContext.transferDestination);
}
void stark_sign_display_condition_fact() {
snprintf(strings.tmp.tmp, sizeof(strings.tmp.tmp), "0x%.*H", 32, dataContext.starkContext.fact);
}
#include "starkDisplayUtils.h"
// clang-format off
UX_STEP_NOCB(ux_stark_limit_order_1_step,

View File

@@ -3,38 +3,11 @@
#include "eth_plugin_handler.h"
#include "ui_callbacks.h"
#include "ui_plugin.h"
#include "plugins.h"
// This function is not exported by the SDK
void ux_layout_paging_redisplay_by_addr(unsigned int stack_slot);
void plugin_ui_get_id() {
ethQueryContractID_t pluginQueryContractID;
eth_plugin_prepare_query_contract_ID(&pluginQueryContractID,
strings.common.fullAddress,
sizeof(strings.common.fullAddress),
strings.common.fullAmount,
sizeof(strings.common.fullAmount));
// Query the original contract for ID if it's not an internal alias
if (!eth_plugin_call(ETH_PLUGIN_QUERY_CONTRACT_ID, (void *) &pluginQueryContractID)) {
PRINTF("Plugin query contract ID call failed\n");
io_seproxyhal_touch_tx_cancel(NULL);
}
}
void plugin_ui_get_item() {
ethQueryContractUI_t pluginQueryContractUI;
eth_plugin_prepare_query_contract_UI(&pluginQueryContractUI,
dataContext.tokenContext.pluginUiCurrentItem,
strings.common.fullAddress,
sizeof(strings.common.fullAddress),
strings.common.fullAmount,
sizeof(strings.common.fullAmount));
if (!eth_plugin_call(ETH_PLUGIN_QUERY_CONTRACT_UI, (void *) &pluginQueryContractUI)) {
PRINTF("Plugin query contract UI call failed\n");
io_seproxyhal_touch_tx_cancel(NULL);
}
}
void display_next_plugin_item(bool entering) {
if (entering) {
if (dataContext.tokenContext.pluginUiState == PLUGIN_UI_OUTSIDE) {

View File

@@ -1,8 +1,6 @@
#ifndef _UI_PLUGIN_H_
#define _UI_PLUGIN_H_
void plugin_ui_get_id();
void plugin_ui_get_item();
void display_next_plugin_item(bool entering);
#endif // _UI_PLUGIN_H_