diff options
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt | 9 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt index eb81ff04..14b6ec39 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt @@ -155,11 +155,14 @@ enum class NotificationType( return 0 } - L.d { "Notif $name new epoch ${newNotifContents.map { it.timestamp }.max()}" } + L.d { "${newNotifContents.size} new notifs found for $name" } - val notifs = newNotifContents.map { createNotification(context, it) } + if (!notifDao.saveNotifications(channelId, newNotifContents)) { + L.d { "Skip notifs for $name as saving failed" } + return 0 + } - notifDao.saveNotifications(channelId, newNotifContents) + val notifs = newNotifContents.map { createNotification(context, it) } frostEvent("Notifications", "Type" to name, "Count" to notifs.size) if (notifs.size > 1) 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 e1db5fa6..8b100c19 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt @@ -45,7 +45,6 @@ import org.koin.android.ext.android.inject class NotificationService : BaseJobService() { val cookieDao: CookieDao by inject() - val notifDao: NotificationDao by inject() override fun onStopJob(params: JobParameters?): Boolean { super.onStopJob(params) |