diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt index ebf77f6a..91aa0df0 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/api/task/PostNotifications.kt @@ -57,9 +57,11 @@ class PostNotifications(val app: App, nList: MutableList) { return summaryTexts.concat(", ") } - init { - val notificationManager = app.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + init { run { val count = nList.size + if (count == 0) + return@run + val notificationManager = app.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager val summaryCounts = SparseIntArray() val newNotificationsText = app.resources.getQuantityString(R.plurals.notification_count_format, count, count) @@ -165,5 +167,5 @@ class PostNotifications(val app: App, nList: MutableList) { notificationManager.notify(app.notifications.dataId, summary) } } - } + }} }