diff options
author | Allan Wang <me@allanwang.ca> | 2020-02-29 23:34:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-29 23:34:58 -0800 |
commit | e732e30d97babca49ba5f7d97aea1620ba14024b (patch) | |
tree | 3101fb9e17eede3ffbf75e96358c6ac0a330aaf7 /app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt | |
parent | e893c5ab9a976031c15e792583b411f6c9a429e5 (diff) | |
parent | 551dbbcf1a56c33c378d6edfc3a3615311867001 (diff) | |
download | frost-e732e30d97babca49ba5f7d97aea1620ba14024b.tar.gz frost-e732e30d97babca49ba5f7d97aea1620ba14024b.tar.bz2 frost-e732e30d97babca49ba5f7d97aea1620ba14024b.zip |
Merge pull request #1657 from AllanWang/versions
Update versions
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt | 7 |
1 files changed, 4 insertions, 3 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 73c97b5e..4c80f63d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt @@ -23,6 +23,7 @@ import com.pitchedapps.frost.BuildConfig import com.pitchedapps.frost.R import com.pitchedapps.frost.db.CookieDao import com.pitchedapps.frost.db.CookieEntity +import com.pitchedapps.frost.db.NotificationDao import com.pitchedapps.frost.db.selectAll import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs @@ -34,7 +35,6 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import kotlinx.coroutines.yield import org.koin.android.ext.android.inject -import org.koin.core.inject /** * Created by Allan Wang on 2017-06-14. @@ -47,6 +47,7 @@ import org.koin.core.inject class NotificationService : BaseJobService() { private val prefs: Prefs by inject() + private val notifDao: NotificationDao by inject() private val cookieDao: CookieDao by inject() override fun onStopJob(params: JobParameters?): Boolean { @@ -119,7 +120,7 @@ class NotificationService : BaseJobService() { * Also normalized the output to return the number of notifications received */ private suspend fun fetch(jobId: Int, type: NotificationType, cookie: CookieEntity): Int { - val count = type.fetch(this, cookie, prefs) + val count = type.fetch(this, cookie, prefs, notifDao) if (count < 0) { if (jobId == NOTIFICATION_JOB_NOW) generalNotification(666, R.string.error_notification, BuildConfig.DEBUG) @@ -135,7 +136,7 @@ class NotificationService : BaseJobService() { private fun generalNotification(id: Int, textRes: Int, withDefaults: Boolean) { val notifBuilder = frostNotification(NOTIF_CHANNEL_GENERAL) - .setFrostAlert(this, withDefaults, prefs.notificationRingtone) + .setFrostAlert(this, withDefaults, prefs.notificationRingtone, prefs) .setContentTitle(string(R.string.frost_name)) .setContentText(string(textRes)) NotificationManagerCompat.from(this).notify(id, notifBuilder.build()) |