gui: share code to wait for buttons with ci auto-click (2)
What changed, and why it matters
This commit is a code cleanup in the user-interface layer of the Blockstream Jade hardware wallet. It removes repeated 'if timeout' checks around button-waiting loops and lets the shared helper handle the timeout case instead. The commit message explicitly says there are no functional changes, and the diff shows only structural simplification—no security-sensitive logic was altered.
No security action needed; treat as normal code-quality refactor. If reviewing the related helper change, verify that gui_activity_wait_button() continues to loop on BTN_EVENT_TIMEOUT rather than returning it to callers as a terminal event.
Security signals we found
No security-relevant code paths changed
Commit message states 'no functional changes'
Diff is purely structural refactoring of UI event loops
Timeout handling moved to shared helper, not removed
Evidence from the diff
The change refactors many call sites of gui_activity_wait_button() and gui_activity_wait_event() by removing outer ‘if (ev_id != BTN_EVENT_TIMEOUT)’ guards. In most files the timeout branch was empty (fall-through to the next loop iteration), so removing it is behavior-preserving. In main/ui/dialogs.c the timeout value is now explicitly listed as a no-op switch case. The underlying wait helper is presumably updated (in a related commit) to loop on timeout itself, making the per-caller checks redundant. No cryptographic, storage, authentication, or transaction-approval logic is modified.
Changed components
main/process/dashboard.cmain/process/mnemonic.cmain/qrmode.cmain/ui/confirm_address.cmain/ui/descriptor.cmain/ui/dialogs.cmain/ui/multisig.cmain/ui/ota.cmain/ui/otpauth.cmain/ui/sign_identity.cmain/ui/sign_message.cmain/ui/sign_tx.cmain/ui/signer.cmain/ui/update_pinserver.cInspect captured patch +560 / −612
diff --git a/main/process/dashboard.c b/main/process/dashboard.c
index 10cd481..a9f7058 100644
--- a/main/process/dashboard.c
+++ b/main/process/dashboard.c
@@ -778,50 +778,48 @@ static void select_initial_connection(const bool offer_qr_temporary)
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_CONNECT_VIA_USB);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_CONNECT_VIA_USB) {
- // Set USB/SERIAL source
- initialisation_source = SOURCE_SERIAL;
- show_connect_screen = true;
- } else if (ev_id == BTN_CONNECT_VIA_BLE) {
- // Set BLE source and ensure ble enabled now and by default
- initialisation_source = SOURCE_BLE;
- show_connect_screen = true;
- if (!ble_enabled()) {
- const uint8_t ble_flags = storage_get_ble_flags() | BLE_ENABLED;
- storage_set_ble_flags(ble_flags);
- ble_start();
- }
- } else if (ev_id == BTN_CONNECT_VIA_QR) {
- // Offer pinserver via qr with urls etc
- if (act_confirm_qr_mode) {
- // Double check re: temporary-restore/'QR Mode'
- act = act_confirm_qr_mode;
- } else if (auth_qr_mode()) {
- JADE_ASSERT(initialisation_source == SOURCE_INTERNAL);
- JADE_ASSERT(show_connect_screen == !keychain_has_temporary());
- }
- } else if (ev_id == BTN_CONNECT_QR_PIN) {
- // Offer pinserver via qr with urls etc
+ if (ev_id == BTN_CONNECT_VIA_USB) {
+ // Set USB/SERIAL source
+ initialisation_source = SOURCE_SERIAL;
+ show_connect_screen = true;
+ } else if (ev_id == BTN_CONNECT_VIA_BLE) {
+ // Set BLE source and ensure ble enabled now and by default
+ initialisation_source = SOURCE_BLE;
+ show_connect_screen = true;
+ if (!ble_enabled()) {
+ const uint8_t ble_flags = storage_get_ble_flags() | BLE_ENABLED;
+ storage_set_ble_flags(ble_flags);
+ ble_start();
+ }
+ } else if (ev_id == BTN_CONNECT_VIA_QR) {
+ // Offer pinserver via qr with urls etc
+ if (act_confirm_qr_mode) {
+ // Double check re: temporary-restore/'QR Mode'
+ act = act_confirm_qr_mode;
+ } else if (auth_qr_mode()) {
+ JADE_ASSERT(initialisation_source == SOURCE_INTERNAL);
+ JADE_ASSERT(show_connect_screen == !keychain_has_temporary());
+ }
+ } else if (ev_id == BTN_CONNECT_QR_PIN) {
+ // Offer pinserver via qr with urls etc
+ if (auth_qr_mode()) {
+ JADE_ASSERT(initialisation_source == SOURCE_INTERNAL);
+ JADE_ASSERT(show_connect_screen == !keychain_has_temporary());
+ }
+ } else if (ev_id == BTN_CONNECT_QR_SCAN) {
+ const char* message[] = { "This wallet will be", "temporary and", "forgotten on reboot" };
+ if (await_continueback_activity(NULL, message, 3, true, "blkstrm.com/qrmode")) {
+ // 'QR-Mode' temporary login only
+ keychain_set_temporary();
if (auth_qr_mode()) {
JADE_ASSERT(initialisation_source == SOURCE_INTERNAL);
JADE_ASSERT(show_connect_screen == !keychain_has_temporary());
}
- } else if (ev_id == BTN_CONNECT_QR_SCAN) {
- const char* message[] = { "This wallet will be", "temporary and", "forgotten on reboot" };
- if (await_continueback_activity(NULL, message, 3, true, "blkstrm.com/qrmode")) {
- // 'QR-Mode' temporary login only
- keychain_set_temporary();
- if (auth_qr_mode()) {
- JADE_ASSERT(initialisation_source == SOURCE_INTERNAL);
- JADE_ASSERT(show_connect_screen == !keychain_has_temporary());
- }
- }
- } else if (ev_id == BTN_CONNECT_QR_BACK) {
- act = act_select;
- } else if (ev_id == BTN_CONNECT_QR_HELP) {
- await_qr_help_activity("blkstrm.com/qrmode");
}
+ } else if (ev_id == BTN_CONNECT_QR_BACK) {
+ act = act_select;
+ } else if (ev_id == BTN_CONNECT_QR_HELP) {
+ await_qr_help_activity("blkstrm.com/qrmode");
}
}
}
@@ -943,50 +941,48 @@ static void handle_ble(void)
gui_set_current_activity(act);
int32_t ev_id = gui_activity_wait_button(act, BTN_BLE_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_BLE_STATUS) {
- gui_set_current_activity(act_status);
- while (true) {
- update_ble_carousel_label(status_textbox, enabled);
- if (gui_activity_wait_event(act_status, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT || ev_id == GUI_WHEEL_RIGHT_EVENT) {
- enabled = !enabled; // Just toggle label at this point
- } else if (ev_id == gui_get_click_event()) {
- // Done - apply ble change
- break;
- }
+ if (ev_id == BTN_BLE_STATUS) {
+ gui_set_current_activity(act_status);
+ while (true) {
+ update_ble_carousel_label(status_textbox, enabled);
+ if (gui_activity_wait_event(act_status, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT || ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ enabled = !enabled; // Just toggle label at this point
+ } else if (ev_id == gui_get_click_event()) {
+ // Done - apply ble change
+ break;
}
}
+ }
- // Start/stop BLE and persist pref/flags
- if (enabled) {
- if (!ble_enabled()) {
- // Only start BLE immediately if not using some other interface
- if (keychain_get_userdata() == SOURCE_NONE) {
- ble_start();
- } else {
- const char* message[] = { "Bluetooth will be", "started on logout", "or disconnection" };
- await_message_activity(message, 3);
- }
- }
- ble_flags |= BLE_ENABLED;
- storage_set_ble_flags(ble_flags);
- } else {
- if (ble_enabled()) {
- ble_stop();
+ // Start/stop BLE and persist pref/flags
+ if (enabled) {
+ if (!ble_enabled()) {
+ // Only start BLE immediately if not using some other interface
+ if (keychain_get_userdata() == SOURCE_NONE) {
+ ble_start();
+ } else {
+ const char* message[] = { "Bluetooth will be", "started on logout", "or disconnection" };
+ await_message_activity(message, 3);
}
- ble_flags &= ~BLE_ENABLED;
- storage_set_ble_flags(ble_flags);
}
- update_ble_status_item(ble_status_item, enabled);
- } else if (ev_id == BTN_BLE_RESET_PAIRING) {
- handle_ble_reset();
- } else if (ev_id == BTN_BLE_HELP) {
- await_qr_help_activity("blkstrm.com/bluetooth");
- } else if (ev_id == BTN_BLE_EXIT) {
- // Done
- break;
+ ble_flags |= BLE_ENABLED;
+ storage_set_ble_flags(ble_flags);
+ } else {
+ if (ble_enabled()) {
+ ble_stop();
+ }
+ ble_flags &= ~BLE_ENABLED;
+ storage_set_ble_flags(ble_flags);
}
+ update_ble_status_item(ble_status_item, enabled);
+ } else if (ev_id == BTN_BLE_RESET_PAIRING) {
+ handle_ble_reset();
+ } else if (ev_id == BTN_BLE_HELP) {
+ await_qr_help_activity("blkstrm.com/bluetooth");
+ } else if (ev_id == BTN_BLE_EXIT) {
+ // Done
+ break;
}
}
}
@@ -1364,50 +1360,47 @@ static void handle_passphrase_prefs()
gui_set_current_activity(act);
int32_t ev_id = gui_activity_wait_button(act, BTN_PASSPHRASE_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_PASSPHRASE_FREQUENCY) {
- // Never -> Once -> Always -> Once ...
- gui_set_current_activity(act_freq);
- while (true) {
- gui_update_text(
- frequency_textbox, passphrase_frequency_desc_from_flags(freq, carousel_freq_shortname));
- if (gui_activity_wait_event(act_freq, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT) {
- freq = (freq == PASSPHRASE_NEVER ? PASSPHRASE_ALWAYS
- : freq == PASSPHRASE_ONCE ? PASSPHRASE_NEVER
- : PASSPHRASE_ONCE);
- } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
- freq = (freq == PASSPHRASE_NEVER ? PASSPHRASE_ONCE
- : freq == PASSPHRASE_ONCE ? PASSPHRASE_ALWAYS
- : PASSPHRASE_NEVER);
- } else if (ev_id == gui_get_click_event()) {
- // Done
- break;
- }
+ if (ev_id == BTN_PASSPHRASE_FREQUENCY) {
+ // Never -> Once -> Always -> Once ...
+ gui_set_current_activity(act_freq);
+ while (true) {
+ gui_update_text(frequency_textbox, passphrase_frequency_desc_from_flags(freq, carousel_freq_shortname));
+ if (gui_activity_wait_event(act_freq, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT) {
+ freq = (freq == PASSPHRASE_NEVER ? PASSPHRASE_ALWAYS
+ : freq == PASSPHRASE_ONCE ? PASSPHRASE_NEVER
+ : PASSPHRASE_ONCE);
+ } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ freq = (freq == PASSPHRASE_NEVER ? PASSPHRASE_ONCE
+ : freq == PASSPHRASE_ONCE ? PASSPHRASE_ALWAYS
+ : PASSPHRASE_NEVER);
+ } else if (ev_id == gui_get_click_event()) {
+ // Done
+ break;
}
}
- update_menu_item(
- frequency_item, "Frequency", passphrase_frequency_desc_from_flags(freq, menu_freq_shortname));
- } else if (ev_id == BTN_PASSPHRASE_METHOD) {
- gui_set_current_activity(act_method);
- while (true) {
- gui_update_text(method_textbox, passphrase_method_desc_from_flags(type));
- if (gui_activity_wait_event(act_method, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT || ev_id == GUI_WHEEL_RIGHT_EVENT) {
- type = (type == PASSPHRASE_FREETEXT ? PASSPHRASE_WORDLIST : PASSPHRASE_FREETEXT);
- } else if (ev_id == gui_get_click_event()) {
- // Done
- break;
- }
+ }
+ update_menu_item(
+ frequency_item, "Frequency", passphrase_frequency_desc_from_flags(freq, menu_freq_shortname));
+ } else if (ev_id == BTN_PASSPHRASE_METHOD) {
+ gui_set_current_activity(act_method);
+ while (true) {
+ gui_update_text(method_textbox, passphrase_method_desc_from_flags(type));
+ if (gui_activity_wait_event(act_method, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT || ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ type = (type == PASSPHRASE_FREETEXT ? PASSPHRASE_WORDLIST : PASSPHRASE_FREETEXT);
+ } else if (ev_id == gui_get_click_event()) {
+ // Done
+ break;
}
}
- update_menu_item(method_item, "Method", passphrase_method_desc_from_flags(type));
- } else if (ev_id == BTN_PASSPHRASE_HELP) {
- await_qr_help_activity("blkstrm.com/passphrase");
- } else if (ev_id == BTN_PASSPHRASE_EXIT) {
- // Done
- break;
}
+ update_menu_item(method_item, "Method", passphrase_method_desc_from_flags(type));
+ } else if (ev_id == BTN_PASSPHRASE_HELP) {
+ await_qr_help_activity("blkstrm.com/passphrase");
+ } else if (ev_id == BTN_PASSPHRASE_EXIT) {
+ // Done
+ break;
}
}
@@ -1451,19 +1444,17 @@ static bool display_hotp_screen(const otpauth_ctx_t* otp_ctx, const char* token,
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_OTP_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_OTP_DETAILS) {
- const bool is_valid = true; // asserted above
- const bool initial_confirmation = false;
- const bool show_delete_btn = false;
- const bool retain = show_otp_details_activity(otp_ctx, initial_confirmation, is_valid, show_delete_btn);
- JADE_ASSERT(retain); // should be no 'discard' option
- } else if (ev_id == BTN_OTP_DISCARD_DELETE) {
- if (confirm_only || delete_otp_record(otp_ctx->name))
- return false;
- } else if (ev_id == BTN_OTP_RETAIN_CONFIRM) {
- return true;
- }
+ if (ev_id == BTN_OTP_DETAILS) {
+ const bool is_valid = true; // asserted above
+ const bool initial_confirmation = false;
+ const bool show_delete_btn = false;
+ const bool retain = show_otp_details_activity(otp_ctx, initial_confirmation, is_valid, show_delete_btn);
+ JADE_ASSERT(retain); // should be no 'discard' option
+ } else if (ev_id == BTN_OTP_DISCARD_DELETE) {
+ if (confirm_only || delete_otp_record(otp_ctx->name))
+ return false;
+ } else if (ev_id == BTN_OTP_RETAIN_CONFIRM) {
+ return true;
}
}
}
diff --git a/main/process/mnemonic.c b/main/process/mnemonic.c
index 63964e5..6664546 100644
--- a/main/process/mnemonic.c
+++ b/main/process/mnemonic.c
@@ -1511,17 +1511,15 @@ void handle_bip85_mnemonic()
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_BIP85_12_WORDS);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_BIP85_12_WORDS) {
- nwords = 12;
- break;
- } else if (ev_id == BTN_BIP85_24_WORDS) {
- nwords = 24;
- break;
- } else if (ev_id == BTN_BIP85_EXIT) {
- // User declined
- return;
- }
+ if (ev_id == BTN_BIP85_12_WORDS) {
+ nwords = 12;
+ break;
+ } else if (ev_id == BTN_BIP85_24_WORDS) {
+ nwords = 24;
+ break;
+ } else if (ev_id == BTN_BIP85_EXIT) {
+ // User declined
+ return;
}
}
JADE_ASSERT(nwords == 12 || nwords == 24);
diff --git a/main/qrmode.c b/main/qrmode.c
index 27c33f9..2111818 100644
--- a/main/qrmode.c
+++ b/main/qrmode.c
@@ -293,71 +293,69 @@ static bool handle_xpub_options(uint32_t* qr_flags)
gui_set_current_activity(act);
int32_t ev_id = gui_activity_wait_button(act, BTN_XPUB_OPTIONS_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_XPUB_OPTIONS_SCRIPTTYPE) {
- gui_set_current_activity(act_scripttype);
- while (true) {
- gui_update_text(script_textbox, xpub_scripttype_desc_from_flags(*qr_flags));
- if (gui_activity_wait_event(act_scripttype, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT) {
- rotate_scripttypes(qr_flags, true);
- } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
- rotate_scripttypes(qr_flags, false);
- } else if (ev_id == gui_get_click_event()) {
- // Done
- break;
- }
- }
- }
- update_menu_item(script_item, "Script", xpub_scripttype_desc_from_flags(*qr_flags));
- } else if (ev_id == BTN_XPUB_OPTIONS_WALLETTYPE) {
- gui_set_current_activity(act_wallettype);
- while (true) {
- gui_update_text(wallet_textbox, xpub_wallettype_desc_from_flags(*qr_flags));
- if (gui_activity_wait_event(act_wallettype, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT || ev_id == GUI_WHEEL_RIGHT_EVENT) {
- *qr_flags ^= QR_XPUB_MULTISIG; // toggle
- } else if (ev_id == gui_get_click_event()) {
- // Done
- break;
- }
+ if (ev_id == BTN_XPUB_OPTIONS_SCRIPTTYPE) {
+ gui_set_current_activity(act_scripttype);
+ while (true) {
+ gui_update_text(script_textbox, xpub_scripttype_desc_from_flags(*qr_flags));
+ if (gui_activity_wait_event(act_scripttype, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT) {
+ rotate_scripttypes(qr_flags, true);
+ } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ rotate_scripttypes(qr_flags, false);
+ } else if (ev_id == gui_get_click_event()) {
+ // Done
+ break;
}
}
- update_menu_item(wallet_item, "Wallet", xpub_wallettype_desc_from_flags(*qr_flags));
- } else if (ev_id == BTN_XPUB_OPTIONS_ACCOUNT) {
-
- while (true) {
- reset_pin(&pin_insert, NULL);
- gui_set_current_activity(pin_insert.activity);
- if (!run_pin_entry_loop(&pin_insert)) {
- // User abandoned index entry
+ }
+ update_menu_item(script_item, "Script", xpub_scripttype_desc_from_flags(*qr_flags));
+ } else if (ev_id == BTN_XPUB_OPTIONS_WALLETTYPE) {
+ gui_set_current_activity(act_wallettype);
+ while (true) {
+ gui_update_text(wallet_textbox, xpub_wallettype_desc_from_flags(*qr_flags));
+ if (gui_activity_wait_event(act_wallettype, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT || ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ *qr_flags ^= QR_XPUB_MULTISIG; // toggle
+ } else if (ev_id == gui_get_click_event()) {
+ // Done
break;
}
+ }
+ }
+ update_menu_item(wallet_item, "Wallet", xpub_wallettype_desc_from_flags(*qr_flags));
+ } else if (ev_id == BTN_XPUB_OPTIONS_ACCOUNT) {
+
+ while (true) {
+ reset_pin(&pin_insert, NULL);
+ gui_set_current_activity(pin_insert.activity);
+ if (!run_pin_entry_loop(&pin_insert)) {
+ // User abandoned index entry
+ break;
+ }
- // Get entered digits as single numeric value
- const uint32_t new_account_index = get_pin_as_number(&pin_insert);
- if (new_account_index < ACCOUNT_INDEX_MAX) {
- account_index = new_account_index;
+ // Get entered digits as single numeric value
+ const uint32_t new_account_index = get_pin_as_number(&pin_insert);
+ if (new_account_index < ACCOUNT_INDEX_MAX) {
+ account_index = new_account_index;
- // Update the display
- const int ret = snprintf(buf, sizeof(buf), "%u", account_index);
- JADE_ASSERT(ret > 0 && ret < sizeof(buf));
- update_menu_item(account_item, "Account Index", buf);
- break;
- } else {
- // Show message and retry
- const int ret = snprintf(buf, sizeof(buf), "%u", ACCOUNT_INDEX_MAX);
- JADE_ASSERT(ret > 0 && ret < sizeof(buf));
- const char* message[] = { "Account index must", "be less than", buf };
- await_error_activity(message, 3);
- }
+ // Update the display
+ const int ret = snprintf(buf, sizeof(buf), "%u", account_index);
+ JADE_ASSERT(ret > 0 && ret < sizeof(buf));
+ update_menu_item(account_item, "Account Index", buf);
+ break;
+ } else {
+ // Show message and retry
+ const int ret = snprintf(buf, sizeof(buf), "%u", ACCOUNT_INDEX_MAX);
+ JADE_ASSERT(ret > 0 && ret < sizeof(buf));
+ const char* message[] = { "Account index must", "be less than", buf };
+ await_error_activity(message, 3);
}
- } else if (ev_id == BTN_XPUB_OPTIONS_HELP) {
- await_qr_help_activity("blkstrm.com/xpub");
- } else if (ev_id == BTN_XPUB_OPTIONS_EXIT) {
- // Done
- break;
}
+ } else if (ev_id == BTN_XPUB_OPTIONS_HELP) {
+ await_qr_help_activity("blkstrm.com/xpub");
+ } else if (ev_id == BTN_XPUB_OPTIONS_EXIT) {
+ // Done
+ break;
}
}
@@ -386,19 +384,17 @@ void display_xpub_qr(void)
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_XPUB_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_XPUB_OPTIONS) {
- if (handle_xpub_options(&qr_flags)) {
- // Options were updated - re-create xpub screen
- act = create_display_xpub_qr_activity(qr_flags);
- }
- } else if (ev_id == BTN_QR_BRIGHTNESS) {
- gui_next_qrcode_color();
- gui_repaint(act->root_node);
- } else if (ev_id == BTN_XPUB_EXIT) {
- // Done
- break;
+ if (ev_id == BTN_XPUB_OPTIONS) {
+ if (handle_xpub_options(&qr_flags)) {
+ // Options were updated - re-create xpub screen
+ act = create_display_xpub_qr_activity(qr_flags);
}
+ } else if (ev_id == BTN_QR_BRIGHTNESS) {
+ gui_next_qrcode_color();
+ gui_repaint(act->root_node);
+ } else if (ev_id == BTN_XPUB_EXIT) {
+ // Done
+ break;
}
}
}
@@ -854,48 +850,46 @@ static bool handle_qr_options(uint32_t* qr_flags)
gui_set_current_activity(act);
int32_t ev_id = gui_activity_wait_button(act, BTN_QR_OPTIONS_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- // NOTE: For Density and Speed :- HIGH|LOW > HIGH > LOW
- // Rotate through: LOW -> HIGH -> HIGH|LOW -> LOW -> ...
- // unset/default is treated as HIGH ie. the middle value
- if (ev_id == BTN_QR_OPTIONS_DENSITY) {
- gui_set_current_activity(act_density);
- while (true) {
- gui_update_text(density_textbox, qr_density_desc_from_flags(*qr_flags));
- if (gui_activity_wait_event(act_density, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT) {
- rotate_flags(qr_flags, QR_DENSITY_LOW, QR_DENSITY_HIGH); // reverse
- } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
- rotate_flags(qr_flags, QR_DENSITY_HIGH, QR_DENSITY_LOW);
- } else if (ev_id == gui_get_click_event()) {
- // Done
- break;
- }
+ // NOTE: For Density and Speed :- HIGH|LOW > HIGH > LOW
+ // Rotate through: LOW -> HIGH -> HIGH|LOW -> LOW -> ...
+ // unset/default is treated as HIGH ie. the middle value
+ if (ev_id == BTN_QR_OPTIONS_DENSITY) {
+ gui_set_current_activity(act_density);
+ while (true) {
+ gui_update_text(density_textbox, qr_density_desc_from_flags(*qr_flags));
+ if (gui_activity_wait_event(act_density, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT) {
+ rotate_flags(qr_flags, QR_DENSITY_LOW, QR_DENSITY_HIGH); // reverse
+ } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ rotate_flags(qr_flags, QR_DENSITY_HIGH, QR_DENSITY_LOW);
+ } else if (ev_id == gui_get_click_event()) {
+ // Done
+ break;
}
}
- update_menu_item(density_item, "QR Density", qr_density_desc_from_flags(*qr_flags));
- } else if (ev_id == BTN_QR_OPTIONS_FRAMERATE) {
- gui_set_current_activity(act_framerate);
- while (true) {
- gui_update_text(framerate_textbox, qr_framerate_desc_from_flags(*qr_flags));
- if (gui_activity_wait_event(act_framerate, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
- if (ev_id == GUI_WHEEL_LEFT_EVENT) {
- rotate_flags(qr_flags, QR_SPEED_LOW, QR_SPEED_HIGH); // reverse
- } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
- rotate_flags(qr_flags, QR_SPEED_HIGH, QR_SPEED_LOW);
- } else if (ev_id == gui_get_click_event()) {
- // Done
- break;
- }
+ }
+ update_menu_item(density_item, "QR Density", qr_density_desc_from_flags(*qr_flags));
+ } else if (ev_id == BTN_QR_OPTIONS_FRAMERATE) {
+ gui_set_current_activity(act_framerate);
+ while (true) {
+ gui_update_text(framerate_textbox, qr_framerate_desc_from_flags(*qr_flags));
+ if (gui_activity_wait_event(act_framerate, GUI_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ if (ev_id == GUI_WHEEL_LEFT_EVENT) {
+ rotate_flags(qr_flags, QR_SPEED_LOW, QR_SPEED_HIGH); // reverse
+ } else if (ev_id == GUI_WHEEL_RIGHT_EVENT) {
+ rotate_flags(qr_flags, QR_SPEED_HIGH, QR_SPEED_LOW);
+ } else if (ev_id == gui_get_click_event()) {
+ // Done
+ break;
}
}
- update_menu_item(framerate_item, "Frame Rate", qr_framerate_desc_from_flags(*qr_flags));
- } else if (ev_id == BTN_QR_OPTIONS_HELP) {
- await_qr_help_activity("blkstrm.com/scanjade");
- } else if (ev_id == BTN_QR_OPTIONS_EXIT) {
- // Done
- break;
}
+ update_menu_item(framerate_item, "Frame Rate", qr_framerate_desc_from_flags(*qr_flags));
+ } else if (ev_id == BTN_QR_OPTIONS_HELP) {
+ await_qr_help_activity("blkstrm.com/scanjade");
+ } else if (ev_id == BTN_QR_OPTIONS_EXIT) {
+ // Done
+ break;
}
}
@@ -958,20 +952,18 @@ static void display_bcur_qr(const char* message[], const size_t message_size, co
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_QR_DISPLAY_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_QR_OPTIONS) {
- if (handle_qr_options(&qr_flags)) {
- // Options were updated - re-create psbt qr screen
- display_processing_message_activity();
- act = create_display_bcur_qr_activity(
- message, message_size, bcur_type, cbor, cbor_len, qr_flags, help_url);
- }
- } else if (ev_id == BTN_QR_DISPLAY_HELP) {
- await_qr_help_activity(help_url);
- } else if (ev_id == BTN_QR_DISPLAY_EXIT) {
- // Done
- break;
+ if (ev_id == BTN_QR_OPTIONS) {
+ if (handle_qr_options(&qr_flags)) {
+ // Options were updated - re-create psbt qr screen
+ display_processing_message_activity();
+ act = create_display_bcur_qr_activity(
+ message, message_size, bcur_type, cbor, cbor_len, qr_flags, help_url);
}
+ } else if (ev_id == BTN_QR_DISPLAY_HELP) {
+ await_qr_help_activity(help_url);
+ } else if (ev_id == BTN_QR_DISPLAY_EXIT) {
+ // Done
+ break;
}
}
@@ -1410,13 +1402,11 @@ void await_single_qr_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_QR_DISPLAY_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_QR_DISPLAY_EXIT) {
- // Done
- break;
- } else if (ev_id == BTN_QR_DISPLAY_HELP) {
- await_qr_help_activity(help_url);
- }
+ if (ev_id == BTN_QR_DISPLAY_EXIT) {
+ // Done
+ break;
+ } else if (ev_id == BTN_QR_DISPLAY_HELP) {
+ await_qr_help_activity(help_url);
}
}
}
@@ -1474,14 +1464,12 @@ void await_qr_help_activity(const char* url)
// Show, and await button click
while (true) {
const int32_t ev_id = gui_activity_wait_button(act, BTN_QR_HELP_EXIT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_QR_BRIGHTNESS) {
- gui_next_qrcode_color();
- gui_repaint(act->root_node);
- } else if (ev_id == BTN_QR_HELP_EXIT) {
- // Done
- break;
- }
+ if (ev_id == BTN_QR_BRIGHTNESS) {
+ gui_next_qrcode_color();
+ gui_repaint(act->root_node);
+ } else if (ev_id == BTN_QR_HELP_EXIT) {
+ // Done
+ break;
}
}
}
@@ -1507,14 +1495,12 @@ bool await_qr_back_continue_activity(
// Show, and await button click
while (true) {
const int32_t ev_id = gui_activity_wait_button(act, BTN_YES);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- if (ev_id == BTN_QR_BRIGHTNESS) {
- gui_next_qrcode_color();
- gui_repaint(act->root_node);
- } else if (ev_id == BTN_YES || ev_id == BTN_NO) {
- // Done: return whether 'Continue' was cicked
- return ev_id == BTN_YES;
- }
+ if (ev_id == BTN_QR_BRIGHTNESS) {
+ gui_next_qrcode_color();
+ gui_repaint(act->root_node);
+ } else if (ev_id == BTN_YES || ev_id == BTN_NO) {
+ // Done: return whether 'Continue' was cicked
+ return ev_id == BTN_YES;
}
}
}
diff --git a/main/ui/confirm_address.c b/main/ui/confirm_address.c
index 2831009..b2d3b69 100644
--- a/main/ui/confirm_address.c
+++ b/main/ui/confirm_address.c
@@ -173,22 +173,20 @@ bool show_confirm_address_activity(const char* address, const bool default_selec
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_ADDRESS_ACCEPT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_addr1;
- break;
-
- case BTN_ADDRESS_NEXT:
- act = act_addr2;
- break;
-
- case BTN_ADDRESS_REJECT:
- return false;
-
- case BTN_ADDRESS_ACCEPT:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_addr1;
+ break;
+
+ case BTN_ADDRESS_NEXT:
+ act = act_addr2;
+ break;
+
+ case BTN_ADDRESS_REJECT:
+ return false;
+
+ case BTN_ADDRESS_ACCEPT:
+ return true;
}
}
}
diff --git a/main/ui/descriptor.c b/main/ui/descriptor.c
index 64db924..eb223df 100644
--- a/main/ui/descriptor.c
+++ b/main/ui/descriptor.c
@@ -171,35 +171,33 @@ bool show_view_descriptor_activity(const char* descriptor_name, const descriptor
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_DESCRIPTOR_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- JADE_ASSERT(script_screen_index < num_script_screens);
- JADE_ASSERT(act == act_name || act == act_scripts[script_screen_index]);
- act = script_screen_index == 0 ? act_summary : act_scripts[--script_screen_index];
- break;
-
- case BTN_DESCRIPTOR_NAME:
- act = act_name;
- break;
-
- case BTN_DESCRIPTOR_SCRIPT:
- script_screen_index = 0;
- act = act_scripts[script_screen_index];
- break;
-
- case BTN_DESCRIPTOR_SCRIPT_NEXT:
- JADE_ASSERT(script_screen_index < num_script_screens);
- JADE_ASSERT(act == act_scripts[script_screen_index]);
- act = script_screen_index == num_script_screens - 1 ? act_summary : act_scripts[++script_screen_index];
- break;
-
- case BTN_DESCRIPTOR_DISCARD_DELETE:
- return false;
-
- case BTN_DESCRIPTOR_RETAIN_CONFIRM:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ JADE_ASSERT(script_screen_index < num_script_screens);
+ JADE_ASSERT(act == act_name || act == act_scripts[script_screen_index]);
+ act = script_screen_index == 0 ? act_summary : act_scripts[--script_screen_index];
+ break;
+
+ case BTN_DESCRIPTOR_NAME:
+ act = act_name;
+ break;
+
+ case BTN_DESCRIPTOR_SCRIPT:
+ script_screen_index = 0;
+ act = act_scripts[script_screen_index];
+ break;
+
+ case BTN_DESCRIPTOR_SCRIPT_NEXT:
+ JADE_ASSERT(script_screen_index < num_script_screens);
+ JADE_ASSERT(act == act_scripts[script_screen_index]);
+ act = script_screen_index == num_script_screens - 1 ? act_summary : act_scripts[++script_screen_index];
+ break;
+
+ case BTN_DESCRIPTOR_DISCARD_DELETE:
+ return false;
+
+ case BTN_DESCRIPTOR_RETAIN_CONFIRM:
+ return true;
}
}
}
@@ -268,22 +266,20 @@ static bool show_final_descriptor_summary_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_DESCRIPTOR_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
- case BTN_DESCRIPTOR_NAME:
- act = act_name;
- break;
+ case BTN_DESCRIPTOR_NAME:
+ act = act_name;
+ break;
- case BTN_DESCRIPTOR_DISCARD_DELETE:
- return false;
+ case BTN_DESCRIPTOR_DISCARD_DELETE:
+ return false;
- case BTN_DESCRIPTOR_RETAIN_CONFIRM:
- return true;
- }
+ case BTN_DESCRIPTOR_RETAIN_CONFIRM:
+ return true;
}
}
}
diff --git a/main/ui/dialogs.c b/main/ui/dialogs.c
index 756869e..8911eed 100644
--- a/main/ui/dialogs.c
+++ b/main/ui/dialogs.c
@@ -445,23 +445,24 @@ static bool await_yesno_activity_loop(gui_activity_t* const act, const char* hel
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_YES);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- // Return true if 'Yes' was pressed, false if 'No'
- switch (ev_id) {
- case BTN_YES:
- return true;
-
- case BTN_NO:
- return false;
-
- case BTN_HELP:
- await_qr_help_activity(help_url);
- break;
-
- default:
- JADE_LOGW("Unexpected button event: %ld", ev_id);
- break;
- }
+ // Return true if 'Yes' was pressed, false if 'No'
+ switch (ev_id) {
+ case BTN_YES:
+ return true;
+
+ case BTN_NO:
+ return false;
+
+ case BTN_HELP:
+ await_qr_help_activity(help_url);
+ break;
+
+ case BTN_EVENT_TIMEOUT:
+ break;
+
+ default:
+ JADE_LOGW("Unexpected button event: %ld", ev_id);
+ break;
}
}
}
diff --git a/main/ui/multisig.c b/main/ui/multisig.c
index 9492745..401dbe1 100644
--- a/main/ui/multisig.c
+++ b/main/ui/multisig.c
@@ -166,34 +166,32 @@ static bool show_view_multisig_activity(const char* multisig_name, const bool in
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_MULTISIG_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
- case BTN_MULTISIG_NAME:
- act = act_name;
- break;
+ case BTN_MULTISIG_NAME:
+ act = act_name;
+ break;
- case BTN_MULTISIG_TYPE:
- act = act_type;
- break;
+ case BTN_MULTISIG_TYPE:
+ act = act_type;
+ break;
- case BTN_MULTISIG_SORTED:
- act = act_sorted;
- break;
+ case BTN_MULTISIG_SORTED:
+ act = act_sorted;
+ break;
- case BTN_MULTISIG_BLINDINGKEY:
- act = act_blindingkey;
- break;
+ case BTN_MULTISIG_BLINDINGKEY:
+ act = act_blindingkey;
+ break;
- case BTN_MULTISIG_DISCARD_DELETE:
- return false;
+ case BTN_MULTISIG_DISCARD_DELETE:
+ return false;
- case BTN_MULTISIG_RETAIN_CONFIRM:
- return true;
- }
+ case BTN_MULTISIG_RETAIN_CONFIRM:
+ return true;
}
}
}
@@ -300,26 +298,24 @@ static bool show_final_multisig_summary_activity(const char* multisig_name, cons
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_MULTISIG_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
- case BTN_MULTISIG_NAME:
- act = act_name;
- break;
+ case BTN_MULTISIG_NAME:
+ act = act_name;
+ break;
- case BTN_MULTISIG_TYPE:
- act = act_type;
- break;
+ case BTN_MULTISIG_TYPE:
+ act = act_type;
+ break;
- case BTN_MULTISIG_DISCARD_DELETE:
- return false;
+ case BTN_MULTISIG_DISCARD_DELETE:
+ return false;
- case BTN_MULTISIG_RETAIN_CONFIRM:
- return true;
- }
+ case BTN_MULTISIG_RETAIN_CONFIRM:
+ return true;
}
}
}
diff --git a/main/ui/ota.c b/main/ui/ota.c
index ea7cb7d..1297b43 100644
--- a/main/ui/ota.c
+++ b/main/ui/ota.c
@@ -111,34 +111,32 @@ bool show_ota_versions_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_OTA_ACCEPT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
-
- case BTN_OTA_VIEW_CURRENT_VERSION:
- act = act_currentver;
- break;
-
- case BTN_OTA_VIEW_NEW_VERSION:
- act = act_newver;
- break;
-
- case BTN_OTA_VIEW_FW_HASH:
- act = act_hash;
- break;
-
- case BTN_HELP:
- await_qr_help_activity("blkstrm.com/fwupgrade");
- break;
-
- case BTN_OTA_REJECT:
- return false;
-
- case BTN_OTA_ACCEPT:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
+
+ case BTN_OTA_VIEW_CURRENT_VERSION:
+ act = act_currentver;
+ break;
+
+ case BTN_OTA_VIEW_NEW_VERSION:
+ act = act_newver;
+ break;
+
+ case BTN_OTA_VIEW_FW_HASH:
+ act = act_hash;
+ break;
+
+ case BTN_HELP:
+ await_qr_help_activity("blkstrm.com/fwupgrade");
+ break;
+
+ case BTN_OTA_REJECT:
+ return false;
+
+ case BTN_OTA_ACCEPT:
+ return true;
}
}
}
diff --git a/main/ui/otpauth.c b/main/ui/otpauth.c
index 5190f80..8cb6730 100644
--- a/main/ui/otpauth.c
+++ b/main/ui/otpauth.c
@@ -184,38 +184,36 @@ bool show_otp_details_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_OTP_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
-
- case BTN_OTP_NAME:
- act = act_name;
- break;
-
- case BTN_OTP_LABEL:
- act = act_label;
- break;
-
- case BTN_OTP_ISSUER:
- act = act_issuer;
- break;
-
- case BTN_OTP_TYPE:
- act = act_type;
- break;
-
- case BTN_SETTINGS_OTP_HELP:
- await_qr_help_activity("blkstrm.com/otp");
- break;
-
- case BTN_OTP_DISCARD_DELETE:
- return false;
-
- case BTN_OTP_RETAIN_CONFIRM:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
+
+ case BTN_OTP_NAME:
+ act = act_name;
+ break;
+
+ case BTN_OTP_LABEL:
+ act = act_label;
+ break;
+
+ case BTN_OTP_ISSUER:
+ act = act_issuer;
+ break;
+
+ case BTN_OTP_TYPE:
+ act = act_type;
+ break;
+
+ case BTN_SETTINGS_OTP_HELP:
+ await_qr_help_activity("blkstrm.com/otp");
+ break;
+
+ case BTN_OTP_DISCARD_DELETE:
+ return false;
+
+ case BTN_OTP_RETAIN_CONFIRM:
+ return true;
}
}
}
diff --git a/main/ui/sign_identity.c b/main/ui/sign_identity.c
index d8bcb4c..76d027c 100644
--- a/main/ui/sign_identity.c
+++ b/main/ui/sign_identity.c
@@ -37,14 +37,12 @@ bool show_sign_identity_activity(const char* identity, const size_t identity_len
while (true) {
const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNIDENTITY_ACCEPT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_SIGNIDENTITY_REJECT:
- return false;
-
- case BTN_SIGNIDENTITY_ACCEPT:
- return true;
- }
+ switch (ev_id) {
+ case BTN_SIGNIDENTITY_REJECT:
+ return false;
+
+ case BTN_SIGNIDENTITY_ACCEPT:
+ return true;
}
}
}
diff --git a/main/ui/sign_message.c b/main/ui/sign_message.c
index c064b6c..ffe8055 100644
--- a/main/ui/sign_message.c
+++ b/main/ui/sign_message.c
@@ -149,34 +149,32 @@ bool show_sign_message_activity(const char* message, const char* hashhex, const
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNMSG_ACCEPT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = (act == act_message2) ? act_message1 : act_summary;
- break;
-
- case BTN_SIGNMSG_MSG:
- act = act_message1;
- break;
-
- case BTN_SIGNMSG_HASH:
- act = act_hash;
- break;
-
- case BTN_SIGNMSG_PATH:
- act = act_path;
- break;
-
- case BTN_SIGNMSG_NEXT:
- act = (act == act_message1) ? act_message2 : act_summary;
- break;
-
- case BTN_SIGNMSG_REJECT:
- return false;
-
- case BTN_SIGNMSG_ACCEPT:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ act = (act == act_message2) ? act_message1 : act_summary;
+ break;
+
+ case BTN_SIGNMSG_MSG:
+ act = act_message1;
+ break;
+
+ case BTN_SIGNMSG_HASH:
+ act = act_hash;
+ break;
+
+ case BTN_SIGNMSG_PATH:
+ act = act_path;
+ break;
+
+ case BTN_SIGNMSG_NEXT:
+ act = (act == act_message1) ? act_message2 : act_summary;
+ break;
+
+ case BTN_SIGNMSG_REJECT:
+ return false;
+
+ case BTN_SIGNMSG_ACCEPT:
+ return true;
}
}
}
diff --git a/main/ui/sign_tx.c b/main/ui/sign_tx.c
index 3c78b01..2a534bc 100644
--- a/main/ui/sign_tx.c
+++ b/main/ui/sign_tx.c
@@ -359,48 +359,46 @@ static bool show_input_output_activity(const char* title, const bool is_wallet_o
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNTX_ACCEPT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = (act == act_addr2) ? act_addr1 : act_summary;
- break;
-
- case BTN_ADDRESS_REJECT:
- case BTN_ADDRESS_ACCEPT:
- case BTN_SIGNTX_ASSETINFO_DONE:
- act = act_summary;
- break;
-
- case BTN_ADDRESS_NEXT:
- act = act_addr2;
- break;
-
- case BTN_SIGNTX_ASSETINFO_NEXT:
- act = (act == act_assetinfo1) ? act_assetinfo2 : act_assetinfo1;
- break;
-
- case BTN_SIGNTX_ADDRESS:
- act = act_addr1;
- break;
-
- case BTN_SIGNTX_TICKERAMOUNT:
- act = act_tickeramt;
- break;
-
- case BTN_SIGNTX_ASSETINFO:
- act = act_assetinfo1;
- break;
-
- case BTN_SIGNTX_WARNING:
- act = act_warning;
- break;
-
- case BTN_SIGNTX_REJECT:
- return false;
+ switch (ev_id) {
+ case BTN_BACK:
+ act = (act == act_addr2) ? act_addr1 : act_summary;
+ break;
+
+ case BTN_ADDRESS_REJECT:
+ case BTN_ADDRESS_ACCEPT:
+ case BTN_SIGNTX_ASSETINFO_DONE:
+ act = act_summary;
+ break;
+
+ case BTN_ADDRESS_NEXT:
+ act = act_addr2;
+ break;
+
+ case BTN_SIGNTX_ASSETINFO_NEXT:
+ act = (act == act_assetinfo1) ? act_assetinfo2 : act_assetinfo1;
+ break;
+
+ case BTN_SIGNTX_ADDRESS:
+ act = act_addr1;
+ break;
+
+ case BTN_SIGNTX_TICKERAMOUNT:
+ act = act_tickeramt;
+ break;
+
+ case BTN_SIGNTX_ASSETINFO:
+ act = act_assetinfo1;
+ break;
+
+ case BTN_SIGNTX_WARNING:
+ act = act_warning;
+ break;
+
+ case BTN_SIGNTX_REJECT:
+ return false;
- case BTN_SIGNTX_ACCEPT:
- return true;
- }
+ case BTN_SIGNTX_ACCEPT:
+ return true;
}
}
}
@@ -720,26 +718,24 @@ static bool show_final_confirmation_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNTX_ACCEPT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
- case BTN_SIGNTX_TICKERAMOUNT:
- act = act_feeamt;
- break;
+ case BTN_SIGNTX_TICKERAMOUNT:
+ act = act_feeamt;
+ break;
- case BTN_SIGNTX_WARNING:
- act = act_warning;
- break;
+ case BTN_SIGNTX_WARNING:
+ act = act_warning;
+ break;
- case BTN_SIGNTX_REJECT:
- return false;
+ case BTN_SIGNTX_REJECT:
+ return false;
- case BTN_SIGNTX_ACCEPT:
- return true;
- }
+ case BTN_SIGNTX_ACCEPT:
+ return true;
}
}
}
diff --git a/main/ui/signer.c b/main/ui/signer.c
index 473253c..2a8f082 100644
--- a/main/ui/signer.c
+++ b/main/ui/signer.c
@@ -176,38 +176,36 @@ bool show_signer_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNER_NEXT);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = (act == act_xpub2) ? act_xpub1 : act_summary;
- break;
-
- case BTN_SIGNER_FINGERPRINT:
- act = act_fingerprint;
- break;
-
- case BTN_SIGNER_DERIVATION:
- act = act_derivation;
- break;
-
- case BTN_SIGNER_PATH:
- act = act_path;
- break;
-
- case BTN_SIGNER_XPUB:
- act = act_xpub1;
- break;
-
- case BTN_SIGNER_XPUB_NEXT:
- act = (act == act_xpub1) ? act_xpub2 : act_summary;
- break;
-
- case BTN_SIGNER_PREV:
- return false;
-
- case BTN_SIGNER_NEXT:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ act = (act == act_xpub2) ? act_xpub1 : act_summary;
+ break;
+
+ case BTN_SIGNER_FINGERPRINT:
+ act = act_fingerprint;
+ break;
+
+ case BTN_SIGNER_DERIVATION:
+ act = act_derivation;
+ break;
+
+ case BTN_SIGNER_PATH:
+ act = act_path;
+ break;
+
+ case BTN_SIGNER_XPUB:
+ act = act_xpub1;
+ break;
+
+ case BTN_SIGNER_XPUB_NEXT:
+ act = (act == act_xpub1) ? act_xpub2 : act_summary;
+ break;
+
+ case BTN_SIGNER_PREV:
+ return false;
+
+ case BTN_SIGNER_NEXT:
+ return true;
}
}
}
diff --git a/main/ui/update_pinserver.c b/main/ui/update_pinserver.c
index 46f649c..9f2b663 100644
--- a/main/ui/update_pinserver.c
+++ b/main/ui/update_pinserver.c
@@ -124,30 +124,28 @@ bool show_pinserver_details_activity(
gui_set_current_activity(act);
const int32_t ev_id = gui_activity_wait_button(act, BTN_PINSERVER_DETAILS_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_BACK:
- act = act_summary;
- break;
-
- case BTN_PINSERVER_DETAILS_URL_A:
- act = act_urlA;
- break;
-
- case BTN_PINSERVER_DETAILS_URL_B:
- act = act_urlB;
- break;
-
- case BTN_PINSERVER_DETAILS_PUBKEY:
- act = act_pubkey;
- break;
-
- case BTN_PINSERVER_DETAILS_DISCARD_DELETE:
- return false;
-
- case BTN_PINSERVER_DETAILS_RETAIN_CONFIRM:
- return true;
- }
+ switch (ev_id) {
+ case BTN_BACK:
+ act = act_summary;
+ break;
+
+ case BTN_PINSERVER_DETAILS_URL_A:
+ act = act_urlA;
+ break;
+
+ case BTN_PINSERVER_DETAILS_URL_B:
+ act = act_urlB;
+ break;
+
+ case BTN_PINSERVER_DETAILS_PUBKEY:
+ act = act_pubkey;
+ break;
+
+ case BTN_PINSERVER_DETAILS_DISCARD_DELETE:
+ return false;
+
+ case BTN_PINSERVER_DETAILS_RETAIN_CONFIRM:
+ return true;
}
}
}
@@ -214,14 +212,12 @@ bool show_pinserver_certificate_activity(const char* cert_hash_hex, const bool i
while (true) {
const int32_t ev_id = gui_activity_wait_button(act, BTN_PINSERVER_DETAILS_RETAIN_CONFIRM);
- if (ev_id != BTN_EVENT_TIMEOUT) {
- switch (ev_id) {
- case BTN_PINSERVER_DETAILS_DISCARD_DELETE:
- return false;
-
- case BTN_PINSERVER_DETAILS_RETAIN_CONFIRM:
- return true;
- }
+ switch (ev_id) {
+ case BTN_PINSERVER_DETAILS_DISCARD_DELETE:
+ return false;
+
+ case BTN_PINSERVER_DETAILS_RETAIN_CONFIRM:
+ return true;
}
}
}
Why this scored 13/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.