Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading