Forgot check for notifications permission

This commit is contained in:
Shinokuni 2024-08-08 18:07:10 +02:00
parent ba964ccce2
commit f7cd8ac998

View File

@ -1,6 +1,5 @@
package com.readrops.app.sync package com.readrops.app.sync
import android.annotation.SuppressLint
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
@ -159,7 +158,6 @@ class SyncWorker(
return workResult to syncResults return workResult to syncResults
} }
@SuppressLint("MissingPermission")
private suspend fun refreshLocalAccount( private suspend fun refreshLocalAccount(
repository: BaseRepository, repository: BaseRepository,
account: Account, account: Account,
@ -184,10 +182,13 @@ class SyncWorker(
val result = repository.synchronize( val result = repository.synchronize(
selectedFeeds = feeds, selectedFeeds = feeds,
onUpdate = { feed -> onUpdate = { feed ->
if (notificationManager.areNotificationsEnabled()) {
notificationBuilder.setContentText(feed.name) notificationBuilder.setContentText(feed.name)
.setStyle(NotificationCompat.BigTextStyle().bigText(feed.name)) .setStyle(NotificationCompat.BigTextStyle().bigText(feed.name))
.setProgress(feedMax, ++feedCount, false) .setProgress(feedMax, ++feedCount, false)
notificationManager.notify(SYNC_NOTIFICATION_ID, notificationBuilder.build()) notificationManager.notify(SYNC_NOTIFICATION_ID, notificationBuilder.build())
}
setProgress( setProgress(
workDataOf( workDataOf(