Skip to content
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand Down
Loading