@@ -705,14 +705,12 @@ static void offer_jade_reset(void)
705705 } else {
706706 // Erase failed ? What can we do other than alert the user ?
707707 JADE_LOGE ("Factory reset failed!" );
708- const char * message [] = { "Unable to completely" , "reset Jade." };
709- await_error_activity (message , 2 );
708+ await_error_2 ("Unable to completely" , "reset Jade." );
710709 }
711710 } else {
712711 // Incorrect - continue to boot screen
713712 JADE_LOGI ("User confirmation number incorrect, not wiping data." );
714- const char * message [] = { "Confirmation number" , "incorrect!" };
715- await_error_activity (message , 2 );
713+ await_error_2 ("Confirmation number" , "incorrect!" );
716714 }
717715}
718716
@@ -908,11 +906,9 @@ static void handle_ble_reset(void)
908906 }
909907
910908 if (ble_remove_all_devices ()) {
911- const char * message [] = { "Bluetooth pairings" , "deleted" };
912- await_message_activity (message , 2 );
909+ await_message_2 ("Bluetooth pairings" , "deleted" );
913910 } else {
914- const char * message [] = { "Failed to remove all" , "Bluetooth pairings!" };
915- await_error_activity (message , 2 );
911+ await_error_2 ("Failed to remove all" , "Bluetooth pairings!" );
916912 }
917913}
918914
@@ -967,8 +963,7 @@ static void handle_ble(void)
967963 if (keychain_get_userdata () == SOURCE_NONE ) {
968964 ble_start ();
969965 } else {
970- const char * message [] = { "Bluetooth will be" , "started on logout" , "or disconnection" };
971- await_message_activity (message , 3 );
966+ await_message_3 ("Bluetooth will be" , "started on logout" , "or disconnection" );
972967 }
973968 }
974969 ble_flags |= BLE_ENABLED ;
@@ -992,11 +987,7 @@ static void handle_ble(void)
992987 }
993988}
994989#else
995- static void handle_ble (void )
996- {
997- const char * message [] = { "BLE disabled in" , "this firmware" };
998- await_message_activity (message , 2 );
999- }
990+ static void handle_ble (void ) { await_message_2 ("BLE disabled in" , "this firmware" ); }
1000991
1001992#endif // CONFIG_BT_ENABLED
1002993
@@ -1046,13 +1037,11 @@ static bool offer_delete_registered_wallet(const char* name, const bool is_multi
10461037 const bool erased
10471038 = is_multisig ? storage_erase_multisig_registration (name ) : storage_erase_descriptor_registration (name );
10481039 if (!erased ) {
1049- const char * message [] = { "Failed to delete" , "registered wallet!" };
1050- await_error_activity (message , 2 );
1040+ await_error_2 ("Failed to delete" , "registered wallet!" );
10511041 return false;
10521042 }
10531043
1054- const char * message [] = { "Registered Wallet" , "Deleted" };
1055- await_message_activity (message , 2 );
1044+ await_message_2 ("Registered Wallet" , "Deleted" );
10561045 return true;
10571046}
10581047
@@ -1072,8 +1061,7 @@ static void handle_registered_wallets(void)
10721061
10731062 const size_t num_registered_wallets = num_multisigs + num_descriptors ;
10741063 if (!num_registered_wallets ) {
1075- const char * message [] = { "No additional wallets" , "registered" };
1076- await_message_activity (message , 2 );
1064+ await_message_2 ("No additional wallets" , "registered" );
10771065 return ;
10781066 }
10791067
@@ -1132,17 +1120,15 @@ static void handle_registered_wallets(void)
11321120 // Export as QR
11331121 if (!is_valid || num_signer_details != multisig_data .num_xpubs ) {
11341122 JADE_LOGW ("Unable to export multisig details - invalid or incomplete" );
1135- const char * message [] = { "Unable to export" , "wallet details" };
1136- await_error_activity (message , 2 );
1123+ await_error_2 ("Unable to export" , "wallet details" );
11371124 continue ;
11381125 }
11391126
11401127 // Warning for unsorted multisig, as this is not strictly handled by the origial
11411128 // common file format and may not be supported by the imprting wallet.
11421129 if (!multisig_data .sorted ) {
1143- const char * message [] = { "Exporting unsorted" , "multisig - ensure the" , "wallet app supports" ,
1144- "this configuration" };
1145- await_message_activity (message , 4 );
1130+ await_message_4 (
1131+ "Exporting unsorted" , "multisig - ensure the" , "wallet app supports" , "this configuration" );
11461132 }
11471133 display_processing_message_activity ();
11481134
@@ -1153,8 +1139,7 @@ static void handle_registered_wallets(void)
11531139 if (!multisig_create_export_file (wallet_name , & multisig_data , signer_details , num_signer_details ,
11541140 output , output_len , & written )) {
11551141 JADE_LOGE ("Failed to export multisig details" );
1156- const char * message [] = { "Unable to export" , "wallet details" };
1157- await_error_activity (message , 2 );
1142+ await_error_2 ("Unable to export" , "wallet details" );
11581143 free (output );
11591144 continue ;
11601145 }
@@ -1163,8 +1148,7 @@ static void handle_registered_wallets(void)
11631148 const char * message [] = { "Export" , "Multisig" , "wallet" };
11641149 if (!display_bcur_bytes_qr (message , 3 , (const uint8_t * )output , written , "blkstrm.com/wallets" )) {
11651150 JADE_LOGE ("Failed to create multisig export details QR code" );
1166- const char * message [] = { "Unable to export" , "wallet details" };
1167- await_error_activity (message , 2 );
1151+ await_error_2 ("Unable to export" , "wallet details" );
11681152 free (output );
11691153 continue ;
11701154 }
@@ -1214,8 +1198,7 @@ static void handle_registered_wallets(void)
12141198 if (!descriptor_get_signers (wallet_name , & descriptor , NETWORK_NONE , NULL , signer_details ,
12151199 MAX_ALLOWED_SIGNERS , & num_signer_details , & errmsg )) {
12161200 JADE_LOGE ("Failed to load signer information from descriptor data" );
1217- const char * message [] = { "Unable to load" , "signer details" };
1218- await_error_activity (message , 2 );
1201+ await_error_2 ("Unable to load" , "signer details" );
12191202 continue ;
12201203 }
12211204
@@ -1314,8 +1297,7 @@ static void handle_wallet_erase_pin(void)
13141297 JADE_LOGI ("Erasing Wallet-Erase PIN" );
13151298 storage_erase_wallet_erase_pin ();
13161299
1317- const char * message [] = { "Wallet-Erase PIN" , "deleted" };
1318- await_message_activity (message , 2 );
1300+ await_message_2 ("Wallet-Erase PIN" , "deleted" );
13191301 } else if (ev_id == BTN_WALLET_ERASE_PIN_HELP ) {
13201302 await_qr_help_activity ("blkstrm.com/duress" );
13211303 } else if (ev_id == BTN_WALLET_ERASE_PIN_EXIT ) {
@@ -1429,13 +1411,11 @@ static bool delete_otp_record(const char* otpname)
14291411 }
14301412
14311413 if (!storage_erase_otp (otpname )) {
1432- const char * message [] = { "Failed to delete" , "OTP record!" };
1433- await_error_activity (message , 2 );
1414+ await_error_2 ("Failed to delete" , "OTP record!" );
14341415 return false;
14351416 }
14361417
1437- const char * message [] = { "OTP Record Deleted" };
1438- await_message_activity (message , 1 );
1418+ await_message ("OTP Record Deleted" );
14391419 return true;
14401420}
14411421
@@ -1532,13 +1512,11 @@ static bool display_totp_screen(otpauth_ctx_t* otp_ctx, uint64_t epoch_value, ch
15321512 if (auto_update ) {
15331513 switch (otp_set_default_value (otp_ctx , & epoch_value )) {
15341514 case OTP_ERR_TOTP_TIME : {
1535- const char * msg_totp [] = { "Failed to fetch time." , "Unlock with the" , "Blockstream app." };
1536- await_error_activity (msg_totp , 3 );
1515+ await_error_3 ("Failed to fetch time." , "Unlock with the" , "Blockstream app." );
15371516 return false;
15381517 }
15391518 case OTP_ERR_HOTP_COUNTER : {
1540- const char * msg_hotp [] = { "Failed to fetch" , "counter!" };
1541- await_error_activity (msg_hotp , 2 );
1519+ await_error_2 ("Failed to fetch" , "counter!" );
15421520 return false;
15431521 }
15441522 case OTP_ERR_OK :
@@ -1551,8 +1529,7 @@ static bool display_totp_screen(otpauth_ctx_t* otp_ctx, uint64_t epoch_value, ch
15511529 if (count < last_count ) {
15521530 // Wrapped - token code should have changed
15531531 if (!otp_get_auth_code (otp_ctx , token , token_len )) {
1554- const char * message [] = { "Failed to calculate" , "OTP!" };
1555- await_error_activity (message , 2 );
1532+ await_error_2 ("Failed to calculate" , "OTP!" );
15561533 return false;
15571534 }
15581535 gui_update_text (txt_code , token );
@@ -1617,13 +1594,11 @@ static bool show_otp_code(otpauth_ctx_t* otp_ctx)
16171594 uint64_t value = 0 ;
16181595 switch (otp_set_default_value (otp_ctx , & value )) {
16191596 case OTP_ERR_TOTP_TIME : {
1620- const char * msg_totp [] = { "Failed to fetch time." , "Unlock with the" , "Blockstream app." };
1621- await_error_activity (msg_totp , 3 );
1597+ await_error_3 ("Failed to fetch time." , "Unlock with the" , "Blockstream app." );
16221598 return false;
16231599 }
16241600 case OTP_ERR_HOTP_COUNTER : {
1625- const char * msg_hotp [] = { "Failed to fetch" , "counter!" };
1626- await_error_activity (msg_hotp , 2 );
1601+ await_error_2 ("Failed to fetch" , "counter!" );
16271602 return false;
16281603 }
16291604 case OTP_ERR_OK :
@@ -1633,8 +1608,7 @@ static bool show_otp_code(otpauth_ctx_t* otp_ctx)
16331608 // Calculate token
16341609 char token [OTP_MAX_TOKEN_LEN ];
16351610 if (!otp_get_auth_code (otp_ctx , token , sizeof (token ))) {
1636- const char * message [] = { "Failed to calculate" , "OTP!" };
1637- await_error_activity (message , 2 );
1611+ await_error_2 ("Failed to calculate" , "OTP!" );
16381612 return false;
16391613 }
16401614
@@ -1654,8 +1628,7 @@ static void handle_view_otps(void)
16541628 JADE_ASSERT (done );
16551629
16561630 if (num_otp_records == 0 ) {
1657- const char * message [] = { "No OTP records" , "registered" };
1658- await_message_activity (message , 2 );
1631+ await_message_2 ("No OTP records" , "registered" );
16591632 return ;
16601633 }
16611634
@@ -1937,8 +1910,7 @@ static void handle_pinserver_scan(void)
19371910{
19381911 if (keychain_has_pin ()) {
19391912 // Not allowed if wallet initialised
1940- const char * message [] = { "Set Oracle not" , "permitted once" , "wallet initialized" };
1941- await_error_activity (message , 3 );
1913+ await_error_3 ("Set Oracle not" , "permitted once" , "wallet initialized" );
19421914 return ;
19431915 }
19441916
@@ -1953,8 +1925,7 @@ static void handle_pinserver_scan(void)
19531925 }
19541926
19551927 if (!type || strcasecmp (type , BCUR_TYPE_JADE_UPDPS ) || !data || !data_len ) {
1956- const char * message [] = { "Failed to parse Oracle data" };
1957- await_error_activity (message , 1 );
1928+ await_error ("Failed to parse Oracle data" );
19581929 goto cleanup ;
19591930 }
19601931
@@ -1963,8 +1934,7 @@ static void handle_pinserver_scan(void)
19631934 goto cleanup ;
19641935 }
19651936
1966- const char * message [] = { "Oracle details updated" };
1967- await_message_activity (message , 1 );
1937+ await_message ("Oracle details updated" );
19681938
19691939cleanup :
19701940 free (type );
@@ -1976,16 +1946,14 @@ static void handle_pinserver_reset(void)
19761946{
19771947 if (keychain_has_pin ()) {
19781948 // Not allowed if wallet initialised
1979- const char * message [] = { "Reset Oracle not" , "permitted once" , "wallet initialized" };
1980- await_error_activity (message , 3 );
1949+ await_error_3 ("Reset Oracle not" , "permitted once" , "wallet initialized" );
19811950 return ;
19821951 }
19831952
19841953 const char * question [] = { "Reset Oracle details" , "and certificate?" };
19851954 if (await_yesno_activity ("Reset Oracle" , question , 2 , false, NULL )) {
19861955 if (!reset_pinserver ()) {
1987- const char * message [] = { "Error resetting Oracle" };
1988- await_error_activity (message , 1 );
1956+ await_error ("Error resetting Oracle" );
19891957 }
19901958 }
19911959}
@@ -1995,8 +1963,7 @@ static void handle_storage(void)
19951963{
19961964 size_t entries_used , entries_free ;
19971965 if (!storage_get_stats (& entries_used , & entries_free )) {
1998- const char * message [] = { "Error accessing storage!" };
1999- await_error_activity (message , 1 );
1966+ await_error ("Error accessing storage!" );
20001967 return ;
20011968 }
20021969
@@ -2377,8 +2344,7 @@ static void handle_settings(const bool startup_menu)
23772344 tolerate_usb_disconnection = true;
23782345 done = usbstorage_firmware_ota (NULL );
23792346 } else {
2380- const char * message [] = { "Unlock with PIN before" , "initiating firmware update" };
2381- await_error_activity (message , 2 );
2347+ await_error_2 ("Unlock with PIN before" , "initiating firmware update" );
23822348 }
23832349 break ;
23842350
0 commit comments