commonise plugins
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include "eth_plugin_handler.h"
|
#include "eth_plugin_handler.h"
|
||||||
#include "ui_plugin.h"
|
#include "ui_plugin.h"
|
||||||
#include "common_ui.h"
|
#include "common_ui.h"
|
||||||
|
#include "plugins.h"
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
UX_STEP_NOCB(
|
UX_STEP_NOCB(
|
||||||
|
|||||||
@@ -3,38 +3,11 @@
|
|||||||
#include "eth_plugin_handler.h"
|
#include "eth_plugin_handler.h"
|
||||||
#include "ui_callbacks.h"
|
#include "ui_callbacks.h"
|
||||||
#include "ui_plugin.h"
|
#include "ui_plugin.h"
|
||||||
|
#include "plugins.h"
|
||||||
|
|
||||||
// This function is not exported by the SDK
|
// This function is not exported by the SDK
|
||||||
void ux_layout_paging_redisplay_by_addr(unsigned int stack_slot);
|
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) {
|
void display_next_plugin_item(bool entering) {
|
||||||
if (entering) {
|
if (entering) {
|
||||||
if (dataContext.tokenContext.pluginUiState == PLUGIN_UI_OUTSIDE) {
|
if (dataContext.tokenContext.pluginUiState == PLUGIN_UI_OUTSIDE) {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#ifndef _UI_PLUGIN_H_
|
#ifndef _UI_PLUGIN_H_
|
||||||
#define _UI_PLUGIN_H_
|
#define _UI_PLUGIN_H_
|
||||||
|
|
||||||
void plugin_ui_get_id();
|
|
||||||
void plugin_ui_get_item();
|
|
||||||
void display_next_plugin_item(bool entering);
|
void display_next_plugin_item(bool entering);
|
||||||
|
|
||||||
#endif // _UI_PLUGIN_H_
|
#endif // _UI_PLUGIN_H_
|
||||||
|
|||||||
40
src_common/plugins.c
Normal file
40
src_common/plugins.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#include "eth_plugin_handler.h"
|
||||||
|
#include "ui_callbacks.h"
|
||||||
|
|
||||||
|
void plugin_ui_get_id(void) {
|
||||||
|
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_internal(char *title_buffer,
|
||||||
|
size_t title_buffer_size,
|
||||||
|
char *msg_buffer,
|
||||||
|
size_t msg_buffer_size) {
|
||||||
|
ethQueryContractUI_t pluginQueryContractUI;
|
||||||
|
eth_plugin_prepare_query_contract_UI(&pluginQueryContractUI,
|
||||||
|
dataContext.tokenContext.pluginUiCurrentItem,
|
||||||
|
title_buffer,
|
||||||
|
title_buffer_size,
|
||||||
|
msg_buffer,
|
||||||
|
msg_buffer_size);
|
||||||
|
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 plugin_ui_get_item(void) {
|
||||||
|
plugin_ui_get_item_internal(strings.common.fullAddress,
|
||||||
|
sizeof(strings.common.fullAddress),
|
||||||
|
strings.common.fullAmount,
|
||||||
|
sizeof(strings.common.fullAmount));
|
||||||
|
}
|
||||||
11
src_common/plugins.h
Normal file
11
src_common/plugins.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef _PLUGIN_H_
|
||||||
|
#define _PLUGIN_H_
|
||||||
|
|
||||||
|
void plugin_ui_get_id();
|
||||||
|
void plugin_ui_get_item();
|
||||||
|
void plugin_ui_get_item_internal(uint8_t *title_buffer,
|
||||||
|
size_t title_buffer_size,
|
||||||
|
uint8_t *msg_buffer,
|
||||||
|
size_t msg_buffer_size);
|
||||||
|
|
||||||
|
#endif // _PLUGIN_H_
|
||||||
Reference in New Issue
Block a user