diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc4a8614..fd88ad3ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Added the alarm label to the upcoming alarm notification ([#183]) ## [1.6.0] - 2026-01-30 ### Added @@ -106,6 +108,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#107]: https://github.com/FossifyOrg/Clock/issues/107 [#144]: https://github.com/FossifyOrg/Clock/issues/144 [#158]: https://github.com/FossifyOrg/Clock/issues/158 +[#183]: https://github.com/FossifyOrg/Clock/issues/183 [#206]: https://github.com/FossifyOrg/Clock/issues/206 [#207]: https://github.com/FossifyOrg/Clock/issues/207 [#247]: https://github.com/FossifyOrg/Clock/issues/247 diff --git a/app/src/main/kotlin/org/fossify/clock/receivers/UpcomingAlarmReceiver.kt b/app/src/main/kotlin/org/fossify/clock/receivers/UpcomingAlarmReceiver.kt index fbc804b05..ae0ffb509 100644 --- a/app/src/main/kotlin/org/fossify/clock/receivers/UpcomingAlarmReceiver.kt +++ b/app/src/main/kotlin/org/fossify/clock/receivers/UpcomingAlarmReceiver.kt @@ -8,6 +8,7 @@ import android.content.Context import android.content.Intent import androidx.core.app.NotificationCompat import org.fossify.clock.R +import org.fossify.clock.extensions.dbHelper import org.fossify.clock.extensions.getClosestEnabledAlarmString import org.fossify.clock.extensions.getOpenAlarmTabIntent import org.fossify.clock.extensions.getSkipUpcomingAlarmPendingIntent @@ -35,6 +36,7 @@ class UpcomingAlarmReceiver : BroadcastReceiver() { } private fun showUpcomingAlarmNotification(context: Context, alarmId: Int) { + val label = context.dbHelper.getAlarmWithId(alarmId)?.label.orEmpty() context.getClosestEnabledAlarmString { alarmString -> val notificationManager = context.notificationManager NotificationChannel( @@ -52,9 +54,15 @@ class UpcomingAlarmReceiver : BroadcastReceiver() { alarmId = alarmId, notificationId = UPCOMING_ALARM_NOTIFICATION_ID ) + val contentText = if (label.isNotEmpty()) { + "$alarmString - $label" + } else { + alarmString + } + val notification = NotificationCompat.Builder(context, UPCOMING_ALARM_CHANNEL_ID) .setContentTitle(context.getString(R.string.upcoming_alarm)) - .setContentText(alarmString) + .setContentText(contentText) .setSmallIcon(R.drawable.ic_alarm_vector) .setPriority(Notification.PRIORITY_LOW) .addAction(