From 399396e821f8cb93ec307f5446f2fcee2c86882a Mon Sep 17 00:00:00 2001 From: DustinHab Date: Sat, 12 Sep 2026 21:35:22 +0200 Subject: [PATCH] Don't let a notification cancel a ringing alarm A new notification unconditionally loads the notification preview, which destroys the currently loaded screen. If the alarm or an expired timer is ringing at that moment, ~Alarm() and ~Timer() stop the ringing as part of that teardown, so the alert is cancelled rather than hidden behind the preview. Skip the preview while the watch itself is alerting. The notification is still stored and can be read from the notification list. Fixes #1223 --- src/displayapp/DisplayApp.cpp | 15 ++++++++++++++- src/displayapp/DisplayApp.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 84fa603622..b1e8f6f7d5 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -367,7 +367,12 @@ void DisplayApp::Refresh() { // Only used for recovery firmware break; case Messages::NewNotification: - LoadNewScreen(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); + // Loading the preview destroys the current screen. While the alarm or an expired timer is + // ringing, ~Alarm() and ~Timer() stop the ringing, so the alert would be cancelled instead + // of just being hidden. The notification is still stored and can be read from the list. + if (!IsAlerting()) { + LoadNewScreen(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); + } break; case Messages::TimerDone: { if (state != States::Running) { @@ -684,6 +689,14 @@ void DisplayApp::PushMessage(Messages msg) { } } +bool DisplayApp::IsAlerting() { + if (alarmController.IsAlerting()) { + return true; + } + auto timerState = timer.GetTimerState(); + return timerState && timerState->expired; +} + void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { switch (direction) { case DisplayApp::FullRefreshDirections::Down: diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 016f91d3b6..a9813b536d 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -128,6 +128,8 @@ namespace Pinetime { void Refresh(); void LoadNewScreen(Apps app, DisplayApp::FullRefreshDirections direction); void LoadScreen(Apps app, DisplayApp::FullRefreshDirections direction); + /// Is the watch itself alerting the user (alarm or expired timer)? + bool IsAlerting(); void PushMessageToSystemTask(Pinetime::System::Messages message); Apps nextApp = Apps::None;