mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-12 14:03:00 +01:00
Do not send notifications if db save fails
This commit is contained in:
parent
7f1f2247de
commit
e96160d7f7
@ -155,12 +155,15 @@ 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" }
|
||||
|
||||
if (!notifDao.saveNotifications(channelId, newNotifContents)) {
|
||||
L.d { "Skip notifs for $name as saving failed" }
|
||||
return 0
|
||||
}
|
||||
|
||||
val notifs = newNotifContents.map { createNotification(context, it) }
|
||||
|
||||
notifDao.saveNotifications(channelId, newNotifContents)
|
||||
|
||||
frostEvent("Notifications", "Type" to name, "Count" to notifs.size)
|
||||
if (notifs.size > 1)
|
||||
summaryNotification(context, userId, notifs.size).notify(context)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user