Home page rework

Now explicitly shows if the app has been launched through a plugin or clone
thanks to the new NBGL use case
This commit is contained in:
Alexandre Paillier
2023-02-07 18:06:44 +01:00
committed by Clement Bouvet
parent e950372438
commit 462c39aa4b
10 changed files with 126 additions and 46 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ void eth_plugin_prepare_query_contract_UI(ethQueryContractUI_t *queryContractUI,
}
queryContractUI->screenIndex = screenIndex;
strlcpy(queryContractUI->network_ticker, get_network_ticker(), MAX_TICKER_LEN);
strlcpy(queryContractUI->network_ticker, get_tx_network_ticker(), MAX_TICKER_LEN);
queryContractUI->title = title;
queryContractUI->titleLength = titleLength;
queryContractUI->msg = msg;
+16 -21
View File
@@ -69,7 +69,9 @@ bolos_ux_params_t G_ux_params;
const internalStorage_t N_storage_real;
chain_config_t *chainConfig;
const char *plugin_name = NULL;
chain_config_t *chainConfig = NULL;
void reset_app_context() {
// PRINTF("!!RESET_APP_CONTEXT\n");
@@ -929,14 +931,19 @@ void init_coin_config(chain_config_t *coin_config) {
coin_config->kind = CHAIN_KIND;
}
void coin_main(chain_config_t *coin_config) {
void coin_main(libargs_t *args) {
chain_config_t config;
if (coin_config == NULL) {
if (args) {
if (args->chain_config != NULL) {
chainConfig = args->chain_config;
}
plugin_name = args->plugin_name;
}
if (chainConfig == NULL) {
init_coin_config(&config);
chainConfig = &config;
} else {
chainConfig = coin_config;
}
reset_app_context();
tmpCtx.transactionContext.currentItemIndex = 0;
@@ -977,7 +984,6 @@ void coin_main(chain_config_t *coin_config) {
USB_power(1);
ui_idle();
#ifdef HAVE_BLE
BLE_power(0, NULL);
BLE_power(1, "Nano X");
@@ -1002,18 +1008,7 @@ void coin_main(chain_config_t *coin_config) {
app_exit();
}
struct libargs_s {
unsigned int id;
unsigned int command;
chain_config_t *chain_config;
union {
check_address_parameters_t *check_address;
create_transaction_parameters_t *create_transaction;
get_printable_amount_parameters_t *get_printable_amount;
};
};
static void library_main_helper(struct libargs_s *args) {
static void library_main_helper(libargs_t *args) {
check_api_level(CX_COMPAT_APILEVEL);
PRINTF("Inside a library \n");
switch (args->command) {
@@ -1041,7 +1036,7 @@ static void library_main_helper(struct libargs_s *args) {
}
}
void library_main(struct libargs_s *args) {
void library_main(libargs_t *args) {
chain_config_t coin_config;
if (args->chain_config == NULL) {
init_coin_config(&coin_config);
@@ -1112,7 +1107,7 @@ __attribute__((section(".boot"))) int main(int arg0) {
return 0;
}
struct libargs_s *args = (struct libargs_s *) arg0;
libargs_t *args = (libargs_t *) arg0;
if (args->id != 0x100) {
app_exit();
return 0;
@@ -1120,7 +1115,7 @@ __attribute__((section(".boot"))) int main(int arg0) {
switch (args->command) {
case RUN_APPLICATION:
// called as ethereum from altcoin or plugin
coin_main(args->chain_config);
coin_main(args);
break;
default:
// called as ethereum or altcoin library
+2
View File
@@ -226,6 +226,8 @@ extern bool quantumSet;
extern uint32_t eth2WithdrawalIndex;
#endif
extern const char *plugin_name;
void reset_app_context(void);
const uint8_t *parseBip32(const uint8_t *dataBuffer, uint8_t *dataLength, bip32_path_t *bip32);
+13
View File
@@ -2,6 +2,7 @@
#define _SWAP_LIB_CALLS_H_
#include "stdbool.h"
#include "chainConfig.h"
#define RUN_APPLICATION 1
@@ -52,4 +53,16 @@ typedef struct create_transaction_parameters_s {
const char* const destination_address_extra_id;
} create_transaction_parameters_t;
typedef struct libargs_s {
unsigned int id;
unsigned int command;
chain_config_t *chain_config;
union {
check_address_parameters_t *check_address;
create_transaction_parameters_t *create_transaction;
get_printable_amount_parameters_t *get_printable_amount;
char *plugin_name;
};
} libargs_t;
#endif // _SWAP_LIB_CALLS_H_