@@ -20,7 +20,6 @@ import com.philkes.notallyx.utils.cancelReminder
2020import com.philkes.notallyx.utils.createChannelIfNotExists
2121import com.philkes.notallyx.utils.getOpenNotePendingIntent
2222import com.philkes.notallyx.utils.scheduleReminder
23- import com.philkes.notallyx.utils.truncate
2423import java.util.Date
2524import kotlinx.coroutines.CoroutineScope
2625import kotlinx.coroutines.Dispatchers
@@ -96,24 +95,40 @@ class ReminderReceiver : BroadcastReceiver() {
9695 )
9796 }
9897 database.getBaseNoteDao().get(noteId)?.let { note ->
98+ val contentText =
99+ if (note.type == com.philkes.notallyx.data.model.Type .LIST ) {
100+ note.items.joinToString(" \n " ) { (if (it.checked) " ✅ " else " 🔳 " ) + it.body }
101+ } else {
102+ note.body
103+ }
99104 val notification =
100105 NotificationCompat .Builder (context, NOTIFICATION_CHANNEL_ID )
101106 .setSmallIcon(R .drawable.notebook)
102- .setContentTitle(note.title)
103- .setContentText(note.body.truncate(200 ))
107+ .setContentTitle(note.title.ifEmpty { context.getString(R .string.note) })
108+ .setContentText(contentText)
109+ .setStyle(NotificationCompat .BigTextStyle ().bigText(contentText))
104110 .setPriority(NotificationCompat .PRIORITY_HIGH )
111+ .setGroup(GROUP_REMINDERS )
105112 .addAction(
106113 R .drawable.visibility,
107114 context.getString(R .string.open_note),
108115 context.getOpenNotePendingIntent(note),
109116 )
110117 .setDeleteIntent(getDeletePendingIntent(context, noteId, reminderId))
111118 .build()
119+ val summaryNotification =
120+ NotificationCompat .Builder (context, NOTIFICATION_CHANNEL_ID )
121+ .setSmallIcon(R .drawable.notebook_multiple)
122+ .setGroup(GROUP_REMINDERS )
123+ .setGroupSummary(true )
124+ .build()
125+
112126 note.reminders
113127 .find { it.id == reminderId }
114128 ?.let { reminder: Reminder ->
115129 setIsNotificationVisible(true , context, note.id, reminderId)
116130 manager.notify(note.id.toString(), reminderId.toInt(), notification)
131+ manager.notify(SUMMARY_ID , summaryNotification)
117132 if (schedule)
118133 context.scheduleReminder(note.id, reminder, forceRepetition = true )
119134 }
@@ -220,7 +235,9 @@ class ReminderReceiver : BroadcastReceiver() {
220235 companion object {
221236 private const val TAG = " ReminderReceiver"
222237
238+ private const val SUMMARY_ID = 1231325
223239 private const val NOTIFICATION_CHANNEL_ID = " Reminders"
240+ private const val GROUP_REMINDERS = " notallyx.notifications.group.reminders"
224241
225242 const val EXTRA_REMINDER_ID = " notallyx.intent.extra.REMINDER_ID"
226243 const val EXTRA_NOTE_ID = " notallyx.intent.extra.NOTE_ID"
0 commit comments