aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-09-17 12:11:57 -0400
committerAllan Wang <me@allanwang.ca>2017-09-17 12:11:57 -0400
commit0075824e3b601cee6dcc784f84012cd8d3403ff7 (patch)
treed2582941d62903d5c7298c12c9818d07a19a2ca1
parent8a246c72c8710c20749d5b944a0ce9ac1842c2e3 (diff)
downloadfrost-0075824e3b601cee6dcc784f84012cd8d3403ff7.tar.gz
frost-0075824e3b601cee6dcc784f84012cd8d3403ff7.tar.bz2
frost-0075824e3b601cee6dcc784f84012cd8d3403ff7.zip
Use notifCount rather than index
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt8
1 files 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++