diff options
author | Allan Wang <me@allanwang.ca> | 2020-02-29 23:35:07 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2020-02-29 23:35:07 -0800 |
commit | 118635f6630487e93a519e9a63151d95b31ee8b1 (patch) | |
tree | 354c8b0a52866ad62e1b20860517bc5287401cb4 /app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt | |
parent | 34e5eebbc2dfdd9e71ba200c044f3637ba89aaa2 (diff) | |
parent | e732e30d97babca49ba5f7d97aea1620ba14024b (diff) | |
download | frost-118635f6630487e93a519e9a63151d95b31ee8b1.tar.gz frost-118635f6630487e93a519e9a63151d95b31ee8b1.tar.bz2 frost-118635f6630487e93a519e9a63151d95b31ee8b1.zip |
Merge remote-tracking branch 'origin/dev' into save-image
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt | 10 |
1 files changed, 5 insertions, 5 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 7b20e07c..5b62a4ed 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt @@ -33,6 +33,7 @@ import com.pitchedapps.frost.R import com.pitchedapps.frost.activities.FrostWebActivity import com.pitchedapps.frost.db.CookieEntity import com.pitchedapps.frost.db.FrostDatabase +import com.pitchedapps.frost.db.NotificationDao import com.pitchedapps.frost.db.latestEpoch import com.pitchedapps.frost.db.saveNotifications import com.pitchedapps.frost.enums.OverlayContext @@ -112,8 +113,7 @@ enum class NotificationType( * Returns the number of notifications generated, * or -1 if an error occurred */ - suspend fun fetch(context: Context, data: CookieEntity, prefs: Prefs): Int { - val notifDao = FrostDatabase.get().notifDao() + suspend fun fetch(context: Context, data: CookieEntity, prefs: Prefs, notifDao: NotificationDao): Int { val response = try { parser.parse(data.cookie) } catch (ignored: Exception) { @@ -170,7 +170,7 @@ enum class NotificationType( val ringtone = ringtoneProvider(prefs) notifs.forEachIndexed { i, notif -> // Ring at most twice - notif.withAlert(context, i < 2, ringtone).notify(context) + notif.withAlert(context, i < 2, ringtone, prefs).notify(context) } return notifs.size } @@ -307,8 +307,8 @@ data class FrostNotification( val notif: NotificationCompat.Builder ) { - fun withAlert(context: Context, enable: Boolean, ringtone: String): FrostNotification { - notif.setFrostAlert(context, enable, ringtone) + fun withAlert(context: Context, enable: Boolean, ringtone: String, prefs: Prefs): FrostNotification { + notif.setFrostAlert(context, enable, ringtone, prefs) return this } |