From cabf1168d429db84b0985e25881ead86d80dde3c Mon Sep 17 00:00:00 2001 From: JF Date: Wed, 21 Oct 2020 22:15:02 +0200 Subject: Notifications : Fix display of notification index/number. --- src/components/ble/NotificationManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/components/ble/NotificationManager.cpp') diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 6ed3f835..11555bee 100644 --- a/src/components/ble/NotificationManager.cpp +++ b/src/components/ble/NotificationManager.cpp @@ -28,6 +28,7 @@ void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categ NotificationManager::Notification NotificationManager::GetLastNotification() { NotificationManager::Notification notification = notifications[readIndex]; + notification.index = 1; return notification; } @@ -81,3 +82,7 @@ bool NotificationManager::ClearNewNotificationFlag() { return newNotification.exchange(false); } +size_t NotificationManager::NbNotifications() const { + return std::count_if(notifications.begin(), notifications.end(), [](const Notification& n){ return n.valid;}); +} + -- cgit v1.2.3-70-g09d2