Fix chance for recovery alarm to overwrite main/awareness alarm after the equation has already been completed (while in status window)

This commit is contained in:
2026-08-14 18:18:58 -04:00
parent 96a9f26814
commit 2f03fa6659
+8 -3
View File
@@ -135,15 +135,14 @@ static void status_window_load(StatusWindowPurpose purpose) {
text_layer_set_text(s_status_txt_layer, "Congrats! To ensure you're awake, I'll re-open without vibrating in 9 minutes. Complete the equation within 60 seconds to disarm me. Take too long and I'll vibrate and re-schedule another alarm.\n\nPress SELECT to exit or BACK to disable this tutorial in the future (and exit).");
window_set_click_config_provider(s_status_window, status_main_tutorial_click_config_provider);
break;
case STATUS_CONFIRMATION:
tick_timer_service_unsubscribe();
case STATUS_CONFIRMATION: {
static char s_status_confirmed_buffer[106];
snprintf(s_status_confirmed_buffer, sizeof(s_status_confirmed_buffer), "Alarm disarmed and re-set (%02u:%02u) successfully.\n\nPress SELECT to exit or BACK to change the alarm time.", the_time.HourSet, the_time.MinuteSet);
text_layer_set_text(s_status_txt_layer, s_status_confirmed_buffer);
window_set_click_config_provider(s_status_window, status_confirmation_click_config_provider);
break;
}
case STATUS_SET_FAILURE:
tick_timer_service_unsubscribe();
text_layer_set_text(s_status_txt_layer, "Failed to set an alarm.\nPress any button to return to alarm setter.");
window_set_click_config_provider(s_status_window, status_set_failure_click_config_provider);
break;
@@ -663,8 +662,14 @@ static void alarm_select_hold_handler(void *recognizer, void *ctx) {
}
}
// solution is correct, meaning a non-recovery alarm needs scheduled;
// set dummy handler to avoid overwriting an important alarm with a
// no-longer-important recovery alarm
wakeup_service_subscribe(NULL);
if (s_alarming_for_awareness) {
// set main alarm if the awareness alarm was solved
tick_timer_service_unsubscribe(); // alarm is fully disarmed - stop vibes+countdown for confirmation window
if (schedule_alarm(MAIN_ALARM)) {
push_status_window(STATUS_CONFIRMATION);
}