diff --git a/app/src/main/java/net/ardevd/tagius/features/background/TimerNotificationManager.kt b/app/src/main/java/net/ardevd/tagius/features/background/TimerNotificationManager.kt index ee5a949..fac1642 100644 --- a/app/src/main/java/net/ardevd/tagius/features/background/TimerNotificationManager.kt +++ b/app/src/main/java/net/ardevd/tagius/features/background/TimerNotificationManager.kt @@ -1,6 +1,7 @@ package net.ardevd.tagius.features.background import android.app.NotificationChannel +import android.app.NotificationChannelGroup import android.app.NotificationManager import android.app.PendingIntent import android.content.Context @@ -19,13 +20,20 @@ object TimerNotificationManager { fun showTimerNotification(context: Context, description: String, startTime: Long, key: String) { val channelId = "active_timer" + val groupId = "timers" val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + notificationManager.createNotificationChannelGroup( + NotificationChannelGroup(groupId, context.getString(R.string.notification_group_timers)) + ) + val channel = NotificationChannel( channelId, context.getString(R.string.notification_channel_active_timer), NotificationManager.IMPORTANCE_LOW - ) + ).apply { + group = groupId + } notificationManager.createNotificationChannel(channel) val intent = Intent(context, MainActivity::class.java).apply { diff --git a/app/src/main/java/net/ardevd/tagius/features/background/WeeklySummaryWorker.kt b/app/src/main/java/net/ardevd/tagius/features/background/WeeklySummaryWorker.kt index 1b5a459..69d2655 100644 --- a/app/src/main/java/net/ardevd/tagius/features/background/WeeklySummaryWorker.kt +++ b/app/src/main/java/net/ardevd/tagius/features/background/WeeklySummaryWorker.kt @@ -1,6 +1,7 @@ package net.ardevd.tagius.features.background import android.app.NotificationChannel +import android.app.NotificationChannelGroup import android.app.NotificationManager import android.app.PendingIntent import android.content.Context @@ -72,14 +73,21 @@ class WeeklySummaryWorker( private fun sendNotification(durationString: String, tagsCount: Int) { val channelId = "weekly_summary" + val groupId = "background_tasks" val notificationManager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + notificationManager.createNotificationChannelGroup( + NotificationChannelGroup(groupId, applicationContext.getString(R.string.notification_group_background)) + ) + val channel = NotificationChannel( channelId, applicationContext.getString(R.string.notification_channel_weekly_summary), NotificationManager.IMPORTANCE_DEFAULT - ) + ).apply { + group = groupId + } notificationManager.createNotificationChannel(channel) val descText = applicationContext.getString(R.string.weekly_summary_desc, durationString, tagsCount) diff --git a/app/src/main/java/net/ardevd/tagius/features/background/ZombieCheckWorker.kt b/app/src/main/java/net/ardevd/tagius/features/background/ZombieCheckWorker.kt index 070c0c8..7efc613 100644 --- a/app/src/main/java/net/ardevd/tagius/features/background/ZombieCheckWorker.kt +++ b/app/src/main/java/net/ardevd/tagius/features/background/ZombieCheckWorker.kt @@ -1,6 +1,7 @@ package net.ardevd.tagius.features.background import android.app.NotificationChannel +import android.app.NotificationChannelGroup import android.app.NotificationManager import android.app.PendingIntent import android.content.Context @@ -54,16 +55,23 @@ class ZombieCheckWorker( private fun sendNotification(hours: Int) { val channelId = "zombie_alert" + val groupId = "background_tasks" val notificationManager = applicationContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager + notificationManager.createNotificationChannelGroup( + NotificationChannelGroup(groupId, applicationContext.getString(R.string.notification_group_background)) + ) + // Create Channel (Safe to call repeatedly) val channel = NotificationChannel( channelId, applicationContext.getString(R.string.notification_channel_timer_alerts), NotificationManager.IMPORTANCE_HIGH - ) + ).apply { + group = groupId + } notificationManager.createNotificationChannel(channel) val descText = applicationContext.getString(R.string.zombie_still_working_desc, hours) diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index 274b35c..cd6cb02 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -59,8 +59,10 @@ Se Statistikk Tags Aktiv Timer + Timere Timer Pågår Ukentlig Oppsumering Du tracket %1$s på tvers av %2$d tagger denne uken. Ukently Oppsummering + Bakgrunnsjobber \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8358050..8489639 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -69,6 +69,8 @@ Your timer has been running for %d hours. Time Alerts Active Timer + Background Tasks + Timers Timer Running Weekly Summary You tracked %1$s across %2$d tags this week.