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;