diff options
| author | JF <jf@codingfield.com> | 2020-10-21 20:15:02 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-10-21 20:15:02 (GMT) |
| commit | cabf1168d429db84b0985e25881ead86d80dde3c (patch) | |
| tree | 42f5187cd7de9e947cfe839761cf17662be8210e /src/components/ble/NotificationManager.cpp | |
| parent | 440ae412b9ce9c868aa8b98e6da537bd0ec62de7 (diff) | |
Notifications : Fix display of notification index/number.
Diffstat (limited to 'src/components/ble/NotificationManager.cpp')
| -rw-r--r-- | src/components/ble/NotificationManager.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 6ed3f83..11555be 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;}); +} + |
