From 0075824e3b601cee6dcc784f84012cd8d3403ff7 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 17 Sep 2017 12:11:57 -0400 Subject: Use notifCount rather than index --- .../kotlin/com/pitchedapps/frost/services/NotificationService.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt index adfed499..d481e941 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt @@ -124,11 +124,11 @@ class NotificationService : JobService() { val prevLatestEpoch = prevNotifTime.epoch L.v("Notif Prev Latest Epoch $prevLatestEpoch") var newLatestEpoch = prevLatestEpoch - unreadNotifications.forEachIndexed unread@ { index, elem -> + unreadNotifications.forEach unread@ { elem -> val notif = parseNotification(data, elem) ?: return@unread L.v("Notif timestamp ${notif.timestamp}") if (notif.timestamp <= prevLatestEpoch) return@unread - NotificationType.GENERAL.createNotification(this, notif, index == 0) + NotificationType.GENERAL.createNotification(this, notif, notifCount == 0) if (notif.timestamp > newLatestEpoch) newLatestEpoch = notif.timestamp notifCount++ @@ -181,11 +181,11 @@ class NotificationService : JobService() { val prevLatestEpoch = prevNotifTime.epochIm L.v("Notif Prev Latest Im Epoch $prevLatestEpoch") var newLatestEpoch = prevLatestEpoch - unreadNotifications.forEachIndexed unread@ { index, elem -> + unreadNotifications.forEach unread@ { elem -> val notif = parseMessageNotification(data, elem) ?: return@unread L.v("Notif im timestamp ${notif.timestamp}") if (notif.timestamp <= prevLatestEpoch) return@unread - NotificationType.MESSAGE.createNotification(this, notif, index == 0) + NotificationType.MESSAGE.createNotification(this, notif, notifCount == 0) if (notif.timestamp > newLatestEpoch) newLatestEpoch = notif.timestamp notifCount++ -- cgit v1.2.3