Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Comment thread
ardevd marked this conversation as resolved.

val intent = Intent(context, MainActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-no/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
<string name="records_stats_desc">Se Statistikk</string>
<string name="stats_tags_used">Tags</string>
<string name="notification_channel_active_timer">Aktiv Timer</string>
<string name="notification_group_timers">Timere</string>
<string name="timer_running">Timer Pågår</string>
<string name="weekly_summary_title">Ukentlig Oppsumering</string>
<string name="weekly_summary_desc">Du tracket %1$s på tvers av %2$d tagger denne uken.</string>
<string name="notification_channel_weekly_summary">Ukently Oppsummering</string>
Comment thread
ardevd marked this conversation as resolved.
<string name="notification_group_background">Bakgrunnsjobber</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
<string name="zombie_still_working_desc">Your timer has been running for %d hours.</string>
<string name="notification_channel_timer_alerts">Time Alerts</string>
<string name="notification_channel_active_timer">Active Timer</string>
<string name="notification_group_background">Background Tasks</string>
<string name="notification_group_timers">Timers</string>
<string name="timer_running">Timer Running</string>
<string name="weekly_summary_title">Weekly Summary</string>
<string name="weekly_summary_desc">You tracked %1$s across %2$d tags this week.</string>
Expand Down
Loading