aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/services
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-01-12 21:15:08 -0800
committerAllan Wang <me@allanwang.ca>2021-01-12 21:15:08 -0800
commite01e51574613459a036c1d60383bfb229799a407 (patch)
tree4214c9803638fcc1b9d9e19159651f7115c846c4 /app/src/main/kotlin/com/pitchedapps/frost/services
parent0e5c1ab2dd2b574970883576e18f9a119b058788 (diff)
downloadfrost-e01e51574613459a036c1d60383bfb229799a407.tar.gz
frost-e01e51574613459a036c1d60383bfb229799a407.tar.bz2
frost-e01e51574613459a036c1d60383bfb229799a407.zip
Convert all theme access to themeprovider
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/services')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt
index 0a90895e..0bb9d254 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt
@@ -31,6 +31,7 @@ import androidx.core.app.NotificationCompat
import ca.allanwang.kau.utils.color
import ca.allanwang.kau.utils.string
import com.pitchedapps.frost.R
+import com.pitchedapps.frost.injectors.ThemeProvider
import com.pitchedapps.frost.prefs.Prefs
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.frostUri
@@ -41,13 +42,13 @@ import com.pitchedapps.frost.utils.frostUri
const val NOTIF_CHANNEL_GENERAL = "general"
const val NOTIF_CHANNEL_MESSAGES = "messages"
-fun setupNotificationChannels(c: Context, prefs: Prefs) {
+fun setupNotificationChannels(c: Context, themeProvider: ThemeProvider) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
val manager = c.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val appName = c.string(R.string.frost_name)
val msg = c.string(R.string.messages)
- manager.createNotificationChannel(NOTIF_CHANNEL_GENERAL, appName, prefs)
- manager.createNotificationChannel(NOTIF_CHANNEL_MESSAGES, "$appName: $msg", prefs)
+ manager.createNotificationChannel(NOTIF_CHANNEL_GENERAL, appName, themeProvider)
+ manager.createNotificationChannel(NOTIF_CHANNEL_MESSAGES, "$appName: $msg", themeProvider)
manager.notificationChannels
.filter {
it.id != NOTIF_CHANNEL_GENERAL &&
@@ -61,14 +62,14 @@ fun setupNotificationChannels(c: Context, prefs: Prefs) {
private fun NotificationManager.createNotificationChannel(
id: String,
name: String,
- prefs: Prefs
+ themeProvider: ThemeProvider
): NotificationChannel {
val channel = NotificationChannel(
id,
name, NotificationManager.IMPORTANCE_DEFAULT
)
channel.enableLights(true)
- channel.lightColor = prefs.accentColor
+ channel.lightColor = themeProvider.accentColor
channel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
createNotificationChannel(channel)
return channel