diff options
author | Allan Wang <me@allanwang.ca> | 2021-01-24 22:04:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-24 22:04:37 -0800 |
commit | 94aa2dd8125f474570f366408645e5a81236c573 (patch) | |
tree | 2952e3ca17872ef10545081a100f16b720f0072a /app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt | |
parent | 68db99597b68c87f1e0eb2d1feb6b6c63bbff1e9 (diff) | |
parent | 35adc9529f1466e3ae45ee1934536f696bc24547 (diff) | |
download | frost-94aa2dd8125f474570f366408645e5a81236c573.tar.gz frost-94aa2dd8125f474570f366408645e5a81236c573.tar.bz2 frost-94aa2dd8125f474570f366408645e5a81236c573.zip |
Merge pull request #1742 from AllanWang/messenger
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/services/NotificationUtils.kt | 11 |
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 |