From 5c3f255d844a5f47f555e9c69550c2d30f757b07 Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Mon, 8 May 2023 00:24:08 +0100 Subject: [PATCH] notifications: Dismiss to watchface when empty #1716 commit 5a078216caec2ba83be13594db16ce6e8a24b03b Author: Eli Tan <5410435+eliedrian@users.noreply.github.com> Date: Thu Mar 30 15:43:05 2023 +0800 notifications: Dismiss to watchface when empty Set `running` to false to flag end of watchface when there are no more notifications left to display. notifications: Update now inaccurate comment notifications: Fix `currentItem` possibly being null Consequentially, `currentItem` can be left null when `running` is set to false. This is fine. The notifications screen is ending anyway. notifications: Delay ending screen for dismiss animation notifications: End screen when item is not valid --- src/displayapp/screens/Notifications.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 037c43a7f6..3a3f5f2be5 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -82,7 +82,6 @@ void Notifications::Refresh() { } else if (mode == Modes::Preview && dismissingNotification) { running = false; - currentItem = std::make_unique(alertNotificationService, motorController); } else if (dismissingNotification) { dismissingNotification = false; @@ -113,11 +112,11 @@ void Notifications::Refresh() { alertNotificationService, motorController); } else { - currentItem = std::make_unique(alertNotificationService, motorController); + running = false; } } - running = currentItem->IsRunning() && running; + running = running && currentItem->IsRunning(); } void Notifications::OnPreviewInteraction() { @@ -173,7 +172,9 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } else if (nextMessage.valid) { currentId = nextMessage.id; } else { - // don't update id, won't be found be refresh and try to load latest message or no message box + // don't update id, notification manager will try to fetch + // but not find it. Refresh will try to load latest message + // or dismiss to watchface } DismissToBlack(); return true;